Compiler for tiny subset of Modula 2.
It was done to learn basics of compiler engineering.
LLVM IR was used as a target language.
-
Peg packrat parser generator It consumes file like this and generates:
-
Ast -> CFG pass
-
CFG -> CFG in SSA form pass. Inspired by "Simple and Efficient Construction of Static Single Assignment Form (Braun)"
- Compiler doesn't have any garbage collection
- Implemented only arrays, structs, integers.
- Elimination of left recursion from grammar works only if left recursion appears in the first branch
- Syntax error reports are incomprehensible :) This thing should be definitely rewritten
Any modification of an array\structure copy entire agregate and then modify only needed subelement. This is done on purpose for potential CPS conversion in the future.