Spring 2010

Compiler Design

Listed in: Computer Science, as COSC-37



An introduction to the principles of the design of compilers, which are translators that convert programs from a source language to a target language. Some compilers take programs written in a general-purpose programming language, such as C, and produce equivalent assembly language programs. Other compilers handle specialized languages. For instance, text processors translate input text into low-level printing commands. This course examines techniques and principles that can be applied to the design of any compiler. Formal language theory (concerning regular sets and context-free grammars) is applied to solve the practical problem of analyzing source programs.

Topics include: lexical analysis, syntactic analysis (parsing), semantic analysis, translation, symbol tables, run-time environments, code generation, optimization, and error handling. Each student will design and implement a compiler for a small language. Offered in alternate years.

Requisite: Computer Science 12 and either 14 or 16. Spring semester.  Professor L. McGeoch.


2020-21: Not offered
Other years: Offered in Spring 2008, Spring 2010, Fall 2011, Spring 2014, Fall 2015


The text is Compilers: Principles, Techniques and Tools by Aho, Sethi, and Ullman. There are two editions, the original 1986 edition and a later 2007 edition (with Monica Lam added as a fourth author). You don't necessarily need to buy either book. There will be three copies of the old edition and one of the new available on reserve in the Science library. Most of the new material in the second edition focuses on advanced topics thatwe will not cover in this course.

My suggestion is that you buy a used copy of the old edition. Copies are available from Amazon (starting at $10, including shipping) and elsewhere. The reserve copies are there if you want to use them. While we won't always depend on the book heavily, it should complement the lectures well and is worth buying at a reasonable price. Given the apparent health of the used market and the availability of reserve copies, I haven't ordered copies locally.