The view from ten thousand feet looks like so:
-FRONT END-
source text in Mythryl
|
| lexing and parsing
V
raw syntax
|
| typechecking
V
deep syntax
|
| pattern-match compilation and such.
-BACK END UPPER HALF- V
lambdacode form # Polymorphically typed lambda calculus format,
| # used only very briefly as a transitional format.
|
V
anormcode form # "A-Normal" format, used for machine-independent optimizations.
|
|
V
nextcode form # "Continuation passing style" format,
| # the workhorse format of the backend upper half.
|
-BACK END LOWER HALF- V
treecode form # Used for machine-dependent optimizations.
|
|
V
SSA ("static single assignment") # Used for more sophisticated machine-dependent optimizations.
| # This step is optional and in fact not currently done.
|
V
treecode format # When done with SSA stuff, we convert back to Code_Tree.
|
|
V
Machine code. # Position-independent -- we don't have a linker that patches code.
Thus, the Mythryl compiler code representations used are, in order:
-
Raw Syntax is the initial frontend code representation.
- Deep Syntax is the second and final frontend code representation.
- Anormcode (A-Normal format, which preserves expression tree structure) is the second backend code representation, and the first used for optimization.
- Nextcode ("continuation-passing style", a single-assignment basic-block-graph form where call and return are essentially the same) is the third and chief backend tophalf code representation.
- Nextcode is the third and chief backend tophalf code representation.
- Treecode is the backend tophalf/lowhalf transitional code representation.
- Intel32 (x86) instruction format (or equivalent for other target machines) — an abstract tree format.
- Intel32 (x86) machine language (or equivalent for other target machines) — absolute binary code.
These are respectively defined by:
-
src/lib/compiler/front/parser/raw-syntax/raw-syntax.api
- src/lib/compiler/front/typer-stuff/deep-syntax/deep-syntax.api
- src/lib/compiler/back/top/lambdacode/lambdacode-form.api
- src/lib/compiler/back/top/anormcode/anormcode-form.api
- src/lib/compiler/back/top/nextcode/nextcode-form.api
- src/lib/compiler/back/low/treecode/treecode-form.api
- src/lib/compiler/back/low/pwrpc32/code/machcode-pwrpc32.codemade.api
src/lib/compiler/back/low/sparc32/code/machcode-sparc32.codemade.api
src/lib/compiler/back/low/intel32/code/machcode-intel32.codemade.api
The transformations between these formats are implemented by:
-
1-2
- src/lib/compiler/front/typer/main/translate-raw-syntax-to-deep-syntax-g.pkg
- 2-3
- src/lib/compiler/back/top/translate/translate-deep-syntax-to-lambdacode.pkg
- 3-4
- src/lib/compiler/back/top/lambdacode/translate-lambdacode-to-anormcode.pkg
- 4-5
- src/lib/compiler/back/top/nextcode/translate-anormcode-to-nextcode-g.pkg
- 5-6
- src/lib/compiler/back/low/main/main/translate-nextcode-to-treecode-g.pkg
- 6-7
- src/lib/compiler/back/low/intel32/treecode/translate-treecode-to-machcode-intel32-g.pkg
- 7-8
- src/lib/compiler/back/low/pwrpc32/emit/translate-machcode-to-execode-pwrpc32-g.codemade.pkg
src/lib/compiler/back/low/sparc32/emit/translate-machcode-to-execode-sparc32-g.codemade.pkg
src/lib/compiler/back/low/intel32/translate-machcode-to-execode-intel32-g.pkg