Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
1人で挑むSwiftコンパイラ 〜型システム入門編〜
Search
Shigure Shimotori
August 25, 2024
Programming
1.4k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
1人で挑むSwiftコンパイラ 〜型システム入門編〜
https://fortee.jp/iosdc-japan-2024/proposal/7a48c2e8-2a6b-4391-84dd-d543c6c3bf09
Shigure Shimotori
August 25, 2024
More Decks by Shigure Shimotori
See All by Shigure Shimotori
AsyncSequenceとAsyncStreamのプロポーザルを全部読む!!
s_shimotori
1
500
アメ車でサンノゼを走ってきたよ!
s_shimotori
0
410
おっと、お飲みごろの時間です!
s_shimotori
1
160
Synchronizationを支える技術
s_shimotori
1
320
英語
s_shimotori
1
1.2k
Parallel Socket Communication in Swift
s_shimotori
1
1k
UIColor Anatomy
s_shimotori
1
3.1k
UIColor Cluster
s_shimotori
1
860
iOSDC Japan 2019 60 mins for color
s_shimotori
5
4.2k
Other Decks in Programming
See All in Programming
フィードバックで育てるAI開発
kotaminato
1
120
SREの積み重ねがAI駆動開発のガードレールになった ― 7つの実践/SRE Guardrails The 7
tomoyakitaura
8
4.4k
Welcome to the "Parametricity" 🏙️ − Generic だけど Specific な世界 −
guvalif
PRO
1
170
yield再入門 #phpcon
o0h
PRO
0
540
アルゴリズムは何を圧縮しているのか ─ Haskell から育った「圧縮代数」というメンタルモデル
naoya
16
3.5k
Claude Opus 4.6以後の受託開発エンジニアの変化(Claude Code開発ノウハウ大公開スペシャルbyクラスメソッド)
iidatakuma
1
790
The Bowling Game- From Imperative to Functional Programming - Part 1
philipschwarz
PRO
0
330
はてなアカウント基盤 State of the Union
cockscomb
1
1.3k
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
7
1.9k
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
860
吝嗇家のためのAI活用 / AI development for miser - ChatGPT + Issue Driven Development
tooppoo
0
190
継続モナドとリアクティブプログラミング
yukikurage
3
610
Featured
See All Featured
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.4k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
The Language of Interfaces
destraynor
162
27k
Automating Front-end Workflow
addyosmani
1370
210k
Building AI with AI
inesmontani
PRO
1
1.1k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
390
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
420
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
350
Transcript
S_Shimotori 1ਓͰΉSwiftίϯύΠϥ ʙܕγεςϜೖฤʙ iOSDC Japan 2024
2 ΈΜͳ͍͜͠ͱΛͯͯ͠ ͍͍͚ͭͯͳ͍……ʂʂ
3
4 omochimetaru. SwiftͷܕਪΛֶ΅͏. 2024, 3.
͓ͪ͞ΜϚδײँ😭 • Θ͔Γ͔ͬͨ͢ʂ • ίϯύΠϥܕਪͷΘ͔Γ͍͢ࢿྉϚδوॏ 5
6 ϚδΘ͔Γ͔ͬͨ͢οεʂ 2019ͷ߹॓ͷ ϋϯζΦϯ͕ݩωλͩΑ ϋϯζΦϯʂʁ ͗͢ΔͷͰʁʁ
7 https://github.com/omochi/SwiftTypeInferenceHandsOn
SwiftTypeInferenceHandsOnͷ͓ • ৯͍ঢ়ଶͷͱ͜ΖΛࣗͰ࣮͠ɺશςετΛύεͰ͖ͨΒΫϦΞ 8 ʙʙதུʙʙ
ςετ͜Μͳײ͡ • ྫɿlet a = 3ͷܕਪ͕͏·͍͔͘͘ͷςετ 9 IntܕͱਪͰ͖ͨΒOKʂ
ͪΐͬͱݹ͍͚Ͳޓੑ͋Δ͔Βฏؾ ❤︎ 10
🤔🤔🤔🤔🤔 11
_InternalSwiftSyntaxParser 12
2019 13 Swift 5.1 Internal Swift Syntax Parser swift-syntax (2019)
SwiftTypeInferenceHandsOn
2024 14 Swift 5.1 Internal Swift Syntax Parser swift-syntax (2019)
SwiftTypeInferenceHandsOn Swift 5.10 ❌
ʲֶͼᶃʳޓੑ͕ͳ͍͜ͱ͋Δ • 2019 • swift-syntax͕ίϯύΠϥಉࠝͷInternal Swift Syntax Parserʹґଘ͍ͯͨ͠ • 2024
• ίϯύΠϥ͔ΒISSP͕औΓআ͔Ε͍ͯΔ 15 5લͷswift-syntaxͱ࠷৽ͷίϯύΠϥͷΈ߹ΘͤͰ͑ͳ͍
࠷৽ͷSwiftSyntaxʹରԠͤ͞·ͨ͠ 16 👈 ͨ͠ʂ
͔͜͜Β͕ຊ൪ʂ 17 ࢦͤʂ
ಓͷΓ͘ݥ͍͠ • ϝιουͷͷൣғ͕Θ͔Βͳ͍ɺͲ͜·Ͱ࣮ͨ͠Β͍͍͔Θ͔Βͳ͍ 18 ʙʙதུʙʙ
ίϯύΠϥͷ࣮ظ݁Ռ͕໌Β͔ʂ • ࣮͖͢ॲཧظ݁Ռ໌Β͔Ͱ͋ΓɺૉʹͦΕΛ࣮͢ΕOK • ϢʔβΠϯλʔϑΣʔεʹ͋Γ͕ͪͳᐆດͳ;Δ·͍ͳ͍ 19
ίϯύΠϥͷ࣮ظ݁Ռ͕໌Β͔ʂ • ࣮͖͢ॲཧظ݁Ռ໌Β͔Ͱ͋ΓɺૉʹͦΕΛ࣮͢ΕOK • ϢʔβΠϯλʔϑΣʔεʹ͋Γ͕ͪͳᐆດͳ;Δ·͍ͳ͍ 20 ζόϦॻ͍ͯ͋ΔΘ͚Ͱͳ͍ ૉਓ͕ϊʔώϯτͰѲ͢Δͷ͍͠ ͩͬͨΒ࣮ػDebug View
Hierarchy͔ΒḷΕͨͷʹ
ʲֶͼᶄʳ࣮ͷղઆΛฉ͖ಀ͢ͳ • ॳ৺ऀ͕ϊʔώϯτͰҰͰ͔ΔΑ͏ʹ࣮͞Ε͍ͯͳ͍…ʂ • ಡΈ͍͢ՕॴΛ୳͢ͷҰۤ࿑ 21
22 Ͱ͖ͨ🎉🎉 ʢͪΐͬͱؒҧ͚ͬͯͨͲʣ
ࣗͰίϝϯτΛॻ͖͠ͳ͕Βղ͍ͨ 23 ※ωλόϨࢭͷͨΊ෬͍ͤͯ·͢
ॴײʢ੍ݶ࣌ؒͷ؍ʣ • ςετͯ͢ύεͰ͖͕ͨɺ͚ͬ͜͏͕͔͔࣌ؒͬͨ • ϚΠϖʔεʹΜͩͷ͋ΓΰʔϧσϯΟʔΫΛফඅͨ͠ • ͠1ധ2ͷ߹॓Ͱઓ͍ͯͨ͠ΒΫϦΞͰ͖ͯͳ͔ͬͨ😢 24
ॴײʢқͷ؍ʣ • ࣗྗͰશ෦ղ͚ͨ🎉ɹҰ෦ؒҧ͚ͬͯͨͲ • ղͱؔͷͳ͍ॴʹ͍͚ͭͯͩͰ୭͔ͱٞͰ͖ͨΒΑ͔͔ͬͨ • ASTͷϊʔυvisitorύλʔϯͳͲݟͲ͜Ζ 25
ʲֶͼᶅʳஸ͍͍՝Λιϩ߈ུ͢Δ • ஸ͍͍қͷ՝͕ݟ͚ͭΒΕΔͱલ͖ʹͳΕΔɺָ͍͠ • ͬ͘͡Γιϩ߈ུͷ࣌ؒΛ࣋ͭͷ˕ 26
·ͱΊ • ؾʹͳΔൃදࢀߟจݙ͍ͯΈΔ • ࢥ͍ͬͯઓ͢Δͱ૾Ҏ্ͷֶͼ͕ಘΒΕΔ • ҰॹʹϋϯζΦϯʹઓͯ͠ΜͰσΟεΧογϣϯ͠Α͏ͥʂ 27
Special Thanks🙇 • ͓ͪϝλϧ͞Μ 28
S_Shimotoriʹ͍ͭͯ • X: S_Shimotori_pub • GitHub: S-Shimotori • ੜଉ: ࣗɺͨ·ʹ౦ژΨʔσϯςϥεلඌҪொ
29
͓·͚
ࢀߟจݙ • SwiftͷܕਪΛֶ΅͏ | Let's Learn About Type Inference in
Swift - Speaker Deck • https://speakerdeck.com/omochi/lets-learn-about-type-inference-in-swift • omochi/SwiftTypeInferenceHandsOn: Swiftc߹॓ 2019/09/28 • https://github.com/omochi/SwiftTypeInferenceHandsOn • Θ͍Θ͍swiftc։ൃ߹॓ at ౬Տݪ ͓ΜͲܙʙܕਪΞϧΰϦζϜΛֶͿʛsonson • https://note.com/sonson/n/n406f129fc993 31
ࢀߟจݙ • swift-syntax/Changelog.md at main · swiftlang/swift-syntax • https://github.com/swiftlang/swift-syntax/blob/main/Changelog.md •
Quick Overview of SwiftParser • https://speakerdeck.com/kitasuke/quick-overview-of-swiftparser • 32
ૉࡐ • ;͖ͩ͠ૉࡐઐαΠτʮϑΩμγσβΠϯʯ – ϑΩμγૉࡐ͕1000Ҏ্ू·ΔαΠτ • https://fukidesign.com/ 33