Compiler Design exercises with solutions

45 practice problems from the 15 lessons of the Compiler Design course, in lesson order and from easy to hard inside each lesson. Open a problem, write your code and press Submit: the tests run in your browser and nothing is sent to a server.

15 easy problems 15 medium problems 15 hard problems

How a compiler works

3 problems · Read the lesson

Lexical analysis with regular expressions

3 problems · Read the lesson

A hand-written lexer

3 problems · Read the lesson

Recursive-descent parsing

3 problems · Read the lesson

FIRST and FOLLOW sets

3 problems · Read the lesson

LL(1) parsing with a table

3 problems · Read the lesson

Bottom-up parsing: shift and reduce

3 problems · Read the lesson

Abstract syntax trees

3 problems · Read the lesson

Symbol tables and scopes

3 problems · Read the lesson

Type checking

3 problems · Read the lesson

Three-address code

3 problems · Read the lesson

Optimizing intermediate code

3 problems · Read the lesson

Basic blocks, control-flow graphs and liveness

3 problems · Read the lesson

Generating code for a stack machine

3 problems · Read the lesson

Register allocation

3 problems · Read the lesson