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. Assembly generation turns the abstract syntax tree into assembly.

4. Code emission writes assembly to program.s.

Return to text

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.