← Projects

CMinus Compiler

Jan 2022
A full compiler for the C-minus language (lexer, parser, semantic analyzer, and code generator) written in pure Python.

C-minus Compiler

A compiler for the C-minus language, implemented end to end in Python for the Compiler Design course:

  1. Scanner: tokenizing with a hand-written lexer.
  2. Parser: building the parse tree from the grammar.
  3. Semantic analysis: scope and type checks with useful error messages.
  4. Intermediate code generation: producing three-address-style output.

Writing a compiler is one of the best ways to understand how programming languages actually work.