Compilers (4th year)               

Hi an initial introduction 
Grammars and machines
Instruction sets
Compiler compilers
  Sable at http://sablecc.org/  
Manual at: thesis,   
Construction of Lexical analysers
Primitive operations in Hi  
Derived operators or functions
Vector constructors   (also as formated notes)
 Advanced procedure call mechanisms
Register window approaches
Garbage collection
conservative garbage collection
 persistent heaps
Object oriented compilation techniques
Register allocation algorithms
Implementation of map in imperative code 
Automatic code generation using ILCG

Background notes for the practical work
Mark allocation

Samples of code you can use

  sample Hi programs as a tar archive

Monad remover this is a class that removes monadic operations from a Hi syntax tree.

The full Hi grammar in Sable form.

An example working Hi system (binary only)
The Sable CC system
sableutil.jar  sablecc.jar




  The course attempts to focus on more advanced concepts in the implementation of programming languages.  .


Students will be expected to do some practical work on modifying a compiler for a simple language. Key points are
  1.  the fact that automatic compiler construction tools are to be used rather than hand coded parsers,
  2. the fact that the language supports high level map operations on data,
  3. the need to generate real machine code
  4. the use of a functional source language
  5. the use of an array source language

Past exam paper

Here is a past exam paper with sample solutions

Background Material

Material from my book ‘A compiler writers Toolbox’  as edited down for the 3rd year compiler course

My web page on compilers, contains source code and articles on a number of compilers that I have developed.

Compilation to multi-media instructions. An account of the ILCG tool for multi-media instructionset compilation

External links

*          Programming Language Research

*          The comp.compilers archive

*          The Stanford SUIF Compiler Group

*          Parsing Techniques - A Practical Guide

*          Various compiler-related links

*          JavaCC

*          JLex: A Lexical Analyzer Generator for Java

*          CUP Parser Generator for Java

[top of page]

Page Editor: Information Officer
Last Update: 16 May, 2005