Programming Language Technology

DAT151 (Chalmers) / DIT231 (GU)
Winter Term 2017 (LP2)

Google group: (please provide your full name and date of birth when requesting membership!)

Fire / Chalmers studieportal / GU course description / GU course page stub / GU ad / GU kursplan / GU course plan / Course page 2016

News and changes

The Fire deadline for late submission has been extended until Sunday 25th.

The reexam will be held 5 April in building SB.

Fire is open for the late submission of labs.

Exam text and solution. I am very pleased with the outcome, thanks for studying well!

Please submit outstanding lab solutions by Friday!

The exam will be held 8 January 2018, 8.30-12.30 in building M on the Johanneberg campus.

In the last lecture, we will walk through an example exam.

Lab 4 is online.

Lab 3 is online.

The code from today's "Hands-on for lab 2" session has been posted in the plt-2017 group.

The schedule has been updated (see below).

Change in text for Lab 2: The return statement can also return a void value. (If you stick to the old text and disallow this, it is also fine, but it makes more sense to allow it.)

Ad: Apply for teaching assistent LP3/4! Deadline is 2017-11-30.

Lab 2 is online.

Tentative Schedule

All lectures are in HC2, starting at 13:15.

Material: plt = course book, dragon = Dragon book. Slides follow closely the plt book.

Date Time Title Material
Tue 31/10 13-15 PL Design, Compilation Phases, calculator slides, plt 1, dragon 1, live coding
Thu 02/11 13-15 Grammars / BNFC / Hands-on with Lab 1 code slides, plt 2, dragon 2.8.2,4.1-4.3
Tue 07/11 13-15 Formal languages and parsing LL parser code
Thu 09/11 10-16 DATE-IT 2017 fair No class!
Mon 13/11 23 Lab 1 deadline lab1 PM
Tue 14/11 13-15 Theory of lexing, LR parsing slides, plt 3, dragon 3,4
Thu 16/11 13-15 Interpreting slides, plt 5
Tue 21/11 13-15 Type checking slides, plt 4, dragon 5,6
Thu 23/11 13-14 Hands-on with Lab 2 (Haskell) lab2 PM
Thu 23/11 14-15 Hands-on with Lab 2 (Java)
Mon 27/11 23 Lab 2 deadline
Tue 28/11 13-15 Code generation slides, plt 6, dragon 6,7
Thu 30/11 13-14 Hands-on with Lab 3 (Haskell) lab3 PM
Thu 30/11 14-15 Hands-on with Lab 3 (Java)
Tue 05/12 13-15 Functional programming languages slides, plt 7, dragon 6.5,7.3
Thu 07/12 13-15 Hands-on with Lab 4 lab4 PM
Mon 11/12 23 Lab 3 deadline
Tue 12/12 13-15 Type inference. A taste of dependent types Agda demo Verified compilation
Thu 14/12 13-15 Preparing for the exam Training Exam
Fri 05/01 23 Lab 4 deadline
Mon 08/01 8.30-12.30 Exam (building M) Exam
Tue 16/01 10.30-12.00 Exam review, EDIT 6128 Solution
Fri 19/01 23 Final lab deadline all lab returns
Thu 15/03 Lab resubmission intent deadline
Sun 25/03 Late final lab deadline
Thu 05/04 8.30-12.30 Exam (SB)
Thu 30/08 14-18 Exam (J)

The official course schema is in Time Edit.


The aim of the course is to give understanding of how programming languages are designed, documented, and implemented. The course covers the basic techniques and tools needed to write interpreters, and gives a summary introduction to compilation as well. Those who have passed the course should be able to

  1. define the lexical structure of programming languages by using regular expressions, explain the functioning of finite automata, and implement lexical analysers by using standard tools;
  2. define the syntax of programming languages by using context-free grammars, explain the principles of LL and LR parsing, and implement parsers by using standard tools;
  3. define and implement abstract syntax;
  4. master the technique of syntax-directed translation and its efficient implementation in their chosen programming language;
  5. formulate typing rules and implement type checkers;
  6. formulate operational semantic rules and implement interpreters;
  7. write simple code generators;
  8. be familiar with the basic implementation issues of both imperative and functional languages;
  9. master the principles of polymorphic type checking by unification;
  10. implement an interpreter for a functional language.


