A couple of days ago, I set out to understand how compilers work by building one myself in C. It implements a full 3-phase pipeline (lexing → parsing → code generation) and emits valid C code.
It handles variables, arithmetic, comments, strings, number formats, and compiles most programs in ~1ms.
Arena allocation ensures zero memory leaks. Interactive mode and benchmarking tools are built-in.
Would love feedback or suggestions — especially around codegen strategies.
It handles variables, arithmetic, comments, strings, number formats, and compiles most programs in ~1ms.
Arena allocation ensures zero memory leaks. Interactive mode and benchmarking tools are built-in.
Would love feedback or suggestions — especially around codegen strategies.