CS3 page · Project overview · Phase 1 · Phase 2 · Samples · Testing


CS3 Individual Programming Project

The central task of this project is to construct a compiler for µOCCAM, a subset of the OCCAM parallel programming language. The project is divided into two phases: the first is to produce an appropriate lexical analyser and parser; the second is to write a code generator for a parallel abstract machine. The compiler is to be written in C, and sections of support code are provided to make the task achievable in the time given.

More detailed information on each phase can be found through the following links.

There is a questionnaire for you to provide feedback on this module. Please do. Copies will be distributed at the closing lecture of Phase 2.

This year the individual programming project is administered by Ian Stark.


Tuesday 17 October 2000(Term 1 Week 2) Phase 1 begins. Briefing session in Lecture Theatre C at 11-12.
Tuesday 14 November 2000(Term 1 Week 6) Phase 1 ends. Submissions due by 12 noon.
Tuesday 5 December 2000(Term 1 Week 9) Phase 1 closing lecture in Lecture Theatre C at 11-12.
Tuesday 16 January 2001(Term 2 Week 2) Phase 2 begins. Briefing session Lecture Theatre B at 1pm.
Tuesday 30 January 2001(Term 2 Week 4) Phase 2 sample programs due in by 1pm.
Friday 16 February 2001(Term 2 Week 6) Phase 2 ends. Submissions due by 1 pm.
Monday 12 March 2001(Term 2 Week 10) Phase 2 closing lecture in Lecture Theatre C at 11am.

While the project is running, you should expect to spend at least as much time working on it as you do on any other lectured module.


Each phase contributes 50% to the final project mark. Project assessment is primarily based on the implemented compiler, which is run through a batch of tests. There is a prize at the end of the year for the student whose program performs best.

Help and assistance

The resources listed below contain a wealth of information relevant to this practical. In addition you can send specific queries to the ipphelp mail alias. This is passed to a postgraduate demonstrator assigned to this course. You can also come to see me personally: my office is JCMB 2506, and I shall be available during term time between 2 and 3pm on Mondays and Thursdays.

You should consult the newsgroup eduni.dcs.cs3.ipp frequently: all course announcements will appear there. This is in addition to the standard eduni.dcs.cs3 group, and is specifically for questions and discussion about the project. Staff, demonstrators and other students will all read and post to the group.

In an extended and substantial practical like this, it can be very helpful to air common queries and difficulties. Unfortunately, it is sometimes difficult to judge what amount of shared discussion is legitimate. We strongly encourage you to put all discussion of the practical on the newsgroup. As well as giving everyone a chance to comment and help you, this will also forestall any possible accusation of inappropriate collaboration.

Please take care to protect your own work from the inspection of others. Source code is precious: use chmod to protect files, and do not show your code to anyone else.


The standard equipment for this practical is the Linux PC's in the machine halls. If you have a similar machine of your own, you are welcome to use that instead; the programs should work on any Unix system. Before submission though, you should always check that your code works correctly on our machines.

There is a small collection of relevant reference books chained down in the NE corner of the South machine hall. For further material, including several introductory books on the OCCAM language, try the library on floor 4 of the JCMB. The O'Reilly book on Lex and Yacc is popular; it covers the flex and Bison tools used in this project.

The following electronic resources are relevant to this project. All the material held locally is in /home/cs3/ipp/.

The µOCCAM manual
This contains a detailed description of everything in the project compiler; except of course the components to be written by you. The first chapter describes the grammar of µOCCAM, and is all you need for phase 1 (available as pdf and postscript). For phase 2 you will need the full manual (pdf, postscript).

Some text was missing from diagrams in the printed handouts; these pages are available as a separate document (pdf, postscript).

The OCCAM 2.1 reference manual
The full works, 170 pages long. Available as pdf and postscript.

The µOCCAM grammar and OCCAM 2.1 manual were given out at the first lecture. If you don't have them, ask for a copy at the Informatics Teaching Office.

The µOCCAM compiler
You can find the C source code for this in the directory /home/cs3/ipp/source/.

The ipp test script
This will automatically run your own µOCCAM compiler against test programs you provide.

This "fast lex" program automatically generates lexers. Use man flex to get documentation; this is available locally as dvi, pdf and postscript, with a full online manual provided by the GNU project.

A variant on the traditional "Yacc" program, this automatically generates parsers. The man bison information is available as dvi, pdf and postscript. There is a Bison home page and a full online manual.

This tool manages dependencies between the many different files in a large programming project: working out which source to compile when, and so forth. Manual page in dvi, pdf, and postscript; the Make home page and online manual.

A revision control system, this keeps track of all the files in your project, noting which ones change when. There is a brief outline of how to use CVS for this programming project.

These four tools are very widely used and well worth learning to use effectively. Several programming reference books cover them in some depth.

The µOCCAM compiler is written using nuweb, a literate programming tool based on Knuth's "web" system. A single document contains both source (in C) and manual (in LaTeX) for the compiler. It is not necessary to use or even understand nuweb to complete the practical, but inquisitive souls can find the package in /home/cs3/ipp/nuweb/, and the original literate form of the µOCCAM compiler in /home/cs3/ipp/literate-source/.


The µOCCAM compiler project was originally devised and implemented by Kevin Mitchell.