CS712/CS812
Compiler Design
Spring 2003


Instructor: P. Hatcher
Office: Kingsbury M111
Phone: 862-2678
E-mail: hatcher@unh.edu
Office Hours: MWF 9:00-10:00am, MWF 1:30-2:00pm, Fri 3:00-4:00pm, or by appointment (send e-mail to request an appointment).

The prerequisite for this course is CS671. However, students should also have familiarity with the material from CS611.

This course has two major objectives:

An outline of the material covered by this course is given here.

Grading

The major portion (72%) of your course grade will be based upon a large programming project. The class will be building a C compiler written in C that generates code for the Intel IA-32 architecture. We will be implementing the 1989 ANSI C standard.

Tentatively, the project will consist of six phases:

  1. type representation - due February 9.

  2. declarations - due March 2.

  3. expressions - due March 30.

  4. statements - due April 13.

  5. pointers, arrays, structs and unions - due April 27.

  6. compile the compiler - due May 11.

Each project phase will be worth 12% of your course grade. However, the project phases are not of equal difficulty. Phases 2 and 3 are particularly challenging. It is important that you start early on these two phases.

With the exception of phase 1, project assignments may be handed in late at a penalty of 5 points per day up to one week late. No late submissions will be accepted for project phase 1. An assignment is not considered late unless turned in after 8am on the day after the due date.

Code written for this course should conform to these conventions.

There will be two homework assignments given during the semester.

  1. Homework 1 is a written assignment concerning LL parsing.
  2. Homework 2 is a written assignment concerning LR parsing.
The homework (in total) will be worth 6% of your course grade. Each assignment will be worth 3%.

The rest (22%) of your course grade will be based upon a final examination. This examination will be comprehensive and will be closed book. The final exam will be Friday May 16 8-10am in Kingsbury 319. A sample final exam is available as a Postscript document on the CIS machines in ~cs712/public/sample-final.ps.

In summary, your course grade will be determined in the following way:

Textbooks

There is no required textbook for this course.

On reserve in the Kingsbury library:

I do not think you need to purchase any of the above books. Access to the copies on reserve in the library should be sufficient. However, if you want to order your own copies of any of the books on reserve, I suggest Quantum Books or Amazon.com Books.

O'Reilly and Associates publishes a good book on lex and yacc:

We will be using the GNU versions of lex and yacc. There are GNU manuals for both flex and bison.

We will also use two manuals that I have downloaded from Intel's Developer Site:

The manual for the GNU assembler will also be useful. (In particular, be aware that the syntax used by Intel differs from that used by the GNU assembler. See the relevant section of the GNU assembler manual.)

In addition, here is a guide for programming in Intel IA-32 assembler under Linux.

Finally, you will need to use gdb to debug both the compiler and the output of the compiler. The GNU manual for gdb is here. To debug at the assembly language level, read about the stepi/nexti commands, how to display registers, and the break *address command.

Computer Accounts

The UNH CIS server turing.unh.edu is the primary computing resource for this course. You should automatically be given an account on this machine. During the semester you may use any other machines that you have access to, but for grading purposes your programs must execute on turing.unh.edu.


Last modified on April 1, 2003.

Comments and questions should be directed to hatcher@unh.edu