This repo contains a lot of libraries and projects related to compilers.
It's based on my readings of Engineering a Compiler, 2nd Edition.
Everything is written in Rust.
My goal is to write multiple front-end, middle-end, and back-end representations for different languages and architectures.
These representations will be a lot simpler and with much less features than for a true compiler, as I only do this to learn compilers.
- Rust (Tested with rustc 1.40.0)
- LLVM (Tested with v9.0.0) (some compilers generate LLVM IR).
Tested on Ubuntu 18.04
A math expression with int, float, 4 operators and parentheses.
Performs evaluation with or without building an AST.
Projects:
./app/mini-calc-eval.
Language with only int32 type, where everything is a value. Can do functions, variables, scopes, if, loops.
Projects:
./libs/lanexpr./apps/cl-lanexpr
Register-based IR with int32 instructions and 32bits pointers. Can do basic maths, functions, calls, and (un)conditional branching.
Projects:
./libs/irint3a./apps/irint3a-utils
Really similar to irint3a, except that it's based on a stack-machine and doesn't have any registers
Projects:
./libs/irintsm./apps/irintsm-utils
Some compilers generate LLVM IR code.
Projects:
./libs/lanexpr
This script build and test all projects:
./check.shYou can just do the building by using --only-build