COMP36512 - Compilers
Model answers to recent exam papers are available. NB: occasional errors
and omissions may exist; you need to remember that they are supposed to
give a hint not full answers!
- 2019 exam model answers
- 2018 exam model answers
- 2017 exam model answers (NB: There is a mistake with the answer of Q5 b ii: there should be two extra cycles with NOP between cycle 4 and 5 as instruction 7 cannot start until instruction 2 terminates and instruction 2 has a latency of 3 cycles)
The recommended textbooks are:
Handouts given in lectures will provide pointers to the above. Other recommended books
(pointers to these books will be provided where possible):
"Compilers: Principles, Techniques, and Tools" (2nd edition)
by Aho, Lam, Sethi, and Ullman. This is a new edition of the highly successful
"Compilers: Principles, Techniques, and Tools"
by Alfred V. Aho, Ravi Sethi, Jeffrey D. Ullman. Widely known as the
"Dragon book", it has been a standard reference for two generations.
Engineering a compiler, by Cooper and Torczon. A good book,
follows quite closely the structure of this course.
(parts of it are available through google)
(the 1st edition will be used - pointers to the 2nd edition may be provided)
- Modern Compiler Design, by Grune et al. It has good coverage.
- The essence of compilers, by Hunter. Somewhat compact.
- Lectures: Friday 14:00-16:00
- Lecture 01 (Introduction): [powerpoint]
- Lecture 02 (General Structure of a Compiler): [powerpoint]
- Lecture 03 (Introduction to Lexical Analysis): [powerpoint]
- Lecture 04 (Lexical Analysis II: from REs to DFAs): [powerpoint]
see the example on the board and
the example on the board
- Lecture 05 (Lexical Analysis III): [powerpoint]
- Lecture 06 (Introduction to Parsing): [powerpoint],
- Lecture 07-08 - no lecture, do questions on your own!
- Lecture 09 (Top-Down Parsing): [powerpoint],
- Lecture 10 (Bottom-Up Parsing) [powerpoint],
(see also this for the question in slide 14)
(see also this for the handles in slide 4)
(see also this for the partial answer to the question in slide 14 on the board)
- Lecture 11 (Context Sensitive Analysis: Attribute Grammars)
- Lecture 12 (Intermediate Representations & Symbols Tables)
(see also this for the Control Flow Graph question)
- Lecture 13 (The Procedure Abstraction)
- Lecture 14 (Code Generation - Instruction Selection)
- Lecture 15 - no lecture, do questions on your own! [pdf]
- Lecture 16 - no lecture, do questions on your own and submit if you like! [pdf]
- Lecture 17 (Register Allocation)
- Lecture 18 (Register Allocation via Graph Colouring): [powerpoint],
- Lecture 19 (Instruction Scheduling): [powerpoint],
- Lecture 20 (Code Optimisation): [powerpoint],
- Lectures 21-22. The exam.
- Last year's Guest Lecture:
Resources on the web
Earlier versions of this webpage
(links may not work as a result of changes to the CS web site)
Exam Papers from recent years