Compiler Design: final assessment
This covers the whole course. Take it after the last module.
Final quiz
Practical assessment: Compile a small language to stack code
Without using hints, write a compiler for a language with integer variables, + − * /, comparisons, if/else, while and print, that compiles each program to stack-machine code and runs it.
- The lexer and parser report the first error with its line
- The compiler reports undeclared variables before any code runs
- Loops and conditions use backpatched jumps
- The program prints the code with addresses, then the program's output and the number of steps
- Factorial, greatest common divisor and a prime-number program all give the right results
Final project
A compiler for a small language: Build a compiler for a small language with variables, arithmetic, comparisons, if/else, while and print, that compiles to stack-machine code and runs it on your own virtual machine.
How it is evaluated
- Correctness: every test program gives the right output, and every incorrect one a clear error
- Design: lexing, parsing, checking, code generation and running are separate phases
- Understanding: you can explain the code generated for each statement
- Testing: a set of test programs with expected outputs is run automatically
To complete this course
- Score at least 70% on the final quiz
- Solve the beginner and intermediate exercises in every lesson
- Finish the final project and check it against the evaluation criteria