Programming Languages / Programming Language Technology

Aarne Ranta
Spring Term 2011

This is the old course page! The page for 2012 is here.

Course codes: Chalmers BSc TIN321, MSc DAT150; GU BSc DIT229, MSc DIT230

Course name: BSc Programming Languages, MSc Programming Language Technology

Official URL:

Google group:


24/2 A set of old exams and solutions.

11/2 Precompiled Java tools (Cup and JLex). Download, uncompress in your home directory, and export class path: export CLASSPATH=.:~/javatools:~/javatools/Cup

7/2 Link to Fire on this page.

1/2 Reverted to the old version of lab1 test suite because of conflicts with the lab PM.

28/1 Extended lab1 test suite; added solutions to exercise 1.

24/1 Fixed link to BNFC tutorial.

18/1 Added exam date and lab supervisor names

14/1 Changed dates and locations in the Schedule. Created Google group.

10/1/2011 First version of this page - so far just a copy of the 2010 material. Updates forthcoming soon.

Lecture and Exercise Schedule (2011, preliminary)

Date Time Place Event material
Tue 18/1 13-15 HC4 Introduction lecture 1
Fri 21/1 10-12 HC4 Abstract and concrete syntax, Lab 1 overview (Ramona Enache) lecture 2 PM
Tue 25/1 13-15 HC4 The BNF converter lecture 3
Wed 26/1 15-17 ML2,3,4 Exercises 1 exercises solutions
Fri 28/1 10-12 HC4 Implementing lexers and parsers lecture 4
Tue 1/2 13-15 HC4 Theory of lexing and parsing lecture 5
Wed 2/2 15-17 ML2,3,4 Exercises 2 exercises solutions
Fri 4/2 10-12 HC4 Syntax-directed translation lecture 6
Mon 7/2 23 - LAB 1 deadline PM test suite
Fri 11/2 10-12 HC4 Type checking, Lab 2 overview lecture 7
Tue 15/2 13-15 HC4 Interpreters, Lab 3 overview lecture 8
Wed 16/2 15-17 ML2,3,4 Exercises 3 exercises solutions
Fri 18/2 10-12 HC4 Code generation lecture 9
Tue 22/2 13-15 HC4 Functional programming languages lecture 10
Wed 23/2 15-17 ML2,3,4 Exercises 4 exercises solutions
Thu 24/2 23 - LAB 2 deadline PM test suite
Fri 25/2 10-12 HC4 MSc lecture: Lab 4 overview lecture 11 PM
Tue 1/3 13-15 HC4 Programming language design and development lecture 12
Wed 2/3 15-17 ML2,3,4 Exercises 5 exercises solutions
Fri 4/3 10-12 HC4 Advice for exam and further studies on programming languages Training Exam
Mon 7/3 23 - LAB 3 deadline PM
Fri 11/3 23 - LAB 4 deadline PM
Wed 16/3 12 - all labs final deadline -
Thu 17/3 14-18 Hörsalsv. 5 Exam -

Official course schema 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. design and implement special-purpose programming languages.

Those who take this course as obligatory MSc level course Programming Language Technology, will also have extra material:

  1. master the principles of polymorphic type systems
  2. implement polymorphic type checking by using unification
  3. implement an interpreter for a functional language


Aarne Ranta, course responsible.

Krasimir Angelov, Arnar Birgisson, Ramona Enache, Grégoire Détrez, assistants.

The fastest way to get an answer is to mail the course's Google group

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 can do both on the group page. You will have to give your real name and your person number 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

Location: 3507a,b


Extra supervisor at some of the times, especially before lab deadlines. The labs rooms and supervision are available from the second week of the course (Monday 24 January).

Normally, each student should attend 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.


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

Make sure to get the second edition! The book is available at web bookshops and will be sold at Cremona.

More on functional languages, and some help for Lab 4, is given in these slides by Xavier Leroy.


There will be three laborations, written individually or (preferably) in pairs.

On the MSc level, there will be a fourth lab,

Each lab PM will be published before the previous lab has its deadline.

Reporting is done via Fire. Before reporting, you must run your program through a test suite, such as the one for lab 1.

Final deadline is Wednesday 16 March for all returned and corrected labs. No labs will be graded after this deadline.


There are three classes on Wednesday at 15-17:

Exercises give bonus points for the exam: 0.4 points per exercise, the sum rounded to the nearest integer. To claim bonus points, mark the ones you have done in a list in the beginning of the class. Marking an exercise means that you are prepared to present its solution on the blackboard.

To make sure that all your bonus points are counted, you should always go to the same teacher's class.


Written exam, usual grading scales.

Date: 17 March

Time: 14.00-18.00

Place: Hörsalsvägen 5

The exam has the same structure as these old exams.


BNF Converter,

Precompiled Java tools (Cup and JLex)