- Haskell Stack
- LLVM
- BNFC
- Happy
- Alex
make
Typechecker
./latc [-v] <file [files...]>
Compiler
./latc_llvm [-v] <file [files...]>
- Basic Latte typechecker and LLVM compiler
- Using PHI nodes instead of
alloca
andstore
- Copy Propagation and Constant Folding
- Dead Code Elimination
- Global Common Subexpression Elimination
- Extensions:
- Classes with virtual methods
Important note: Even though the typechecker is able to validate arrays, the compiler does not support them. It informs the user with an error message.
- src/
- Latte.cf - Grammar
- Forontend/
- Desugaring.hs - Desugaring of the AST, mainly transforming
for
loops intowhile
loops and incrementation and decrementation of variables into simple arithmetic. - Typechecker.hs - Typechecking of the AST.
- Desugaring.hs - Desugaring of the AST, mainly transforming
- Backend/
- Milkremover.hs - Transforms Latte into Espresso IR
- SingleShotAffogato.hs - Transform Espresso IR into SSA form and performs (CP, DCE, GCSE) loop until a fixpoint is reached.
- ArabicaGenearator.hs - Generates LLVM IR from Espresso IR, assuming it is in SSA form. Here is where the main vritual methods are implemented.
- ASTInterpreter.hs - An early version of Espresso IR interpreter, used for debugging.
- tests/ - Tests for the typechecker and the compiler (tests/extensions/arrays1 are irrelevant)
- lib/ - Latte standard library with addition of
concatStrings
,compareStrings
and__calloc__
- .desugared - Latte program after desugaring
- .esp - Espresso IR
- .esp.ssa - Espresso IR in SSA form after optimizations
- .ll - LLVM IR
- .bc - LLVM Bitcode