CS712/CS812
Compiler Design
Spring 2005
MWF 2:10-3pm, Nesmith 329
Instructor:
P. Hatcher
Office: Nesmith 310A
Phone: 862-2678
E-mail: hatcher@unh.edu
Office Hours: MWF 1:30-2:00pm, Fri 3:00-4:00pm,
or by appointment (send e-mail to request an appointment).
The pre-requisites for this course are
CS671
and
CS520.
This course has two major objectives:
-
The first objective comprises the items listed in the formal course
description (in the
UNH course
catalog).
That is, you will learn how modern compilers are designed and implemented
(and also about the difficulties of designing languages).
-
The second objective of the course is for you to improve your
software engineering skills by:
- writing a specification;
- designing a nontrivial system;
- implementing a nontrivial system;
- testing a nontrivial system; and,
- working with program generation tools.
An outline of the material covered by this course is given
here.
Grading
The major portion (70%) of your course grade will be based upon a large
project.
You will help design a simple object-oriented language and you will implement
a compiler for the language that generates code for
the Intel IA-32 architecture.
Tentatively, the project will consist of five phases:
- language design - due February 13 (10%).
- scanner and parser - due February 27 (10%).
- semantic analysis - due March 27 (15%).
- code generation - due April 17 (15%).
- complete the compiler - due May 8 (20%).
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.
The draft
specification produced by students during Phase 1 is now
available.
There will be three homework assignments given
during the semester.
- Homework 1
is a written assignment concerning language specification.
- Homework 2
is a written assignment concerning LR parsing.
- Homework 3
is a written assignment concerning LL parsing.
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 Wednesday May 18 3:30-5:30pm in Nesmith 329.
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:
- Programming Project - 70%
- Homework - 9%
- Final Examination - 21%
Textbooks
There is no required textbook for this course.
On reserve in the Engineering, Math and Computer Science library
in New Hampshire Hall:
- Compilers: Principles, Techniques, and Tools
by Aho, Sethi and Ullman
- Introduction to Compiler Construction with Unix
by Schreiner and Friedman
- The 1989 ANSI C Standard
- Engineering a Compiler
by Cooper and Torczon
- Lex & Yacc
by Mason, Brown and Levine
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.
We will use
The Java Language Specification, 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.
We will also use two manuals that are available from
Intel:
- IA-32 Intel Architecture Software Developer's Manual, Volume 1: Basic Architecture
- IA-32 Intel Architecture Software Developer's Manual, Volume 2: Instruction Set Reference Manual
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 February 11, 2005.
Comments and questions should be directed to
hatcher@unh.edu