ukitaka
December 15, 2018
390

# SwiftのDemanglerを書く @ わいわいswiftc番外編

## ukitaka

December 15, 2018

## Transcript

Bool

8. ### Mangle / Demangleͱ͸ SwiftͷDemangleίϚϯυ \$ swift demangle '\$S13ExampleNumber6isEven6numberSbSi_tF' \$S13ExampleNumber6isEven6numberSbSi_tF —>

ExampleNumber.isEven(number: Swift.Int) -> Swift.Bool
9. ### Mangle / Demangleͱ͸ SwiftͷDemangleίϚϯυ \$ swift demangle '\$S13ExampleNumber6isEven6numberSbSi_tF' \$S13ExampleNumber6isEven6numberSbSi_tF —>

ExampleNumber.isEven(number: Swift.Int) -> Swift.Bool ࠓ೔͸͜ΕΛ࡞Γ·͢

11. ### Swift Demangler workshop ՝୊ʹ͍ͭͯ ▸ جຊ֤ࣗREADMEΛΈͳ͕ΒਐΊͯ΋Β͍·͢ ▸ ՝୊1ʙ5·Ͱ͋Γɺ՝୊1Λશһ͕ୡ੒͢Δ͜ͱΛ໨ඪʹ͠·͢ ▸ ՝୊1ʹ͸αϙʔτ͕͍ͭͯΔͷͰɺͦΕΛΈͳ͕Β΍ͬͯΈ·͠ΐ͏

▸ Ͱ͖Δਓ͸ͲΜͲΜਐΊͯ΋Βͬͯେৎ෉Ͱ͢ ▸ ಛʹ5ͷsubstitution͸ॏཁͳͱ͜ΖͳͷͰ

19. ### Swift Demangler workshop ՝୊1 \$S13ExampleNumber6isEven6numberSbSi_tF ؔ਺ͷγάωνϟ (≒ ܕ) Sb͸ฦΓ஋ͷܕ Bool

Si_t͸Ҿ਺ͷܕ (Int)
20. ### Swift Demangler workshop ՝୊1 global ::= entity entity ::= context

entity-spec context ::= module module ::= identifier \$S13ExampleNumber6isEven6numberSbSi_tF global
21. ### Swift Demangler workshop ՝୊1 global ::= entity entity ::= context

entity-spec context ::= module module ::= identifier \$S13ExampleNumber6isEven6numberSbSi_tF global entity
22. ### Swift Demangler workshop ՝୊1 global ::= entity entity ::= context

entity-spec context ::= module module ::= identifier \$S13ExampleNumber6isEven6numberSbSi_tF context entity-spec module
23. ### Swift Demangler workshop ՝୊1 entity-spec ::= decl-name label-list function-signature 'F'

function-signature ::= params-type params-type throws? label-list ::= empty-list label-list ::= ('_' | identifier)* throws ::= 'K' params-type ::= type decl-name ::= identifier identifier ::= NATURAL IDENTIFIER-STRING \$S13ExampleNumber6isEven6numberSbSi_tF decl-name label-list function-signature