Literature Lectures Lecture Links
Coursework Coursework Links Forum
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].
Somewhat preliminary, especially towards the end.
|1||3 Oct||Administrative Details and Introduction||[WB99, ch. 1–3; CT04, ch. 1]|
|2||4 Oct||A Complete (Albeit Small) Compiler||[WB99, ch. 1–3; CT04, ch. 1–3]|
|3||10 Oct||Defining Programming Languages||[WB99, ch. 1–4; CT04, ch. 1–3; Nil10a]|
|4||11 Oct||Syntactic Analysis: Bottom-Up Parsing||[WB99, ch. 4; CT04, ch. 3]|
|5||17 Oct||Syntactic Analysis: Parser Generators||[WB99, ch. 4; CT04, ch. 3]|
|6||18 Oct||Contextual Analysis: Scope I||[WB99, ch. 5; CT04, ch. 4, ch. 5.7]|
|7||24 Oct||Contextual Analysis: Scope II||[WB99, ch. 5; CT04, ch. 4, ch. 5.7]|
|8||25 Oct||A Versatile Design Pattern: Monads||[Hut09, Nil10b, Nil10c]|
|9||7 Nov||Contextual Analysis: Types and Type Systems I||[WB99, ch. 5; CT04, ch. 4]|
|10||8 Nov||Contextual Analysis: Types and Type Systems II||[WB99, ch. 5; CT04, ch. 4]|
|11–12||14 Nov||Contextual Analysis: Implementing A Type Checker||[WB99, ch. 5; CT04, ch. 4]|
|13||15 Nov||Code Generation I||[WB99, ch. 7 & 9; CT04, ch. 9.2, 13]|
|14||21 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||28 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||5 Dec||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||12 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]|
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 a PDF-copy of the report and an archive of the complete source code for your solution (electronically, using CW). Important! See detailed submission instructions in the coursework descriptions. 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.
The oral examination serve both to give you timely, personal feedback on your work, and to assess that you have understood what you have done through discussing and explaining your solutions. Note that the oral examination is compulsory: your written solutions will not be taken into account unless the examination has taken place and you have demonstrated a good understanding.
The coursework-related dates are as follows:
The schedules for the oral examinations, along with other practical information, is or will be available via the coursework support web page. Important! Catch-up slots will only be allocated if you missed your slot with good cause; you need to explain to your personal tutor and ask him/her to make a request to the G53CMP module convener on your behalf.
To support you, course staff will be at hand during the laboratory sessions from 7 October onwards.
There is also a G53CMP forum where you can ask questions about the coursework, or help answering questions! However, we do ask that you do not post direct solutions to coursework questions.
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 [NS13].
The coursework description, code, further information about practical aspects of the coursework, clarifications, tips, FAQ, etc. can be found on the coursework web page coursework web page.
Coursework support will be at hand during the laboratory sessions. Please direct further coursework-related questions to the G53CMP forum.
A Moodle Forum for G53CMP has been set up.
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 below. However! Note that the exam format changed the academic year 2013/14 in line with changing School policies and there will no longer be any optional questions. However, the style of questions will remain similar: