22. 途中経過出力コマンド例
swift -frontend -dump-parse [file name]
構文
解析
意味
解析
SIL
Gen
SIL
Opt
swift -frontend -dump-ast [file name]
swift -frontend -emit-silgen [file name]
swift -frontend -emit-sil [file name]
33. Replace typealias keyword with associatedtype
for associated type declarations
(proposal: SE0011)
https://github.com/apple/swift-evolution/blob/master/proposals/0011-replace-typealias-associated.md
41. References
- apple/swift
https://github.com/apple/swift
- apple/swift README
https://github.com/apple/swift/blob/master/README.
md
- Swift Programming Language Evolution
https://github.com/apple/swift-evolution#development-
major-version--swift-50
- Swift Contributing
https://swift.org/contributing/
- Compiler and Standard Library
https://swift.org/compiler-stdlib/#compiler-architecture
- gyb.py
https://github.com/apple/swift/blob/master/utils/gyb.py
- Swiftコンパイラ開発環境構築
http://qiita.com/rintaro/items/2047a9b88d9249459d9a
- Swift コンパイラのアーキテクチャ
http://qiita.com/rintaro/items/3ad640e3938207218c20
- Swiftコンパイラの構造と基盤テクニック
http://qiita.com/demmy/items/f08a65298d2f2caf1360
- Swiftのコンパイラを改造して独自構文を追加する
http://qiita.com/koher/items/aea1b44d0aef43b0059c
- How to Read the Swift Standard Library Source
https://oleb.net/blog/2016/10/swift-stdlib-source/
- Swift Intermediate Language (SIL)
https://github.com/apple/swift/blob/master/docs/SIL.rs
t
- StandardLibraryProgrammersManual.md (書き途中)
https://github.com/apple/swift/blob/27b044ec19d9cb9
2e3d49d678f5249b9031ff99d/docs/StandardLibraryPr
ogrammersManual.md
そして、後半です。
@@
AST を元に SIL を生成します。
SIL とは Swift と LLVM IR の中間の言語で、LLVM IR にすると Swift の型情報はなくなるのですが、この時点ではまだ情報があります。
@@
SIL Optimizer で、変数を初期化しているかとか、switch 文で全網羅しているかなどのフローの制約を検査したり、ARC の最適化などが行われます。
@@
そして最後に、SIL を LLVM IR に変換します。