TDT4205 Compiler Construction (Spring 2020)


Weekday Time Location Type
Fri 12:15-13:00 Blackboard Collaborate Online Q&A session

Lectures have been moved online as of March 13th, 2020, due to NTNU-wide Corona virus precautions!

We will continue in flipped classroom style with lecture videos on youtube and an online Q&A session in the Friday lecture slot on Blackboard Collaborate as long as required.

Weekday Time Location Type
Tue 14:15-15:00 Geologi G1 Lecture
Tue 15:15-16:45 Realfagbygget R8 Recitation
Fri 12:15-14:00 Sentralbygg 1 S4 Lecture

Lecture videos

youtube TDT4205 channel

Lecture plan and slides

Week Date Topic PDF Video
207.01.2020 Motivation and History compilers01.pdf
07.01.2020 C "crash course" (moved to week 3) c-course.pdf
10.01.2020Compiler structure, automata and scanning compilers02.pdf
314.01.2020 Scanner Generators (slide 8 updated) compilers03.pdf
14.01.2020 C "crash course" (updated: added literature list) c-course.pdf
17.01.2020 Lexical analysis in the real world (updated: typos in subset construction example fixed) compilers04.pdf
421.01.2020 Introduction to parsing (updated: fixed typos slides 22/24) compilers05.pdf
24.01.2020 Top-down parsing and LL(1) parser construction (update: "a" was missing on slide 10) compilers06.pdf
528.01.2020 Bottom-up parsing (update: typos fixed) compilers07.pdf
31.01.2020 LR(k) parsers compilers08.pdf
LR parsing animated pdf file
604.02.2020 Practical parsing issues and yacc introduction (update: typos fixed) compilers09.pdf
07.02.2020 No lecture (attend Catch IDI instead!)
711.02.2020 Context-sensitive analysis compilers10.pdf
Context-sensitive analysis: yacc examples tar file
14.02.2020 Type analysis and attribute grammars compilers11.pdf
818.02.2020 Intermediate representations and three-address code (update: typos) compilers12.pdf
21.02.2020 Intermediate representations and Static Single Assignment compilers13.pdf
925.02.2020 The procedure abstraction compilers14.pdf
28.02.2020 x86-64 and real world procedures compilers15.pdf
1003.03.2020 Introduction to optimizations compilers16.pdf
06.03.2020 Optimizations in detail: control-flow graphs compilers17.pdf
1110.03.2020 Data-flow analysis framework compilers18.pdf
12online Data-flow analyses compilers19-1.pdf19-1
online Liveness analysis compilers19-2.pdf 19-2
13online Reaching definitions analysis compilers19-3.pdf 19-3
online Available expressions analysis compilers19-4.pdf 19-4
14online Very busy expressions analysis compilers19-5.pdf 19-5
15 🐰 Easter break – påskeferie 🐣
16online SSA generation and optimization compilers20.pdf 20
17online Code generation compilers21.pdf 21
online Register allocation compilers22.pdf 22

Assignments and code templates

Week Publication date Handin date Topic PDF Code
4 20.01.2020 03.02.2020 Hands-on with scanner generators compilers-p1.pdf compilers-p1.tar.gz
Test cases: compilers-p1-1_4c.tar
6 04.02.2020 17.02.2020
Parsing and VSL specification compilers-p2.pdf code skeleton
9 25.02.2020 09.03.2020 Syntax tree simplification compilers-p3.pdf code skeleton
11 10.03.2020 23.03.2020 Symbol table construction compilers-p4.pdf code skeleton
14 01.04.2020 20.04.2020 Code generation compilers-p5.pdf code skeleton


AuthorsKeith Cooper and Linda Torczon
TitleEngineering a Compiler, Second Edition
ISBN9780120884780 (hardcover) / 9780080916613 (ebook)