Compiler Construction

2023-2024

General Information

Course Code XB_0003
Credits 6 EC
Period P3
Course Level 300
Language of Tuition English
Faculty Faculty of Science
Course Coordinator dr. K. Freiherr von Gleissenthal
Examiner dr. K. Freiherr von Gleissenthal
Teaching Staff prof. dr. C. Giuffrida
dr. K. Freiherr von Gleissenthal
Part of programme(s)

Practical Information

You need to register for this course yourself. The (de)registration deadlines can be found on VU.nl

Teaching Methods Seminar, Practical, Lecture

Target audiences

This course is also available as:

Course Objective

Upon completion of this course, students will:

- have knowledge of grammars and compiler frontend principles, such as
lexing, (topdown and bottom-up) parsing, abstract syntax trees, semantic
analysis, and intermediate representation (IR) generation (Knowledge and
Understanding, Applying Knowledge and Understanding, Making Judgements)

- have a basic understanding of the compiler design and implementation
principles adopted by mainstream compiler frameworks such as LLVM
(Knowledge and understanding)

- have knowledge of compiler middle-end performance principles such as
IR-level optimizations and experience implementing them Knowledge and
Understanding, Applying Knowledge and Understanding, Making Judgements)

- have knowledge of compiler middle-end security principles such as
IR-level security hardening and experience implementing them Knowledge
and Understanding, Applying Knowledge and Understanding, Making
Judgements)

- have knowledge of compiler backend performance principles such as
machine-level optimizations (Knowledge and understanding, Applying
Knowledge and Understanding)

- have knowledge of compiler backend security principles such as
machine-level security hardening (Knowledge and Understanding, Applying
Knowledge and Understanding, Making Judgements)

Course Content

This course gives an introduction to the internals of modern compilers
with a unique twist: the emphasis is not just on translating a source
program into an executable binary, or traditional optimization passes,
but also on software hardening techniques to enhance the target
program’s security. As a result, the student learns about the
fundamental aspects of compilers, but also the performance and security
implications of the code it generates. To address these concerns,
students learn compiler-based techniques that improve both performance
and security. The course allows students to gather practical, hands-on
experience on building compiler components with weekly assignments.

The course focuses on the design of the major components of a modern
compiler pipeline: frontend (focus on lexing and parsing), intermediate
representation or IR (focus on optimizations, transformations, and
hardening), and backend (focus on code generation). In both the lectures
and the assignments, we emphasize what compiler builders encounter in
practice, rather than the details of all manners of parsing algorithms.
Specifically, the assignments focus on building a compiler for a C-like
language using the LLVM compiler framework, analyzing the code so that
we can optimize it, and adding additional checks to eliminate common
vulnerabilities that are common to C-like languages. All the assignments
build on top of a given framework and require localized extensions in
Python and/or C++ to implement language features, optimizations,
transformations/instrumentations, and code generation features.

Note: this is a very intensive, hands-on course. It is important to be
able to start immediately. For this, you need access to a computer with
the VirtualBox x86 virtualization environment installed.

Additional Information Teaching Methods

Lectures, Practicals.

Method of Assessment

Written exam on the material covered in lectures and three programming assignments. The final grade is the weighted average of the exam grade (50%) and the assignments (50%) + up to 1 point for a fourth bonus assignment. To pass the course, the exam grade must be at least 5.5, each assignment grade must be at least 4.0, and the final grade must be at least 5.5.


There is no resit opportunity for the programming assignments.

Literature

No set book. All materials will be made available during the course.

Additional Information Target Audience

Minor Deep Programming

Recommended background knowledge

Basic knowledge of Python and C/C++ is strongly recommended.