未验证 提交 8e3be7b5 编写于 作者: V Vlad Zarytovskii 提交者: GitHub

Update compiler flow diagram (#13228)

* WIP: docs diagram update

* WIP: removed notes

* Remove old diagram file
上级 0cc2f65d
......@@ -55,15 +55,85 @@ The following are the most relevant parts of the F# compiler tooling, making up
The following is a diagram of how the different phases of the F# compiler work:
![F# compiler phases](http://fsharp.github.io/img/fscomp-phases.png)
```mermaid
stateDiagram-v2
state "Compilation phases" as Flow {
Lexing: Lexing
Parsing: Parsing
Import: Import
Typechecking: Type checking
Codegen: Code generation
Emit: IL emit
Inputs --> Lexing: Source and signature files
Inputs --> Import: Referecnces
Lexing --> Parsing
Parsing --> Typechecking
Import --> Typechecking
Typechecking --> Codegen
Codegen --> Emit
state Lexing {
BasicLexing: Basic Lexing
WhitespaceSensitiveLexing: Whitespace Sensitive Lexing
[*] --> BasicLexing
BasicLexing --> WhitespaceSensitiveLexing: A token stream from input source text.
WhitespaceSensitiveLexing --> [*]: A token stream, augmented per the F# Language Specification.
}
state Parsing {
Parser: Parsing
[*] --> Parser
Parser --> [*]: AST per the grammar in the F# Language Specification.
}
state Import {
Resolving: Resolving references
ImportNET: Importing .NET references
ImportFS: Importing F# references
[*] --> Resolving
Resolving --> ImportNET
Resolving --> ImportFS
ImportNET --> [*]
ImportFS --> [*]
}
state Typechecking {
SequentialTypechecking: Sequenctially type checking files
PatternMatchCompilation: Pattern match compilation
ConstraintSolving: Constraint solving
PostInferenceChecks: Post inference checks
[*] --> SequentialTypechecking
SequentialTypechecking --> PatternMatchCompilation
PatternMatchCompilation --> ConstraintSolving
ConstraintSolving --> PostInferenceChecks
PostInferenceChecks --> [*]
}
state Codegen {
QuotationTranslation: Quotation translation
Optimization: Optimization
Codegeneration: Code generation
AbstractILRewrite: Abstract IL rewriting
[*] --> QuotationTranslation
QuotationTranslation --> Optimization
Optimization --> Codegeneration
Codegeneration --> AbstractILRewrite
AbstractILRewrite --> [*]
}
state Emit {
Binary: Binary emit
Reflection: Reflection emit
Output: Output (assembly, references, PDBs, etc.)
[*] --> Binary
[*] --> Reflection
Binary --> Output
Reflection --> Output
}
}
```
The following are the key phases and high-level logical operations of the F# compiler code in its various configurations:
* _Basic lexing_. Produces a token stream from input source file text.
* _White-space sensitive lexing_. Accepts and produces a token stream, augmenting per the F# Language Specification.
* _White-space sensitive lexing_. Accepts and produces a token stream, augmenting per the [F# Language Specification](https://fsharp.org/specs/language-spec/).
* _Parsing_. Accepts a token stream and produces an AST per the grammar in the F# Language Specification.
* _Parsing_. Accepts a token stream and produces an AST per the grammar in the [F# Language Specification](https://fsharp.org/specs/language-spec/).
* _Resolving references_. For .NET SDK generally references are resolved explicitly by external tooling.
There is a legacy aspect to this if references use old .NET Framework references including for
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册