Course DescriptionThe primary goal of the course is to learn the basic principles and practice of compiler construction. The principles (and some of the practice) will be covered in lectures and readings. The practice in applying these principles will be acquired by modifying an existing compiler.
A secondary intent of the course is to give you some experience in working with a software system that you didn't write and that may be larger than what most of you have dealt with previously. Since the compiler is written in C++, and is relatively well-structured, you will also gain some experience with object-oriented programming in general and C++ in particular.
CommunicationPlease aggressively use our office hours to clarify problems you are having in understanding the material, to ask other questions about compilers, etc. Email is a good way to ask questions, particularly well defined ones. Please send questions that might be of interest to others in the class to the course mailing list, cse401 at cs. Students should feel free to answer questions posted to the list. There is no better way to test your understanding of a concept than to explain it to others. Questions of less general interest should be directed to "401admi at s", which the instructor and the TA will both read. (Of course, if you want to send mail to individual staff members you're free to do so.) We'll post key questions and answers, as well as updates on problems, etc., to the class mailing list.
BooksThe primary book for the course is Compilers---Principles, Techniques, and Tools by Aho, Sethi, and Ullman (ASU). This book is colloquially called the "Dragon Book" (or even sometimes the "Red Dragon Book", since the first edition had a green dragon on the cover).
C++, Tools, etc.Effectively using C++ and the support tools for C++ is critically important in reducing the amount of time you spent on the course project. It may never, at any single moment, seem worth the investment in learning about (say) the gdb debugger. But the long-term payoff is great.
The ProjectThis class includes a substantial implementation project. You will modify and extend an existing compiler, written in C++, for a simple Pascal-like language called PL/0. Your modifications will extend the language by adding new syntax and semantics, turning PL/0 from a barely usuable programming language into a quite reasonable one. An overview of the project is here.
The project will be broken up into several stages, paralleling the study of compilers in the text and lectures. Some lectures will explore how the PL/0 compiler is organized and how textbook techniques are realized in the PL/0 compiler.
Each language addition will require language design and specification work (extending the initial PL/0 language specification to include the new features), as well as implementation work (extending the initial C++ implementation of PL/0 to compile the new features).
Emphasis in the implementation should be placed on making clean, understandable changes that fit in well to the existing compiler structure. This will make reading the changed code easier, both for the TAs and for you. Low-level hacks, even for better compiler efficiency, should not be done, at least not without first consulting one of the course staff. Grades will be based both on program correctness and efficiency, as well as modularity, style, and readability.
The "front end" phases of the compiler are very portable, and can be run on just about any system with a C++ compiler. The "back end" phases produce MIPS assembly code, which will be interpreted on the SPIM simulator.
Project TeamsBarring exceptional circumstances (e.g., serious difficulties arranging to meet team-mates), projects will be done by two person teams. The reason for having a team is that you (hopefully) will learn to work well together and work less, while learning more. You may dissolve your group at any time during the quarter by having all partners send mail to me or a TA saying that the team is dissolved, and telling us about any new teams you may have formed. Grades are given jointly to each group for each stage of the project they work on together. We will be arranging team accounts for those pairs of people who want to work together.
Problem SetsIn addition to the project there will be occasional homework problems. The problems will focus on general and theoretical material in the textbook, complementing the practical but specific material in the project. Unless otherwise specified, homework problems can also be done with (possibly different) team of 2 people.
Late PolicyAssignments are due at the beginning of class on the assigned date. Late submissions loose 25% per calendar day. If something exceptional occurs, get in touch with the instructor.
ExaminationsSee the schedule for the tentative date of the midterm and the date of the final. The midterm will of course cover the first part of the course; the final will concentrate on the second part, but not exclusively. Both exams will be closed book.
GradingAs a guideline, the midterm accounts for 15% of the grade, the final accounts for 25% of the grade, the written assignments account for 20% of the grade, and the project accounts for 40% of the grade.
I try to make (upward) adjustments that overlook individual, anomalously poor grades. (But, don't interpret this to mean that you can simply ignore one assignment.)
CheatingYou may discuss ideas, assignments, the PL/0 compiler, etc. with anyone you wish. Your solutions, however, must be entirely your own and your partners'.
401admin at cs.washington.edu