A flow chart shows the stages of the compiler.
1. The lexer turns program.c into a token list.
2. The parser turns the token list into an abstract syntax tree.
3. TACKY Generation (a new stage) turns the abstract syntax tree into TACKY.
4. Assembly generation turns TACKY into assembly. It has three steps (all new):
a. Converting TACKY to Assembly
b. Replacing Pseudoregisters
c. Instruction Fix-Up
5. Code emission writes assembly to program.s.
Get Writing a C Compiler now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.