UpNext

16.1.1  Schematic

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:

  1. Raw Syntax is the initial frontend code representation.
  2. Deep Syntax is the second and final frontend code representation.
  3. Anormcode (A-Normal format, which preserves expression tree structure) is the second backend code representation, and the first used for optimization.
  4. 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.
  5. Nextcode is the third and chief backend tophalf code representation.
  6. Treecode is the backend tophalf/lowhalf transitional code representation.
  7. Intel32 (x86) instruction format (or equivalent for other target machines) — an abstract tree format.
  8. Intel32 (x86) machine language (or equivalent for other target machines) — absolute binary code.

These are respectively defined by:

  1. src/lib/compiler/front/parser/raw-syntax/raw-syntax.api
  2. src/lib/compiler/front/typer-stuff/deep-syntax/deep-syntax.api
  3. src/lib/compiler/back/top/lambdacode/lambdacode-form.api
  4. src/lib/compiler/back/top/anormcode/anormcode-form.api
  5. src/lib/compiler/back/top/nextcode/nextcode-form.api
  6. src/lib/compiler/back/low/treecode/treecode-form.api
  7. 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

Comments and suggestions to: bugs@mythryl.org

UpNext