Course syllabus
This is a static page where content will remain mostly constant during the course.
Course design
- The course consists of a single project: constructing a compiler for a small Java-like programming language in groups of one to two students. Groups of two are recommended.
- To pass this course, students must pass three assignments, and a short oral exam during exam week.
- The assignments test your ability to produce a working compiler, and determine your grade for this course. Make sure that your compiler passes the testsuite before submitting. The final deadline before the oral exams is strict. The other deadlines are only there to encourage a good pace of study in this course.
- The individual oral exam tests that all group members have been actively involved in the project and share a full understanding of the compiler. You will be asked to present your compiler to the examiner, who will then ask you some questions about it. Someone else did X, I worked on Y instead is not considered a valid answer.
- You must hand in your final assignment before being allowed to take the oral exam. No exceptions to this rule will be considered.
- Your grade is determined by the extensions you implement in your final assignment. Your performance at the oral exam will not affect your grade other than passing or failing.
- Submissions are made in the GitLab system, see description below.
Exam 2-4 June
The final grading component for this course is an oral exam.
The oral exam can either be taken in-person or via Zoom.
The exam is pass/fail. The core of the course is the project, which is difficult. The exam, which ought not be difficult, is done to check that you understand the compiler you have submitted. In particular, those that have been working in pairs should make sure that they understand all components of the compiler they have submitted.
Assignment Submission
You will develop your code in Chalmers GitLab and make submissions in GitLab by tagging commits as submissions. See instructions on GitLab and how to make submissions.
Deadlines
We expect submissions according to the dates shown below. The first three deadlines are soft deadlines that indicate expected study pace. However, the Extensions final deadline is strict. We will not accept any submission after 31 May 2026, so make sure to submit a first version for the Extensions on the first deadline on 24 May 2026.
- Frontend deadline: 5 April 2026
- Backend deadline: 26 April 2026
- Extensions first deadline: 24 May 2026
- Extensions final deadline: 31 May 2026
Useful links
- The github repo. with the project description., the tester. and other resources.
- The resource section has links to literature and software tools.
- The gitlab instructions page explains how gitlab is to be used
Slack
This course uses Slack as a quick communication medium. Use it to ask questions about the course, gitlab, find a project partner, etc. Follow this link to join Slack.
Lectures
The schedule for the lectures is in TimeEdit.
Office Hours
Fridays 12:00-13:00, drop-in and ask questions in root EDIT 6111.
Teachers
Lecturer and examiner for the course: Krasimir Angelov krasimir@chalmers.se. Links to an external site.
Teaching assistants (TA):
Oskar Eriksson oskeri@chalmers.se
Andras Kovacs andrask@chalmers.se
Ekaterina Voloshina ekaterina.voloshina@chalmers.se
Course evaluation
This course will undergo the usual course evaluation process. The student representatives for this course are:
- MPALG Emil Andersson Svanlind emilekblad90@gmail.com
- MPALG Ella Lindström ella.lindstroem@gmail.com
- MPSOF Eric Lundin lundiner@chalmers.se
- MPEES Yifan Tong yi.fan.tong@outlook.com
Learning objectives and syllabus
The official course syllabus documents: Chalmers Links to an external site. and GU Links to an external site..
In short, this course teaches students about compilers and how to develop them. The course is based around a project where participants build a compiler for a small programming language called Javalette. Javalette is an imperative language, a subset of C and of Java. The finished compiler includes a frontend (lexer, parser and type-checker) and at least one backend, generating LLVM code. Optional extensions include source language extensions and a backend targetting x86 assembly.
By completing this course, students will learn concepts and techniques such as grammars, lexers, parsers, abstract syntax, type systems, syntax-directed translation and code analysis. All of these techniques are used in state-of-the-art compilers.
Grading
For groups of two to pass the course and get grade 3, you need to:
- submit working solutions in all submissions,
- implement extensions worth a total of 2 credits in submission C, and
- pass the oral exam.
For higher grades, you need to implement further extensions in submission C:
- for grade 4, you need to earn 3 credits in submission C;
- for grade 5, you need to earn 5 credits in submission C.
For groups of four to pass the course and get grade 3, you need to:
- submit working solutions in all submissions,
- implement extensions worth a total of 4 credits in submission C, and
- pass the oral exam.
For higher grades, you need to implement further extensions in submission C:
- for grade 4, you need to earn 5 credits in submission C;
- for grade 5, you need to earn 7 credits in submission C .
Your performance at the oral exam will not affect your grade other than passing or failing. The purpose of the oral exam is to check whether the code you handed in is indeed your code.
Resources: literature, software, testsuite
Books
- The text book for the course is Aho, Lam, Sethi and Ullman: Compilers: Principles, Techniques, and Tools, 2nd. ed Links to an external site. (Pearson International Edition 2007). Available at Cremona and several web stores.
- An excellent text book on modern compiling techniques is Cooper and Torczon: Engineering a Compiler Links to an external site.. Focuses on backend issues; careful choice of material and very well written.
- A somewhat dated but nice book on implementing lazy functional languages is Peyton-Jones and Lester: Implementing functional languages Links to an external site. (free download as PDF file).
Software tools
Many software tools are available, in particular for front ends. We give just a few links.
- For C programmers: Flex and Bison Links to an external site..
- For Java programmers: JLex Links to an external site. and CUP Links to an external site..
- For Haskell programmers: Alex Links to an external site. and Happy Links to an external site..
Common interface to all the above: BNF Converter Links to an external site.. Flex/Bison and Alex/Happy are installed on the Linux computers in lab rooms. If you prefer to work in Java, download JLex/CUP.
Testsuite
For your and our convenience, we provide a testsuite Links to an external site. to help verify the correctness of your compiler, in the form of a collection of Javalette test programs and a driver program that runs your compiler on these test programs. Follow these instructions Links to an external site..
Documentation for project languages
Javalette. This language only exists as source language for the project in this course, even though it is strongly similar to subsets of C and Java. See the project description Links to an external site.. The syntax of the base language is specified by the BNFC source file Javalette.cf Links to an external site.. You may use this as the basis for your project. On the other hand, if you already have a BNFC file for a similar language (e.g. from the Programming Language Technology course), you might prefer that, if you have supporting code for e.g. type-checking. But you must then make sure to modify it to fit the description of Javalette.
LLVM. Downloadable software, documentation and tutorials are available at the LLVM home page Links to an external site.. In particular, you will need to consult the LLVM Language Reference Manual Links to an external site. and the LLVM Command Guide Links to an external site.. The LLVM tools are available on the Studat Linux machines. The input/output routines are implemented in runtime.ll Links to an external site..
x86 assembly language. Two books are available for free download: Paul Carter: PC Assembly tutorial Links to an external site. and Jonathan Bartlett: Programming from the ground up Links to an external site.. The input/output routines are implemented for 64-but x86 in runtime.s Links to an external site..