Model answers for the exam now on-line!
Overview
Literature
Lectures
Lecture Links
Coursework
Coursework Links
Forum
Examination
References
There is no main reference for the module, but you will likely find it useful to have a book to give you an additional perspective on and more depth to the material covered, as well as a help to understand some of the harder topics. Some suggestions below.
![]() |
The book Programming Language Processors in Java [WB99] by Watt & Brown used to be the main reference for the precursor of this module (G52CMP). Because we now have switched to Haskell-based coursework, this book is less relevant than it was. However, the lectures largely still follow the structure of Watt & Brown, and the coursework is partly based on the compiler it presents. Also, where appropriate, the suggested reading for each lecture will include references to this book. The main advantages of Watt & Brown is its hands-on approach to compiler construction, with a particular emphasis on software engineering aspects, and that it is clearly written. It is also a good book if you like Java and would like to get an understanding of how a compiler might be structured in an object-oriented language. Watt & Brown is a bit weak on linking the theory with practice, though. The lectures will aim at filling in some of the gaps. There are several errors in the book. Consult the authors' web pages for corrections. |
![]() |
The book Compilers: Principles, Techniques, and Tools [ASU86] ("The Dragon book") by Aho, Sethi, & Ullman is a classic in the field, well worth having as a reference book. It covers much more ground in much greater depth than does this module, but it is a great supplement to Watt & Brown and will last you many years. There is a new (2007) edition of this book, by Aho, Lam, Sethi, and Ullman (Pearson International Edition) [ALSU07]. I have not had a chance to look at it in detail, but it looks a bit more accessible, and it has been updated in many respects. Would likely work well with this module and worth checking out. Sadly, the cover no longer features the Dragon! |
![]() |
The book Engineering a Compiler [CT04] by Cooper & Torczon is more recent and consequently in many ways more up-to-date than the Dragon Book. It also covers much more ground in more depth than does this module, but is probably a bit more accessible and a bit lighter on theory than the Dragon Book. Together with the on-line lecture notes for this module, it is a viable alternative to both Watt & Brown and the Dragon Book, and I am increasingly relying upon it. It will probably end up being the closest there is to a main reference book, and I will try to provide references to it for most of the lectures. |
![]() |
The lectures on types and type systems closely follow the first few chapters of the book Types and Programming Languages [Pie02] by Pierece. This is a very good book for those who would like to learn more about types and type systems in the context of programming languages. |
![]() |
If you need to brush up on your Haskell knowledge, I recommend Programming in Haskell [Hut07], by our own Dr. Hutton. The library should have plenty of copies, and so should the local bookshop. |
![]() |
Another great introduction to Haskell (which is also highly entertaining) is Miran Lipovača's Learn You a Haskell for Great Good [Lip11]. Can be bought or read on-line for free! |
Should you need more Haskell introductory material, you can also check out:
You may also find it helpful to revise Dr. Altenkirch's and my G52MAL lecture notes on formal languages, regular expressions, context-free grammars, various kinds of automata, and parsing [AN07].
Wondering how to debug your Haskell programs? Well, there are a number of options. On possibility, while it has certain drawbacks, is the traditional, procedural debugger integrated in GHCi 6.8.1 or later. You can read more about it in Bernie Pope's article in issue 10 of the Monad.Reader [POP08].
| Lecture# | Date | Content | Reading |
|---|---|---|---|
| 1 | 4 Oct | Administrative Details and Introduction | [WB99, ch. 1–3; CT04, ch. 1] |
| 2 | 5 Oct | A Complete (Albeit Small) Compiler | [WB99, ch. 1–3; CT04, ch. 1–3] |
| 3 | 11 Oct | Defining Programming Languages | [WB99, ch. 1–4; CT04, ch. 1–3; Nil10a] |
| 4 | 12 Oct | Syntactic Analysis: Bottom-Up Parsing | [WB99, ch. 4; CT04, ch. 3] |
| 5 | 18 Oct | Syntactic Analysis: Parser Generators | [WB99, ch. 4; CT04, ch. 3] |
| 6 | 19 Oct | Contextual Analysis: Scope I | [WB99, ch. 5; CT04, ch. 4, ch. 5.7] |
| 7 | 25 Oct | Contextual Analysis: Scope II | [WB99, ch. 5; CT04, ch. 4, ch. 5.7] |
| 8 | 26 Oct | A Versatile Design Pattern: Monads | [Hut09, Nil10b, Nil10c] |
| 9 | 1 Nov | Contextual Analysis: Types and Type Systems I | [WB99, ch. 5; CT04, ch. 4] |
| 10 | 2 Nov | Contextual Analysis: Types and Type Systems II | [WB99, ch. 5; CT04, ch. 4] |
| 11 | 8 Nov | Contextual Analysis: Implementing A Type Checker | [WB99, ch. 5; CT04, ch. 4] |
| 12 | 9 Nov | Contextual Analysis: Implementing A Type Checker (cont.) | [WB99, ch. 5; CT04, ch. 4] |
| 13 | 15 Nov | Code Generation I | [WB99, ch. 7 & 9; CT04, ch. 9.2, 13] |
| 14 | 16 Nov | Code Generation II | [WB99, ch. 7 & 9; CT04, ch. 9.2, 13] |
| 15 | 22 Nov | Code Generation II (cont.) | [WB99, ch. 7 & 9; CT04, ch. 9.2, 13] |
| 16 | 23 Nov | Run-Time Organisation I | [WB99, ch. 6; CT04, ch. 6, 7.1–7.7, 7.9] |
| 17 | 29 Nov | Run Time Organisation II | [WB99, ch. 6; CT04, ch. 6, 7.1–7.7, 7.9] |
| 18 | 30 Nov | Register Allocation | [WB99, ch. 7 & 9; CT04, ch. 7.8, 7.9] |
| 19 | 6 Dec | Register Allocation (cont.) | [WB99, ch. 7 & 9; CT04, ch. 7.8, 7.9] |
| 20 | 7 Dec | Code Optimization | [WB99, ch. 9; CT04, ch. 8, ch. 10] |
| 21 | 13 Dec | Code Optimization (cont.) | [WB99, ch. 9; CT04, ch. 8, ch. 10] |
| 22 | 14 Dec | No lecture! |
Copies of electronic slides, any major pieces of program code, other electronic material used during the lectures, and useful links can be found here.
The coursework counts for 25 % of the total mark (unless you have to resit the module, in which case it does not count). It consists of solving some theoretical and practical programming problems, mainly in the context of a simple compiler for the language MiniTriangle from Watt & Brown. The exact details will be available shortly through the coursework links below. It is to be carried out individually. You are welcome to discuss the coursework with friends, but, in the end, you must solve the problems on your own and your solutions will be assessed individually, in part orally in person.
The coursework is divided into two parts, I & II. A short written report has to be submitted for each part (hard copy to the school office) along with an archive of the complete source code for your solution (electronically, using CW). You will then discuss your solution with one of the TAs in a small oral examination in an assigned slot during one of the lab sessions in the two weeks that follow the deadline. Your solution will be assessed during this examination and you will also receive feedback. Note that the oral examination is compulsory: your solutions will not be taken into account unless the examination has taken place in a satisfactorily manner.
The coursework-related dates are as follows:
The schedules for the oral examinations, along with practical details and information about what to do if you you miss your assigned examination slot, is or will be available via the coursework support web page.
To support you, course staff will be at hand during the laboratory sessions from 11 October onwards.
There is also a mailing list g53cmp-faq@cs.nott.ac.uk
which can be used to ask questions. (Questions and answers of general interest
might form the basis for a forum post or additions to the FAQ.)
Finally, should you feel that your Haskell knowledge could do with a brush-up, we do recommend the various Haskell resources mentioned in the section on literature above, and trying your hand on the (unassessed) Haskell and GHC revision coursework from G52MAL available here [NS11].
The coursework description, code, further information about practical aspects of the coursework, clarifications, tips, FAQ, etc. can be found on the coursework web page.
Please direct questions regarding the coursework to the mailing list g52cmp-faq@cs.nott.ac.uk.
THE MOODLE FORUM IS NOT YET ACTIVE
However, the old (non Moodle) forum from last year is still available, read only, and does contain potentially useful information
The forum is intended for asking questions about and discussing aspects of G53CMP, like the coursework. It is monitored by the G53CMP team, and we'll endeavour to answer any outstanding questions reasonably quickly. However, any one is free to contribute to the discussions and help with answering questions. Indeed, in the spirit of an on-line forum, you are encouraged to do so!
Of course, we do ask that you do not post the exact solutions to the coursework! The point of the coursework is that you should ultimately solve the problems yourselves so that you know what you have understood and what you need to work more on or ask about.
Some basic information about the exam. For the first sit:
In the case of a resit examination:
Past examination papers can be found by logging in to the Portal and then using the Library Tab to search for Exam Papers. Or follow this link first.
Model answers to some past exams can be found here: