Compiler Construction
Core CoursePeople
Sebastian Hack, Fabian Ritter, Roland LeißaGeneral Information
The course treats compiler construction for imperative programming languages. This includes lexical, syntactical, and semantic analysis as well as static program analysis, optimization, and code generation. This course provides all necessary theoretical knowledge required to implement a compiler from scratch, which forms the practical part of the lecture.
Modus Operandi
There will be voluntary mini tests which will take place in the last 20 minutes within the tutorial. Additionally, there will be voluntary exercise sheets. To get a course certificate, students must pass the final exam and the project. Final grades will be based on the exam and the project.
Lecture
- Type: core lecture (9 credit points)
- Place: lecture hall I (HS 1), building E1 3
- Time: Tuesday 16–18 (c.t.) and Friday 14–16 (c.t.)
- First Meeting: Tuesday 2017-10-17, 16–18 (c.t.)
Tutorial
- Time: Friday 10–12 (c.t.)
- Place: (The tutorial assignment is available in the forum.)
- Tutorials A and B: SR015, building E1 3
Tutorial B: SR206, building E1 1
- First Tutorial: Friday 2017-10-27
Exams
- Exam: Tuesday 2018-02-20, 10–12 (s.t.), E2 5 - lecture room 2
- Re-exam: Monday 2018-03-19, 13–15 (s.t.), E1 3 - lecture room 2
Support
- We use a Forum as an official communication channel.
- We use a GitLab to manage the course project.
- We run nightly tests on your project to provide you with feedback about your progress.
Material
Slides
Date | Topic |
---|---|
2017-10-17 | Introduction (Code) |
2017-10-20 | Intro to Syntax Analysis, Lexing |
2017-10-24 | Grammars, Push-Down Automata |
2017-10-27 | LL Parsing |
2017-11-03, 2017-11-07 | LR Parsing |
2017-11-14 | Semantic Analysis |
2017-11-17 | Introduction to Program Analysis |
2017-11-21 | Constant Propagation, Soundness |
2017-11-24 | Superfluous Computations, Dead Code Elimination |
2017-12-01 | Interval Analysis, Widening |
2017-12-05 | Pentagons, Global Value Numbering |
2017-12-08 | SSA Introduction |
2017-12-12 | SSA Construction, Background reading |
2017-12-15 | Simple and Efficient SSA Construction, Background reading |
2017-12-19 | LLVM Introduction and IR Generation |
2018-01-05 | Introduction to Code Generation Graph-Coloring Register Allocation |
2018-01-09, 2018-01-12 | Register Allocation of SSA-form Programs |
2018-01-16 | Instruction Selection via PBQP |
2018-01-19 | Data Dependences |
2018-01-23 | Loop Transformations, Example Code |
2018-01-26 | Scheduling in the Polyhedral Model Sections 2, 3 |
Exercises
- Exercise sheet 1 (including project tasks A and B, updated with fixed indentation in example)
- Exercise sheet 2
- Exercise sheet 3 (including project task C)
- Exercise sheet 4
- Exercise sheet 5 (including project task D)
- Exercise sheet 6 (including project task E)
- Exercise sheet 7
- Exercise sheet 8 (including project task F)
- Exercise sheet 9
- Exercise sheet 10 (including project task G, updated with information about LLVM passes)
- Exercise sheet 11
Project Material
- The final draft of C1X, dated 12 April 2011
- A reference file for the pretty printer (part D)
- Examples for generating LLVM IR (part F)
Literature
The course is mainly built on these books:
- Helmut Seidl, Reinhard Wilhelm, Sebastian Hack. Compiler Design - Syntactic and Semantic Analysis, Springer 2013.
The German version is available online from the university IP address space. - Helmut Seidl, Reinhard Wilhelm, Sebastian Hack. Compiler Design - Analysis and Transformation, Springer 2012.
The German version is available online from the university IP address space.
The following books are among the "standard" compiler textbooks:
- Andrew Appel, Jens Palsberg. Modern Compiler Implementation in Java, Cambridge University Press 2002
- Keith Cooper, Linda Torczon. Engineering a Compiler, 2nd Edition, Morgan Kaufman 2011
- Bob Morgan. Building an Optimizing Compiler, Digital Press, 1998
- Alfred Aho, Monica Lam, Ravi Sethi, and Jeffrey Ullman. Compilers: Principles, Techniques, and Tools, 2nd Edition, Addison Wesley, 2006
The following textbooks are stanard references for loop transformations:
- Michael Wolfe. High-Performance Compilers for Parallel Computing
- Randy Allen, Ken Kennedy. Optimizing Compilers for Modern Architectures: A Dependence-based Approach
The following textbook provides a good introduction into the theory of polyhedra and linear programming:
- Dimitris Bertsimas, John N. Tsitsiklis. Introduction to Linear Optimization