Studiegids

nl en

Compiler Construction

Vak
2022-2023

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.

Course Objectives

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

Timetable

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 week, 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

There are 6 practical assignments, each one about designing compiler functionality to treat various language features and compiler components and optimizations. 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%), in-class activity (20%), and various bonuses which add on top of the regular activities.

The bonuses are programming assignments, expanding the compiler designed in the main practical assignment. (up to 1p extra)

Assessment method

The final grade of this course is composed of a large practical assignment (80%), in-class activity (20%), and various bonuses which add on top of the regular activities. To pass the course, students have to get an average grade higher than or equal to 6 (six) for the assignments. All the assignments have to be submitted.

The in-class activity is composed of several quizzes. Participation in the quizzes is not mandatory but highly recommended.

Course load

Total hours of study: 168 hrs.
Practical work: 100 hrs
Lectures & Tutoring: 20 hrs
Self-tuition: 48 hrs

Reading 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.

Registration

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

Remarks

none