Compiler internals

In construction. Please be patient.

 

This section is about the internals the Arplan compiler/interpreter. It describes exactly how it works from top to bottom. Each step and intermediate result is explained in details. The high-level design of the compiler/interpreter as well as faced issues are discussed.

 

However, it is not a coding tutorial. Code is intentionnally not included! The implementation could be done in various programming language using this documentation as guideline. ...With some adaptation needs of course.

 

Overview:

  • Cut down the text into a tree of lines
  • Parse each line independently
  • For each body, parse each line using the adequate grammar
  • Parsing
    • keep track of line & caret data
    • good error reporting
  • Transform parse tree in abstract syntax graph
    • Operators to functions, one element tuple to element, etc
    • Connect symbols according to scope
  • Symbols: duplicates, missing?
  • Type checking
  • Evaluate