TU Delft | CS4200 | 2021-2022
Compiler Construction
- Master Computer Science
- Common Core Software Technology
- Specialization Programming Languages
- Credits: 2 x 5 ECTS
- Lectures Q1: Thursday 11:00 - 12:45
- Lab Q1: Tuesday 10:45 - 12:45, 13:45 - 15:45
- Lectures Q2: Thursday 15:45 - 17:45
- Lab Q2: Friday 13:45 - 17:45
- Lecturer: Eelco Visser (e.visser@tudelft.nl)
- TA: Ruben van Baarle
- TA: Thijs Molendijk
- TA: Aron Zwaan (for Q1)
- TA: Jeff Smits (for Q2)
- TA: Gabriƫl Konat (for Spoofax3)
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.Tentative Lecture Schedule CS4200-A/Q1
Lectures are on Thursdays 10:45 - 12:45.
- Sep 2: What is a compiler?
- Sep 3: Declarative Syntax Definition (Friday!)
- Sep 9: Disambiguation and Layout Sensitive Syntax
- Sep 16: Type Constraints
- Sep 23: Name Binding Constraints
- Sep 30: Constraint Resolution
- Oct 7: More Constraints and Statix
- Oct 14: Parsing
- Oct 14: More Parsing
- Oct 21: Summary & Further Study
- Thu Oct 28, 13:30-16:30: Exam Q1
Tentative Lecture Schedule CS4200-B/Q2
Lectures are on Thursdays 10:45 - 12:45. (Note the extra lecture on Friday Sep 4.)
- Nov 11: Transformation with Rewrite Rules
- Nov 18: Composing Transformations with Strategy Combinators
- Nov 25: Instruction Sets and Code Generation
- Dec 2: Functions, Calling Conventions, and Code Generation Mechanics
- Dec 9: Nested Functions & Memory Management
- Dec 16: Representing Objects & Register Allocation
- Dec 23: Data-Flow Analysis
- Jan 13: Beyond Compiler Construction
- Fri Jan 28, 13:30-16:30: Exam Q2