Back to projects
CSE420: Compiler Design · 2023
C Compiler - Intermediate Code Generator
A two-pass compiler front end that turns C-like source into three-address intermediate code by building an abstract syntax tree first and generating code from it second.
[ ARC ]
Architecture
01
Lexer
Flex
- Tokens with line numbers
02
Parser
Yacc / Bison
- Grammar actions build AST nodes
03
Semantic pass
- Scoped symbol table
- Type checks
04
Code generation
Recursive AST traversal
- Temporaries t0, t1, …
- param / call / return
[ KEY ]
Technical highlights
- 01
Separated parsing from code generation (two passes), so the AST can be inspected and generation stays a clean recursive walk.
- 02
Generates three-address code for expressions, assignments, and function calls with parameters and returns.
[ STK ]
Stack
- C++
- Flex
- Yacc / Bison
- AST
- Symbol tables