August 2024
Intermediate to advanced
792 pages
23h 9m
English
A flow chart shows the stages of the compiler, including one new step in the semantic analysis stage.
1. The lexer turns program.c into a token list.
2. The parser turns the token list into an abstract syntax tree.
3. Semantic analysis turns the AST into a transformed AST. It has three steps:
a. Identifier resolution
b. Type checking (a new step)
c. Loop Labeling
4. TACKY Generation turns the transformed AST into TACKY.
5. Assembly generation turns TACKY into assembly. It has three steps:
a. Converting TACKY to Assembly
b. Replacing Pseudoregisters
c. Instruction Fix-Up
6. Code emission writes assembly to program.s.
Read now
Unlock full access