Programming Language Technology

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

http://www.cse.chalmers.se/edu/course/DAT151/

Google group: http://groups.google.com/group/plt-2018 (please provide your full name and date of birth when requesting membership!)

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

News and changes

2019-01-26
Exam review will be Fri 1 February 10am in EDIT 6128. Exam text and solution.
2018-12-18
Live coding in Agda start and finish on verified compilation.

2018-12-16
Lab 4 stubs for Haskell and Java are now available.

2018-12-09
Lab 4 is online.

2018-12-05
Guest lecture by Thorsten Berger on domain-specific languages tomorrow, 2018-12-06! He will present a software-engineering perspective on PLT. (Schedule updated.) 2018-12-10: Slides available

2018-12-04
Lab 3 is online.

2018-11-27
The code from today's "Hands-on for lab 2" session has been posted in the plt-2018 group.
2018-11-20
Lab 2 is online.
2018-11-07
Ad: Apply for undergraduate teaching assistent LP3/4! Deadline is 2018-11-30.

2018-11-07
Clarified lab submission and grading.

2018-11-06
Result of live coding in lecture (not the best solution!). Contains a documented Makefile, explaining the basic rule format of make files and their execution.

2018-11-05
First version of this page - mostly a copy of the 2017 material. Updates forthcoming soon.

Tentative Schedule

Tuesday lectures are in HC2, Thursday lectures in HA1, starting at 13:15.

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

Date Time Title Material
Tue 06/11 13-15 PL Design, Compilation Phases, calculator slides, plt 1, dragon 1, live coding
Thu 08/11 13-15 Grammars / BNFC / Hands-on with Lab 1 slides, plt 2, dragon 2.8.2,4.1-4.3
Tue 13/11 13-15 Formal languages and parsing
Thu 15/11 13-15 Theory of lexing slides, plt 3, dragon 3,4
Mon 19/11 23 Lab 1 deadline lab1 PM
Tue 20/11 13-15 Interpreting slides, plt 5
Thu 22/11 13-15 Type checking slides, plt 4, dragon 5,6
Tue 27/11 13-14 Hands-on with Lab 2 (Haskell) lab2 PM
Tue 27/11 14-15 Hands-on with Lab 2 (Java)
Thu 29/11 13-15 Code generation slides, plt 6, dragon 6,7
Mon 03/12 23 Lab 2 deadline
Tue 04/12 13-14 Hands-on with Lab 3 (Haskell) lab3 PM
Tue 04/12 14-15 Hands-on with Lab 3 (Java)
Thu 06/12 13-15 Domain-specific languages Guest lecture by Thorsten Berger
Tue 11/12 13-15 Functional programming languages slides, plt 7, dragon 6.5,7.3
Thu 13/12 13-15 Hands-on with Lab 4 lab4 PM
Mon 17/12 23 Lab 3 deadline
Tue 18/12 13-15 Dependent types (Agda) Live coding start and finish
Thu 20/12 13-15 Preparing for the exam Training Exam
2018
Thu 10/01 23 Lab 4 deadline
Mon 14/01 8.30-12.30 Exam (J) Exam
Thu 24/01 23 Final lab deadline all lab returns
Fri 01/02 10-11 Exam review, EDIT 6128 Solution
Thu 25/04 8.30-12.30 Exam (J)
Thu 29/08 14-18 Exam (J)

The official course schema is in Time Edit.

Description

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.

Teachers

Andreas Abel, responsible course teacher and examiner.

Andreas Lööw, Daniel Schoepe, Fabian Ruch, Iulia Bastys, 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. Please also indicate whether you are GU or Chalmers student.

Laboration times and supervision

Lab supervision take place in ED3354.

Day Time Supervisors (tentative)
Tue 15:15-17:00 AL FR
Thu 15:15-17:00 DS IB
Fri 13:15-15:00 AL FR

The lab rooms and supervision are available from Thu 08 November till Fri 21 December 2018.

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.

Laborations

There will be four laborations, written in pairs. (Individual solutions are accepted per exception, please contact the course responsible.) 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 (4 full working days) before the deadline.

Reporting is done via Fire. Before submitting your solution, run your program through the provided test suite. Also, make sure that your submission contains all necessary files and the build succeeds. For instance, if you are submitting an archive, unpack the archive in a fresh directory and check the build there.

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 does not build or does not pass the testsuite, you will just get fails testsuite as grading.

Note: You have to submit something by the first deadline, otherwise Fire will not allow a (re)submission for the final deadline. (In the worst case, if you absolutely did not manage to work on the lab before the first deadline, submit an empty solution.)

As part of the grading, you may be asked to explain your solution in person to a course teacher. Be prepared to get a call for such an explanation meeting. In particular, make sure you understand all parts of the solution (good documentation helps!).

Exam

The written exam determines the course grade, the usual grading scales apply: Chalmers: 5, 4, 3, U; Gothenburg University: VG, G, U.

Exam dates: 14 Jan 2019 fm J, 25 Apr 2019 fm J, 29 Aug 2019 em J.

The exam tests the understanding of the course contents from a more high-level view, e.g., the underlying theoretical concepts. 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.

Literature

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)

Errata

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.

Software

BNF Converter 2.8 http://bnfc.digitalgrammars.com/ | Hackage | github

You can compile the latest version of BNFC (2.8.2) from its Haskell sources via

    cabal update
    cabal install BNFC

You might find a suitable binary distribution for an older version of BNFC (2.8).

If using the Java backend, you will need the CUP and JLex libraries. CUP has seen incompatible changes in its interface; thus, the version you need may depend on your BNFC version.

Instructions for BNFC 2.8.2 (uses CUP v0.11b)

Download the JAVA archives for CUP v11b, CUP v11b runtime, and JLex, contained in javatools. Make sure they are placed in your classpath, for example (Linux / MAC OS) by storing these jars in $HOME/java-lib/ and adding the following to .bashrc (single line):

    export CLASSPATH=.:${HOME}/java-lib/java-cup-11b.jar:${HOME}/java-lib/java-cup-11b-runtime.jar:${HOME}/java-lib/javatools.jar:${CLASSPATH}

The order matters since javatools.jar also contains an older version of CUP; make sure that javatools.jar comes last in the search path.

Instructions for BNFC <= 2.8.1 (uses CUP v0.10k)

You can download pre-compiled versions here. Make sure they are placed in your classpath, for example (Linux / MAC OS) 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 @student.chalmers.se Name
MPALG carjohne Carl Johnell
MPCSN chibin Chibin Kou
MPALG odind Daniel Odin
UTBYTE afonsor Afonso Raposo Pereira

(MORE TO FOLLOW)