Handcrafted optimizing compiler in C++17 — custom IR, Static Single Assignment (SSA), zero external dependencies.
Optimix is a 3-stage compiler implementing optimization techniques from LLVM and GCC — built entirely from scratch with zero dependencies (no Flex, Bison, or LLVM).
Technical Highlights:
- 3-stage pipeline — Frontend (AST) → Mid-end (IR) → Backend (Interpreter)
- SSA form — variable versioning and dominance analysis
- Custom 3-Address Code IR — linear intermediate representation
- CFG lowering — structured code → flat basic blocks with jump transitions
- Recursive descent parser — hand-written operator precedence parsing
- Memory management — stack allocation + heap simulation
- Cross-platform — pre-built binaries for Linux, macOS, Windows
Source (.optx) → Lexer → Parser (AST) → IR Builder (3-Address Code)
→ SSA Pass (x → x_1, x_2)
→ Interpreter (VM execution)
| Component | Technology |
|---|---|
| Language | C++17 (pure standard library) |
| Build | CMake + Makefile |
| Parser | Hand-written recursive descent |
| IR | Custom 3-Address Code |
| Optimization | SSA with variable versioning |
| Web | WebAssembly playground |
I designed the 3-stage compilation pipeline, chose SSA over basic data-flow analysis, defined the IR format, and planned the CFG lowering strategy. Code generation was accelerated using AI tools; compiler design decisions and cross-platform testing are mine.
Download pre-built binary: Linux · macOS · Windows
chmod +x optimix
./optimix compile examples/factorial.optx # Output: 120Build from source:
git clone https://github.com/AdityaPandey-DEV/Optimix-Compiler.git && cd Optimix-Compiler
clang++ -std=c++17 -I include src/main.cpp src/lexer/Lexer.cpp src/parser/Parser.cpp \
src/codegen/Interpreter.cpp src/ir/IR.cpp src/ir/IRBuilder.cpp src/ir/SSA.cpp -o optimixArchitected & built by Aditya Pandey — AI-augmented development