Computer Laboratory Home Page Search A-Z Directory Help
University of Cambridge Home Computer Laboratory
Compiler Construction
Computer Laboratory > Course material 2003-04 > Compiler Construction

Compiler Construction

Principal lecturer: Dr Alan Mycroft
Taken by: Part IB, Part II (General), Diploma

Past exam questions
Here are various items for the 2003/04 version of this course:
  • Course Notes (PDF) (or as PostScript), also Dr Norman's additional notes (PDF) (or as PostScript).
  • Lambda interpreter in ML.
    Instructions: read the file! You can run the examples by loading ML and saying use ""; then
    e.g. try(exampletotry); or try(exampleFac7);.
  • Makefile and example Lex and Yacc sources.
    Instructions: Download these three files to an empty directory and say "make".
    Run it by saying "calc". Input lines are things like "1+2*3" "(1+2)*3" etc.
  • Makefile and ZIPped sources for Jlex/cup example.
    Instructions: Download both these files to an empty directory and say "make".
    Then look at minimal.lex and minimal.cup (note that these are the only user-written files (the rest is Java admin)).
    Run it by saying "java parser". Input lines are things like "1+2*3;" "(1+2)*3;" etc.
    Thanks to Dr Norman for this example. (N.B. I've checked that this works on the linux PWF -- so it's your problem, not mine or Dr Norman's, if it doesn't work elsewhere.)