CS712/CS812
Compiler Design
Spring 2008
MWF 2:10-3pm, Kingsbury N111


Instructor: P. Hatcher
Office: Kingsbury N229/N221D
Phone: 862-2678
E-mail: hatcher@unh.edu
Office Hours: Mon 1:30-2:00pm and 3:00-3:30pm; Wed 1:30-2:00pm; Fri 3:00-4:00pm; or by appointment (send e-mail to request an appointment).

The prerequisites for this course are CS671 and CS520.

This course has two major objectives:

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

If you are a student with a documented disability who will require accommodations in this course, please register with Disability Services for Students in the Memorial Union Building, Room 118 (862-2607), for assistance in developing a plan to address your academic needs. Students who are already registered with Disability Services and wish to receive accommodations in this course are strongly encouraged to share their accommodation letter with me in a timely manner.

Grading

The major portion (70%) of your course grade will be based upon a large project. You will implement a compiler for an object-oriented language that generates code for the Intel IA-32 architecture. You will use the Unix compiler-writing tools lex and yacc and consequently you must program in either C or C++.

Tentatively, the project will consist of five phases:

  1. integer expressions - due Sun Feb 24 (14%).

  2. control statements - due Sun Mar 9 (14%).

  3. classes without methods - due Sun Apr 6 (14%).

  4. classes with methods - due Sun Apr 27 (14%).

  5. arrays - due Sun May 11 (14%).

Each project assignment will be worth 100 points. Project assignments may be handed in late at a penalty of 2 points for one day late, 5 points for two days late, 10 points for three days late, 20 points for four days late, and 40 points for five days late. No program may be turned in more than 5 days late. An assignment is not considered late unless turned in after 8am on the day after the due date.

WARNING: All students are expected to do their own work on the project assignments (and homework and exams for that matter). No collaboration is allowed. A general rule to follow is that you may discuss the programs with other students at the concept level but never at the coding level. If you are at all unclear about this general rule, don't discuss the programs with other students at all.

WARNING: To get full credit on a project assignment, your code must be adequately documented and structured. If I can't easily read and understand your code, you will lose points!

We will be compiling a language designed by the CS712/CS812 students in 2005 and 2006. This language is known as T and is modeled on Java.

There will be three homework assignments given during the semester.

  1. Homework 1 is a programming assignment concerning compiling the Simp language (due Mon Feb 4).
  2. Homework 2 is a written assignment concerning LL parsing (due Wed Apr 2).
  3. Homework 3 is a written assignment concerning LR parsing (due Wed May 7).
The homework (in total) will be worth 9% of your course grade. Each assignment will be worth 3%.

The rest (21%) 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 Monday May 19 1-3pm. A sample final exam is available as a PDF file on the CIS machines in ~cs712/public/sample-final.pdf.

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

Students receiving at least 55% of the course points are guaranteed at least a D-. Students receiving at least 65% of the course points are guaranteed at least a C-. Students receiving at least 75% of the course points are guaranteed at least a B-. Students receiving at least 85% of the course points are guaranteed at least an A-.

Textbooks

There is no required textbook for this course.

On reserve in the Engineering, Math and Computer Science library in Kingsbury Hall:

I do not think you need to purchase either 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.

We will use The Java Language Specification, 3rd edition, which is available on-line.

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

There is also a good O'Reilly book about lex and yacc, entitled Lex & Yacc by Levine, Mason and Brown. This book is available as an e-book via the UNH Library. To access it, simply locate it through the library on-line catalog.

We will need access to details about the Intel IA-32 architecture. Intel maintains a webpage about their manuals for the IA-32 and EM64T architectures. I think these three will be the most useful:

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 default by the GNU assembler. See the relevant section of the GNU assembler manual.)

Also, you may 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 servers euler.unh.edu and zeno.unh.edu are the primary computing resources for this course. You should automatically be given an account on these machines. During the semester you may use any other machines that you have access to, but for grading purposes your programs must execute on euler.unh.edu and zeno.unh.edu.

We will be generating code for the Intel IA-32 processor. Note that euler.unh.edu and zeno.unh.edu have Intel IA-32 processors. But gauss.unh.edu has Intel EM64T processors.


Last modified on April 21, 2008.

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