Free module
Compilers
Learn how compilers work by building one: lexing, parsing, type checks, interpreting and code generation, in a real VM.
The lessons
Each lesson is free to read in full. Create a free account to run its commands in a live lab and to sit its quizzes and tasks.
1 · Virtual machine lab
From source code to a running program (gcc)
I can name the stages a compiler takes a program through.
Read the lesson2 · Virtual machine lab
Splitting source text into tokens (lexer)
I can turn source text into tokens.
Read the lesson3 · Virtual machine lab
Building a syntax tree from tokens (parser)
I can build a syntax tree from tokens.
Read the lesson4 · Virtual machine lab
Finding mistakes a parser cannot see (semantic analysis)
I can find the mistakes a parser cannot.
Read the lesson5 · Virtual machine lab
Running a syntax tree directly (interpreter)
I can run a syntax tree directly.
Read the lesson6 · Virtual machine lab
Turning a tree into stack code (code generation)
I can turn a syntax tree into instructions for a stack machine.
Read the lesson
Worked in a real lab
Every lesson of this module is worked in a lab started for you alone. The labs it uses:
Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.