Andreas Abel, course teacher and examiner.

Andreas Lööw, Daniel Schoepe, Fabian Ruch, assistants.

Google Group

If you have any general questions regarding the course, the labs or the exercises, please ask them in our Google group. This will reach all teachers and fellow students. If you are not yet member of the group, you have to

You will have to give your real name and your person number (or date of birth) when you register, otherwise your membership is not approved. This is necessary to identify you as a participant of the course.

Laboration times and supervision

Lab supervision take place in ED3354.

Day Time Supervisors
Tue 15:15-17:00 AL DS
Thu 15:15-17:00 FR DS
Fri 13:15-15:00 FR AL

The lab rooms and supervision are available from Tue 31 October till Fri 15 December 2017.

Attendance in these classes is optional. Normally, each student should attend at most one supervised laboration time each week. Since attendance is not compulsory, there may be room for more times. But, if there is lack of room, those who attend their first supervision of the week have priority to get a place and supervisor help.


There will be four laborations, written individually or in pairs. You have to pass the labs to pass the course. However, the course grade is determined solely by the exam.

The labs are quite substantial, so please set aside at least 30 full working hours before the deadline.

Reporting is done via Fire. Before reporting, you must run your program through a test suite.

We guarantee two gradings per lab: one for the version submitted before the ordinary deadline for that lab, the other for a resubmission before the final deadline. If your first submission is after the lab deadline, only one grading is guaranteed.

If you did not pass the labs by the end of the course you will have another opportunity in connection with the re-exam in April. The deadline will be Thursday, 22 March 2018. If you intend to re-submit labs then, please contact the course responsible via email on 15 March at the latest. If you need help you should also contact the course responsible, not the teaching assistants. Note however that you can only expect limited support. If you need a substantial amount of help, it is probably better to wait until next time the course is given.


The main book will be one that developed from earlier editions of this course:

Aarne Ranta
Implementing Programming Languages. An Introduction to Compilers and Interpreters, College Publications, London, 2012. Web page (with extra material and links to selling sites)


If you are really interested in the topic, for instance, if you want to continue with the Compiler Construction course, you should also consider the Dragon book,

Aho, Lam, Sethi & Ullman
Compilers Principles, Techniques & Tools Second edition, Pearson/Addison Wesley 2007.

Both books are available at web bookshops. The main book will also be sold at Cremona.


Written exam, usual grading scales.

Exam dates: 08 Jan 2018 fm J, 05 Apr 2018 fm J, 30 Aug 2018 em J.

The exam has the same structure as these old exams (download as archive).

Further, here are some exercises and solutions to prepare for the exam.


BNF Converter 2.8.1, | Hackage | github

If using the Java backend, you will need the Cup and JLex libraries. You can download pre-compiled versions here. Make sure they are placed in your classpath, for example by extracting to ~/javatools/ adding the following to .bashrc:

    export CLASSPATH=.:~/javatools/:~/javatools/Cup/:${CLASSPATH}

On Debian-style Linux (like Ubuntu), the following now also works to install these libaries:

    sudo apt install jlex cup

Then the class path needs to be set as follows (bash):

    export CLASSPATH=.:/usr/share/java/JLex.jar:/usr/share/java/cup.jar

Student representatives

Student representatives for DAT151 Programming language technology.

Program Name
MPALG rahela Rahel Ahmed
MPALG rezaal Reza Alikhani Najafabadi
MPALG shruthi Shruthi Dinakaran
MPALG laro Lars Olsson
MPCSN subasha Akilandeshwari Subash