This information is no longer being maintained.
You can find more information about Computer Languages, Parsing, Grammars, and Compilers here.
You may be able to access the new version of CS2121 here

CS2121: The Implementation and Power of Programming Languages
Autumn 2000 to Autumn 2004

Syllabus

Lectures

Pete Jinks gives 10 weekly lectures about the "Implementation" part of the course-unit:

An exploration of the practical issues of using grammars to recognise structured pieces of text. Plus, an introduction to dealing with the parts of computer languages that grammars are not suited for, such as identifiers. Finally, a look at which facilities are necessary in computer languages.

Peter Aczel gives 11 weekly lectures about the "Power" part of the course-unit:

An examination of the underlying theory of grammars, including their limitations. The theory of automata, and the equivalence of grammars and automata, gives us practical methods for implementing recognisers for grammars e.g. to write a compiler. Finally, a look at the generality of computers and computations, and their fundamental limits.

We also offer a joint revision lecture, if students submit suitable questions. This may be the in the last scheduled lecture, or in January just before the exam.


Practical work

Paper exercises

The lecture handouts for both parts of the course-unit include exercises.
The examples classes deal with the exercises from the "Power" part of the course-unit, and are assessed.

Answers to the "Implementation" exercises are in the Undergraduate Resource Centre (and can also be found via the list of handouts). I am very happy to discuss them with you during labs or examples classes, or after lectures, or via email.

Labs

Labs 1-4 are fairly straightforward exercises designed to familiarise you with the use of lex and yacc, for the "Implementation" part of the course-unit.
Lab 5 is a 2-session exercise, intended to give you some experience of implementing a little language and also of using Finite State Automata, supporting both halves of the course-unit.
Lab exercisesextra information & hints
Introduction
& timetable
debugging flex, byacc and make
Exercise 1: condensed man page for egrep and regular expressions used with flex and hints
Exercise 2: lex manual and strings and comments
characters [local] and pre-processing [local] and syntax [local]
hints
Exercise 3: yacc manual and use of %left etc. and examples
Exercise 4: Infix and Postfix notations, man pages for bc and dc
Exercise 5: grammar and strings and comments
Extra information about the labs
You are expected to run the labprint command before getting each exercise marked.
Exercise 1: if you get an error message like: /bin/sh: /tmp/t: Permission denied
you need a new version of the "makefile" i.e. cp $CS2121/p*/ex1/makefile .
(The problem is that the file /tmp/t already exists but is owned by someone else, so you can't overwrite it. I should have done a better job of inventing a filename - sorry.)
If the labmail program complains that it can't find "labmail_me", then run the command "make labmail"
If your program crashes at run-time, making a "core" file, and you want to find out what line it went wrong at etc., on Linux do:
	gdb program_name core
	where
	quit
(This relies on using the -g flag with gcc, as in the makefiles provided.)
If you have any questions about or corrections to any of the lab exercises, please email me so I can correct or improve the descriptions.

Exam

The first exam for CS2121 was in January 2001. Neither of us was involved in that exam, so don't assume that this year's exam will be similar.

You can find copies of the exam from January 2002 here and here is my attempt at some answers to Q1 and Q2.

Just like January 2002, this year's exam is in two sections (each containing two questions), corresponding to the two parts of the course-unit - please answer the two sections in separate answer-books.
You should answer 3 questions out of the 4, and each is worth 20 marks.

My two questions will be:

  1. Based on the lab work e.g write some lex and yacc code to deal with a simple piece of grammar (which you may have to design yourself, based on broad hints). This may well include further details from the lectures and labs, like operator precedence and associativity, or modifying the grammar, or using parse trees or a dictionary, or generating code.
    (This question will be similar to question 1 in previous CS2111/CS2112 exams).

  2. Based on the lectures (similar to questions 2, 3 & 4 in previous CS2111/CS2112 exams, but remember that we don't cover many of these topics in CS2121!).
    [Since the 2002 exam the external examiners have asked me not to give choices within a single question e.g. as in Q2 parts c and d.]
    The emphasis will be away from the practical use of lex and yacc, which is mainly dealt with in question 1, but I might ask something about them, or more generally about lexical analysis and/or syntactic analysis, or any of the other topics mentioned for question 1 above.

You might find the following, from CS2111/CS2112, useful:

Note: the resit (August/September) exam will have a similar format to the main (January) exam.


The content of this page and those it links to is copyright © Pete Jinks, except, obviously, for links that go to other web-sites, and pages that I have myself copied from elsewhere. (I hope I have correctly acknowledged any such copying - please let me know if I have missed any out.)

You are welcome to make educational, not-for-profit use of my work, but please give me credit when you do so.


This is a legacy website of The University of Manchester. The process of migration to www.manchester.ac.uk is in progress.