C0 Compiler
I implemented a compiler for C0 (a memory-safe subset of C) in OCaml, targeting x86-64 assembly for CMU's compiler course. The compiler supports all C0 language features, including:
- Branching
- Functions
- Structs
- Arrays
- Runtime Bounds Checks
- Graph-based register allocation
The compiler also implements a level of optimizations, which enables the following:
- Single Static Assignment (SSA), which is not itself an optimization, but enables optimizations.
- Constant Propagation and Constant Folding.
- Dead Code Elimination.
- Tail Call Optimization.