Vanwege de coronamaatregelen kan de onderwijsvorm of tentaminering afwijken. Zie voor actuele informatie de betreffende cursuspagina’s op Brightspace.

Studiegids

nl en

Compiler Construction

Vak
2021-2022

Admission requirements

This is a practical-intensive course, which involves lots of low-level systems programming. Mastering all this is also highly rewarding. Students are assumed to have taken courses in (advanced) programming, computer architecture/organization, computer networks, and operating systems at a BSc level.

Description

Computer programs in a higher programming language cannot be executed by a computer until they have been translated into lower-level code. In many cases this is done by a compiler.

In this course we learn how compilers convert source code into assembly code in several steps. We study the theory behind compilers with a keen eye on the practical aspects of building a compiler, and apply this in a series of assignments where we construct a C compiler, which outputs x86-64 code, executable on all modern Intel and AMD processors.

Topics covered during the lectures relate to the process of constructing a compiler, e.g.: lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code generation, and code optimization.

Learning goals

Gain insight into the functionality of the different phases of the compilation process, and how these phases are related to each other. Become familiar with the different steps in the construction of a compiler and the problems that arise with them

Rooster

Het meest recente rooster is te vinden op de Studenten-website:

Mode of Instruction

The course is composed of two components:
1. Lectures given by the instructor, to setup course format, assignments, and to teach key topics in compiler construction.
2. Self-study Lab Assignments. Students are expected to work on the lab assignments autonomously, outside of the lectures. We also set up Lab Class, every two weeks, immediately after the lectures. In these labs, students ask questions and get practical help by teaching assistants. Please note, this is a hands-on course, where the lab constitutes a large part of the final grade.

For the practicals of this course, we implement a (subset-of-)C compiler, which outputs x86-64 instructions.

A regular compiler has 4 main stages to go from code to machine-understandable instructions: 1. Lexical analyzer stage 2. Syntaxtree generator stage 3. Intermediate code generator stage 4. Machine-code emitter stage

Similarly, there are 4 practical assignments, each one about designing the next compiler stage. Students will build each next stage on top of their previous stage implementations.

A base framework will be published to write your implementation in, featuring: - Basic code to start from. - Unit tests to verify implementation correctness. - An automated grading system.
The assignment will be in modern C++ (C++14).

Grading

The final grade of this course is composed of a large practical assignment (80%), a final exam (20%), and various bonuses which add on top of the regular activities. To pass the course, students have to get a grade higher than or equal to 6 (six) for the exam, and the average of all four practical assignments has to be larger than or equal to 6 (six).

The bonuses are:
1. In-class quizzes. (up to 1p extra)
2. A programming assignment, expanding the compiler designed in the main practical assignment. (up to 1p extra)

Literature List

Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman, Compilers: Principles, Techniques, and Tools, second edition, Pearson New International Edition, 2013, ISBN 9781292024349.

Inschrijven

Aanmelding voor vakken verloopt via uSis. Hiervoor is de uSis-code van het vak nodig, die te vinden zijn in de Studiegids. Meer info over het inschrijven voor vakken of tentamens is hier te vinden.

MyTimetable

In MyTimetable kun je alle vak- en opleidingsroosters vinden, waarmee jij je persoonlijke rooster kunt samenstellen. Onderwijsactiviteiten waarvoor je in uSis staat ingeschreven, worden automatisch in je rooster getoond. Daarnaast kun je My Timetable gemakkelijk koppelen aan een agenda-app op je telefoon en worden roosterwijzigingen automatisch in je agenda doorgevoerd; bovendien ontvang je desgewenst per e-mail een notificatie van de wijziging.

Vragen? Bekijk de video-instructie, lees de instructie of neem contact op met de ISSC helpdesk.

Brightspace

Inschrijving voor vakken verloopt via uSis. Wanneer je je hier inschrijft voor een bepaald vak krijg je automatisch ook toegang tot de omgeving van dit vak via Brightspace.

Voor meer informatie over Brightspace kun je op deze link klikken om de handleidingen van de universiteit te bekijken. Bij overige vragen of problemen kan contact opgenomen worden met de helpdesk van de universiteit Leiden.

Contact

Teacher of the course, Alexandru Uta
Onderwijscoördinator Informatica, Riet Derogee