Skip to content

About

Optimix is a high-performance, handcrafted compiler designed in C++17, implementing advanced optimization techniques with a custom IR and SSA form. It features a 3-stage architecture and intrinsic I/O for efficient code execution and debugging, making it suitable for various programming needs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Optimix Compiler

Handcrafted optimizing compiler in C++17 — custom IR, Static Single Assignment (SSA), zero external dependencies.

C++17 CI


What It Does

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

Architecture

Source (.optx) → Lexer → Parser (AST) → IR Builder (3-Address Code)
                                              → SSA Pass (x → x_1, x_2)
                                                    → Interpreter (VM execution)

Tech Stack

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

My Role

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.

Quick Start

Download pre-built binary: Linux · macOS · Windows

chmod +x optimix
./optimix compile examples/factorial.optx   # Output: 120

Build 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 optimix

Architected & built by Aditya Pandey — AI-augmented development

About

Optimix is a high-performance, handcrafted compiler designed in C++17, implementing advanced optimization techniques with a custom IR and SSA form. It features a 3-stage architecture and intrinsic I/O for efficient code execution and debugging, making it suitable for various programming needs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages