I'm teaching the ‘compilers’ course in April–May 2008 with my colleague Rob. I take the first four weeks, then Rob takes over. (In fact lecturers are a hive mind, like in the Midwich Cuckoos, so anything you say to me, Rob knows by telepathy, and vice-versa.)

The assignment

I need you to e-mail me a pdf, and also put a paper copy in the coursework box in the crush area near EM1.24. I will mark from pdf. Send me one single file with all information I need to give you full marks; don't forget the test data.

The deadline is the morning of Monday 2 June.

Your mission is here. Test data is here. Got a question? Ask me on the message board.

The exam

I've written it. Any student who does all the papers I set last year, and the two exercise sheets, should pass with flying colours.

I'll spell that out. Have you done every single one of the exercises I set you this year, or set your colleagues last year? Yes, even the questions you found difficult and didn't finish; they're the ones most likely to turn up in exams, you know. What? You didn't finish them? Bet you they turn up in the exam.

The book

The recommended text is J. P. Bennett's Introduction to Compiling Techniques.

The times

Tuesday, 13:15, EM336.
Thursday, 12:15, EM244.
Friday, 12:15, EM244.

You may find this useful ...

CutePDF is a free PDF converter; it installs itself as a printer, which you just select to print to from within any program running under Windows, to produce a .pdf file.

Module descriptor, past papers

Here is the module descriptor, and here are past papers.

Slides

If you spot typos contact me.
Lectures 1 and 2, Tuesday 17 April.
(Introduction; Languages and grammars)
Lecture 1 [ps] [pdf]
Lecture 2 [ps] [pdf]
A video of the first two lectures online.
Lectures 1 and 2 [video]
Lecture 3, Friday 18 April.
(Left recursion, bad grammars, grammar transformation)
Lecture 3 [ps] [pdf] [video]
When I started the course I offered a prize of a box of pralines for the most outlandish excuse for not doing work; if I must listen to a 20 year old who's failing and in denial, then I might as well be entertained.
It didn't work out that way. The dedicated students worked, and the apathetic students ... just didn't, and they couldn't even muster a good excuse.
However, there was a spark of light — it was not, I think, a praline-winning spark of light, but it was a glimmer worthy of honourable mention.
Sorry I didn't do any work, and I can't do any work in the future until I've finished compiling my Linux kernel.
Pretty good. When he said it I choked down the reply “I can compile a Linux kernel in half an hour! For goodness' sake be a proper geek!”. Ah, the frustrations of teaching.
Lecture 4, Tuesday 22 April.
(Lexing and regexps)
Lecture 4 [ps] [pdf] [video]
One of you came up with the following regexp, just for fun:
(upop){1}ujust[^.]
Get it? Another student understood before I did: Pringles! “Once you pop, you just can't stop.” Brilliant. He wins a box of pralines.
Lecture 5, Thursday 24 April.
(Symbol table management I)
Lecture 5 [ps] [pdf] [video]
Pay attention. This is where last year's lot started getting confused and, some time later, getting B grades instead of the A grades that they were all capable of, had they concentrated.
Lectures 6 and 7, Friday 25 April.
(Symbol table management II, Table-driven Parsing)
(The wikipedia page on hash tables is excellent.) Somebody got really confused about why ε (the empty list) is not a terminal or non-terminal. This is perfectly honourable of him; it just goes to show how clever the people who invented the zero really were.
Lecture 6 [ps] [pdf]
Lecture 7 [ps] [pdf]
[video]
Lecture 8, Thursday 1 May.
(YACC)
If you're using linux don't forget that you need automake, gcc, and libc6 installed. You can find lots of programs online here.
(This page is quite fun, in an IBM kind of way.)
Lecture 8 [ps] [pdf] [video]
Lecture 9, Friday 2 May.
(Recursive descent parsing)
I found this page; it might you another angle on the material.
Lecture 9 [ps] [pdf]

Forum

A message forum is available. I'll make announcements on it when necessary, set exercises — and answer your questions on it in the unlikely event that you don't understand something first time.

Programs

Example LEX programs are here.

Exercise sheets

Exercise sheet 1.
Exercise sheet 2. You'll want to look at these programs.