Compiler Construction

About this course

Programs that run on a computer are written in a computer language, and the languages used for writing computer programs have significantly evolved over time. By abstracting from the details of the underlying computer architecture, higher-level languages aim at making the process of developing a program simpler and more understandable than when using a lower-level language. Modern languages offer us a variety of different concepts for expressing (executable) programs. Domain-specific (modeling) languages are even created specifically to solve problems in a particular domain of interest. However, programs written in a higher-level language must be translated into a lower-level, executable representation, which requires various forms of compilers doing this job for us.

This course will provide students with an introduction to modern compiler construction. The first two-thirds of the course will cover classical topics ranging from scanning and parsing over semantic analysis and interpretation to code generation and optimization. In the exercises, we will develop a fully functional interpreter for our own programming language. The remaining third of the course is dedicated to study the transition form classical compiler techniques into principles of model-driven software development. In the exercises, we will develop a fully functional, domain-specific modeling environment.

Organisation

Prerequisites

Students should have basic programming skills with proficiency in at least one programming language, a solid understanding of algorithms and data structures, and foundational knowledge in discrete mathematics.

Learning outcomes

By the end of the course, students will be able to:

Why should I take this course?

The magic of computer languages:

Little languages are everywhere:

Domain-specific Languages and Model-driven Development

Schedule

DateLecture TopicExercise Topic
17-02-26IntroductionEx01: Warm-Up - Stack and Syntree
24-02-26– No class –(additional time to work on Ex01)
03-03-26Lexical Analysis: Handwritten ScannersEx02: A Handwritten Scanner
10-03-26Lexical Analysis: Scanner GeneratorsEx03: A Generated Scanner
17-03-26Syntax Analysis: Grammars and Syntax TreesEx04: Grammar and Syntax Tree for SPL'
24-03-26Syntax Analysis: Top-Down ParsingEx05: A Handwritten Parser
31-03-26Syntax Analysis: Parser GeneratorsEx06: A Generated Parser – JavaCC Continued
07-04-26– No class –(additional time to work on Ex05 and Ex06)
14-04-26Excursus: LR ParsingWrap-Up on Ex05
21-04-26Semantic Analysis and Interpretation (I)Wrap-Up on Ex06
28-04-26Semantic Analysis and Interpretation (II)Ex07: A Tree-Walk Interpreter
05-05-26 PEGs, Packrats and Parser Combinators (Guest Lecture by Oscar Nierstrasz)(additional time to work on Ex07)
12-05-26Code Generation and Optimization(additional time to work on Ex07)
19-05-26Beyond Classical Compiler Construction: Modeling Language EngineeringWrap-Up on Ex07
26-05-26Q&A

Exam

Repetition exam