CS4200: Compiler Construction

  • Lectures: Thursday 10:45 - 12:45
  • Lab Q1: Tuesday 10:45 - 12:45, 13:45 - 15:45
  • Lab Q2: Friday 13:45 - 17:45
  • Shared Study Lab on Wednesday
Course Staff

Computer Science Building 28 at Van Mourik Broekmanweg

Compiler Construction

Compilers translate the source code of programs in a high-level programming language into executable (virtual) machine code. Nowadays, compilers are typically integrated into development environments providing features like syntax highlighting, content assistance, live error reporting, and continuous target code generation.

This course studies the architecture of compilers and interactive programming environments and the concepts and techniques underlying the components of that architecture. For each of the components of a compiler we study the formal theory underlying the language aspect that it covers, declarative specification languages to define compiler components, and the techniques for their implementation. The concepts and techniques are illustrated by application to small languages or language fragments.

The compiler construction program consists of two courses of 5 ECTS each.

CS4200-A: Front-End (Q1)

In the first course we study the front-end of the compiler that parses and type checks programs. We study meta-languages for the definition of the syntax and static semantics of programming languages. [Study guide]

CS4200-B: Back-End (Q2)
In the second course we study the back-end of the compiler that performs static analysis, optimization, and code generation. [Study guide]
Spoofax Language Workbench
The Spoofax Language Workbench is an environment for the development of programming languages using high-level declarative meta-languages for syntax, static semantics, dynamic semantics, program analysis, and program transformation. We use Spoofax to implement a compiler and IDE for the project language and in homework assignments to experiment with various aspects of compilers in isolation.
ChocoPy: Project Language
In the course project students implement a compiler for ChocoPy, a subset of Python3 with static types. The back-end of the compiler generates RISC-V code, which can be run with a simulator running on the JVM. The language comes with a fully specified using formal grammar, typing rules, and operational semantics. ChocoPy was developed at UC Berkeley for their compiler course.
WebLab: Homework Assignments and Exams
We use the WebLab learning management system for homework assignments. In WebLab you can submit answers to exercises with grammars, type systems, and transformations, which we can automatically grade. You can even program the solutions directly in WebLab, but it is probably more convenient at this stage to do that in Spoofax and then copy the solutions. We will also use WebLab for the (online) digital exams for the course. Thus, you will be expected to program in the Spoofax meta-languages at the exam.

Lecture Schedule CS4200-A/Q1

Lectures are on Thursdays 10:45 - 12:45 and take place online. The venue will be announced on Brightspace.

Tentative Lecture Schedule CS4200-B/Q2

Lectures are on Thursdays 10:45 - 12:45 and take place online. The venue will be announced on Brightspace.

Recorded Talks about Spoofax

A YouTube Playlist with recordings of tutorials and research talks about (research related to) the Spoofax Language Workbench.