Search programme

​Use the search function to search amongst programmes at Chalmers. The programme overview and the programme syllabus relating to your studies are generally from the academic year you began your studies.

​​​

Syllabus for

Academic year
TDA281 - Compiler construction
 
Owner: TDATA
4,0 Credits (ECTS 6)
Grading: TH - Five, Four, Three, Not passed
Level: A
Department: 37 - COMPUTER SCIENCE AND ENGINEERING


Teaching language: Swedish

Course module   Credit distribution   Examination dates
Sp1 Sp2 Sp3 Sp4 No Sp
0101 Examination 4,0 c Grading: TH   4,0 c   Contact examiner,  Contact examiner
0201 Laboratory 0,0 c Grading: UG   0,0 c    

In programs

TDATA COMPUTER SCIENCE AND ENGINEERING - Computer Languages, Year 4 (compulsory)
TDATA COMPUTER SCIENCE AND ENGINEERING - Interactive simulations and games, Year 4 (elective)
TDATA COMPUTER SCIENCE AND ENGINEERING - Algorithms, Year 4 (elective)
TDATA COMPUTER SCIENCE AND ENGINEERING - Embedded computer systems engineering, Year 4 (elective)
TTFYA ENGINEERING PHYSICS, Year 4 (elective)
TITEA SOFTWARE ENGINEERING, Year 3 (elective)
TITEA SOFTWARE ENGINEERING, Year 4 (elective)
TELTA ELECTRICAL ENGINEERING, Year 4 (elective)
DCMAS MSc PROGR IN DEPENDABLE COMPUTER SYSTEMS, Year 1 (elective)

Examiner:

Professor  Aarne Ranta



  Go to Course Homepage

Eligibility:

For single subject courses within Chalmers programmes the same eligibility requirements apply, as to the programme(s) that the course is part of.

Course specific prerequisites

General programming skills (C, Haskell, or Java). Data structures.
Formal languages and automata. The course Programming Languages.

Aim

The aim of the course is to teach the principles and theories that have been developed for compiling programming languages, as well as to give
practical experience of writing a small but complete compiler. These
principles are often so general that they can be applied to solve
problems on other fields as well.

Content

Compilation is normally divided to phases: lexical analysis, where the program text is divided to symbols; parsing, where an abstract tree representation of the program is built, in accordance wiht the grammar of the language; type checking, where the context-dependent rules of the grammar are controlled; and code generation, where machine code is built.

For lexical analysis and parsing, program generators are often used, based on regular expressions and LR grammars. The course gives an overview of these methods, with the aim to learn how to use and understand the tools. For type checking and code generation, the course uses syntax directed translation and pattern matching over syntax trees; for these parts of the compiler, no generally used tools can yet be found. What also belongs to code generation are techniques of code analysis, register allocation, and optimization. Moreover, one needs runtime organization of data, parameter passing, block structures, recursion, memory allocation.

Organisation

The teaching consists of lectures, exercises, and laborations, as well as some supervision in connection to the laborations. The central part is a laboration, where a compiler is constructed for a small imperative programming language, by using program generators for lexical analysis and parsing, and some technique of choice to implement type checking and code generation for a stack machine (JVM) and/or a virtual register machine. The latter works as intermediate code, from which the participants can, according to their interests, continue to real assembly code (Intel, Sparc, etc). The lectures provide knowledge that is needed in the laboration, as well as an overview of the theoretical foundations and possible extensions of the compiler.

Literature

Last time the course used Andrew S. Appel: Modern Compiler Implementation in ML, Cambridge University Press, 1999 (versions available for implementation in C and Java).

Updated information on literature will be given before the course starts, on the course home page.

Examination

Written laboration and oral exam. Grading scale: U, 3, 4, 5.


Page manager Published: Thu 03 Nov 2022.