CS712/CS812
Compiler Design
Spring 2001
(Revised)
Instructor: P. Hatcher
Office: Kingsbury M202
Phone: 862-2678
E-mail: pjh@cs.unh.edu
Office Hours: MWF 9:30-10:00am, MWF 11:15am-12:00noon,
and MWF 1:30-2:00pm
or by appointment.
The prerequisite for this course is CS671.
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 a bit about the difficulties of designing languages).
-
The second objective of the course is for you to improve your
software engineering skills by:
- working with a system involving thousands of lines of code;
- working with a system written partially by others;
- working with a system for which testing is nontrivial; and,
- working with program generation tools.
Grading
The major portion (70%) of your course grade will be based upon a large
group programming project.
The class will cooperate to produce a single compiler:
a C compiler written in C that generates code for the Compaq Alpha.
The project will consist of four phases:
- January
29 to March 4: global declarations, scanner, abstract syntax
tree construction, Alpha register allocation, and semantic analysis tools.
- March 5
to April 1: local and struct/union declarations, function
declarations and function calls, basic expressions, and basic control flow.
- April 2
to April 22: more operators (e.g. bitwise operators,
shift operators), arrays and pointers, and more
control flow (e.g. switch, goto).
- April 23
to May 13: structs and unions, bit fields, initializers, enum types,
typedef declarations, constant expressions, incomplete arrays, old-style
functions, and other "odds and ends".
Each student will receive an individual assignment and an individual grade
for each phase.
Students will have some input on choosing their assignments, but I ultimately
will make the assignments in order to ensure overall project success.
Students will also be expected to submit a self-assessment of their
work for each phase.
The grade for each phase will be worth 17.5%, but the effort required
for phases may vary.
Project assignments are due on the last day of each phase.
Assignments may be handed in late at a penalty of 5% per day
up to one week late.
An assignment is not considered late unless turned in after 8am
on the day after the due date.
Since this is a collaborative assignment, some meetings outside of class
will be required to coordinate with me or with other students.
In addition, strict coding conventions will be in place and must be followed
for full credit.
General project guidelines (including coding coventions) are given
here.
There will be three homework assignments given
during the semester.
- Homework 1
is a programming assignment to introduce compiler writing using lex and yacc.
- Homework 2
is a written assignment concerning LL parsing.
- Homework 3
is a written assignment concerning LR 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 Fri May 16 10:30am-12:30pm.
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 Kingsbury library:
- Compilers: Principles, Techniques, and Tools
by Aho, Sethi and Ullman
- Introduction to Compiler Construction with Unix
by Schreiner and Friedman
- Alpha AXP Architecture Reference Manual
by Sites and Witek
- Tru64 Unix Assembly Language Programmer's Guide
- C: A Reference Manual
by Harbison and Steele
- The ANSI C Standard
Note that one of the books is available on-line.
You can also download PDF for the this book
here.
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:
- Lex & Yacc by Mason, Brown and Levine (about $27)
Documentation is available on-line
for the Unix utilities we will be making heavy use
of this semester.
Look in ~cs712/public/docs on alberti.
Computer Accounts
The UNH CIS Alpha servers (alberti.unh.edu, hypatia.unh.edu and hopper.unh.edu)
are the primary computing resources for this course.
You should automatically be given accounts 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 the CIS Alpha machines.
Last modified on February 18, 2001.
Comments and questions should be directed to
pjh@cs.unh.edu