Course syllabus
Latest news
1 Jul: Time slots for the oral exam should now be final. The results of the doodle can be found on the Exam subpage.
24 May: We've graded a number of part C submissions now, congratulations to everyone who's completed the project. Like the previous parts, there is now a resubmission window set on Fire. Please note, this time there are 6 days available rather than 7, since we need to complete marking the projects before we begin the oral exams. We have now begun scheduling exams. Each available time slot is first-come first served, so pick your preferred time early. More details are on the Exam subpage.
8 May: OK, we've finished the last of the regular lectures. The recordings are available here if you missed something. There's still more to do. We'll be available to communciate with you if you have questions or difficulties with Part C. Send an email, and we can also organise short video meetings for consultations, particularly on the open-ended components of Part C. There will be more updates here as the Part C deadline approaches. Finally, we'll have to schedule video meetings to do the final exam during the week of June 1-5. So, catch you when we catch you in the second phase of the course.
28 Apr: Zoom seems to be fine for the last lecture, we'll continue with it for now. The Part B deadline is coming up, hopefully you're making good progress with it.
3 Apr: We had some issues with everyone joining the online lecture today. My laptop is just recoding the video now, and the recorded video will be available soon. At least one person was able to work around it by joining from a phone client rather than a web client. Obviously this isn't good enough. Apparently it might be a known issue, and might get fixed. We may have to investigate other possible platforms. We have a bit of a break until the next lecture on April 17, and we'll update you before then if we need to make changes.
1 Apr: Another update about submission deadlines: there will be a resubmission window. We've decided to adjust the rules to be more similar to last year. Sorry that I said otherwise during a lecture. After the initial deadline for part A (soon) there will be an additional week in which you can re-submit to improve your submission. However, you must submit before the original deadline to be able to re-submit. So, if you want to pass this course this session, you must submit something by the end of tomorrow Apr 2.
27 Mar: Update about the assignment deadlines. These are now printed on this syllabus page. Two of the deadlines in the PDF for lecture 1 were incorrect (e.g. gave the date of the first Thursday in April last year) and are corrected below. The Part A deadline is Thursday April the 2nd.
The video of lecture 2 is up, and discussion notes from the Q-and-A section are added to the discussions page.
17 Mar: Response to the coronavirus situation.
- Chalmers is taking "social distancing" seriously and avoiding group meetings.
- Follow updates from Chalmers here https://chalmers.se/info/
- This course (and most others in LP4) will change so that attendance is online and not in-person.
- Lectures will be video-streamed.
- The current plan is to use the "zoom" video meeting software.
- Students should try installing and testing zoom.
- Assignments will be submitted via Fire as in previous years.
13 Mar: this canvas page goes live.
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 in the Fire system, 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. Deadlines are strict; extensions will only be granted under exceptional circumstances, and even then only if requested before the deadline in question has passed.
- 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.
Exam
More details about the exam are on the Exam subpage here.
Assignment Submission
All assignments will be submitted via Fire (link here). The submission will be a single gzipped tar file, and the format required is described in detail in the documentation of the tester. The tester includes a docker image that can be used to check your submission will compile and run in our test environment.
Part A: due Thursday 2 April at midnight
Part B: due Thursday 7 May at midnight
Part C: due Monday 25 May at midnight
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 Fire webpage is where assignments will be submitted.
- The discussion forum is a place to discuss topics related to the course.
- The TimeEdit schedule of the lectures.
- The website of the 2019 iteration of TDA283 is also online.
Lectures online at 13:15-15:00
Lectures will be delivered via the internet, see links on this subpage.
24 March: Introduction, project overview: lect01.pdf, previous slides
27 March: Software engineering for compilers: lect02.pdf, previous slides
31 March: LLVM: tools, language: lect03.pdf, previous slides
3 April: Code generation for LLVM: lect04.pdf, previous slides
17 April: Project extensions: arrays, dynamic structures, objects: lect05.pdf, previous slides
28 April: Code generation for x86: lect06.pdf, previous slides
5 May: Control flow graphs, data analysis: lect07.pdf, previous slides
8 May: Functions: lect08.pdf, previous slides
26 May: Guest lecture on verified compilers: 2020-tda283-verified-compilers.pdf, previous slides
Teachers
Main lecturer for the course: Thomas Sewell sewell@chalmers.se EDIT 5115
Examiner for the course: Magnus Myreen myreen@chalmers.se EDIT 5452
Teaching assistant: Oskar Abrahamsson aboskar@chalmers.se EDIT 5453
Course evaluation
The student representatives for this course are to be decided.
Learning objectives and syllabus
The official course syllabus documents: Chalmers and GU.
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
To pass the course and get grade 3 (Chalmers) or G (GU), you need to:
- submit working solutions in all submissions,
- implement at least one language extension in submission C, and
- pass the oral exam.
For higher grades, you need to implement optional extensions in submission C:
- for grade 4 (Chalmers), you need to earn 3 credits in submission C;
- for grade 5 (Chalmers) or VG (GU), you need to earn 5 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 (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. 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 (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.
- For Java programmers: JLex and CUP.
- For Haskell programmers: Alex and Happy.
Common interface to all the above: BNF Converter. 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 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. Unpack the archive in some suitable directory and follow these instructions.
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. The syntax of the base language is specified by the BNFC source file Javalette.cf. 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. In particular, you will need to consult the LLVM Language Reference Manual and the LLVM Command Guide. The LLVM tools are available on the Studat Linux machines. The input/output routines are implemented in runtime.ll.
x86 assembly language. Two books are available for free download: Paul Carter: PC Assembly tutorial and Jonathan Bartlett: Programming from the ground up. The input/output routines are implemented for 64-but x86 in runtime.s.
Course summary:
Date | Details | Due |
---|---|---|