PreviousUpNext

16.1.3  Front End

The Mythryl front end processes source code in two broad phases:

The core language syntax implementation is in the two files

src/lib/compiler/front/parser/lex/mythryl.lex
src/lib/compiler/front/parser/yacc/mythryl.grammar

The raw and deep syntax tree datastructures are defined in

src/lib/compiler/front/parser/raw-syntax/raw-syntax.api
src/lib/compiler/front/typer-stuff/deep-syntax/deep-syntax.api

The symbol tables used by the compiler are hierarchical, complex, and diffusely defined. A good entrypoint into studying them is

src/lib/compiler/front/typer-stuff/symbolmapstack/symbolmapstack.pkg

The top of the symbol table hierarchy is

src/lib/compiler/toplevel/compiler-state/compiler-mapstack-set.pkg

NB: Unlike many compilers, Mythryl treats parsing and compiling a file as essentially unrelated activities: During an initial file-dependency-analysis make phase it reads and parses sourcefiles to obtain type information. The parse trees are then cached for use later after a compilation order has been selected for all files requiring re/compilation. The core of this caching logic is

src/app/makelib/compilable/thawedlib-tome.pkg

which manages everything we know about a particular sourcefile at any given point of time, including the parsetree (if known) and the resulting object file (if it has been generated).

From a control-flow point of view, the top level of the parse phase for an individual sourcefile may be taken to be the two entrypoints defined in

src/lib/compiler/front/parser/main/parse-mythryl.pkg

and the top level of the typechecking phase for one sourcefile may be taken to be

src/lib/compiler/front/typer/main/translate-raw-syntax-to-deep-syntax-g.pkg

Comments and suggestions to: bugs@mythryl.org

PreviousUpNext