CS712/CS812
Compiler Design
Spring 2013
Mon/Wed/Fri 11:10am-12:30pm, Kingsbury N133


Instructor: P. Hatcher
Office: Kingsbury N215B
Phone: 862-2678
E-mail: hatcher@unh.edu
Office Hours: Mon 10:30-11am, 12:30-1pm; Wed 9:30-11am; Fri 10:30-11am, 12:30-1pm; or by appointment (send e-mail to request an appointment).

Catalog Description:

Formal languages and formal techniques for syntax analysis and parsing; organization of the compiler and its data structures; code generation. LL and LR parsing; automatic generation of scanners and parsers from high-level descriptions. Implementation of features from imperative and object-oriented languages. Students required to design and implement a compiler for a simple language.

Undergraduates can count this course as either a theory elective or as an implementation-intensive elective, but not both. For graduate students this is an implementation-intensive course.

The prerequisites for this course are CS520 and CS659

This course has the following objectives:

The readings for this course are given here.

The University is committed to providing students with documented disabilities equal access to all university programs and facilities. If you think you have a disability requiring accommodations, you must 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 privately in a timely manner.

We will use Piazza so you can bring up your questions in real time. You should receive an invitation to join the Piazza class for CS712. If you do not receive an invitation, please contact me.

Grading

The theory component of the course will be evaluated by three exams, tentatively scheduled for Monday March 4, Monday April 10, and Monday April 29. The material covered by each exam will be cumulative. That is, the second exam will cover both new material and the material covered on the first exam, and the third exam will cover new material plus the material covered by the first two exams. Each exam will be worth 11% of the course grade.

Prior to each exam there will be a written homework assignment to help you prepare for the exam. Each homework will be worth 2% of the course grade. Homework assignments may not be turned in late.

The implementation component of the course will be evaluated by a large programming project. You will implement a compiler for the T programming language, a simple object-oriented language. The compiler will generate assembly-language code for the Intel IA-32 architecture. You will use the Unix compiler-writing tools lex and yacc and you should build compiler in C or C++. (Exceptions to using lex/yacc and C/C++ as the implementation tools may be allowed, but you will need to negotiate with me.)

The project will consist of 4 phases:

Each project assignment will be worth 13% of the course grade and consist of 100 points. Assignments are due at midnight on the day they are due, but there is an eight-hour grace period until 8am the next day. Project assignments may be handed in late at a penalty of 15 points for one day late and 30 points for two days late. No program may be turned in more than 2 days late. The eight-hour grace period is in effect for the late submissions too.

The project is cumulative. You must live with your code for the whole semester. Solutions for phases will not be given out. Regression testing is critical.

WARNING: All students are expected to do their own work on the programming 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 programming assignment, your code must be adequately documented and structured. If we can't easily read and understand your code, you may lose points!

There will also be a final exam given on Thursday May 9, 1-3pm, in Kingsbury N113. The final exam will cover the compilation concepts (and not the theory material covered by the exams given during the semester). The final exam will be worth 9% of the course grade.

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-.

Reading Materials

There are no required textbooks for this course.

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

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

There is also an O'Reilly book about flex and bison, entitled Flex & Bison by John Levine. This book is available as a Safari on-line book via the UNH Library.

Information about the Intel IA-32 architecture is available here. These three manuals will be the most useful:

The manual for the GNU assembler may 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 how to use the break command with an address.

There is a brief tutorial for the T programming language.

Computer Accounts

The UNH CS server agate.cs.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 agate.cs.unh.edu.


Last modified on April 4, 2013.

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