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 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@cs, which is also archived on the Web. 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 "401admin@cs". (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. Because the compiler targets the MIPS processor, however, it is not currently possible to test generated code except on a MIPS machine or a MIPS emulator such as SPIM (which is available on the instructional Alphas: San Juan/Orcas/...)
Project TeamsProjects normally will be done by two- or three-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 on which they work together. We will be arranging team accounts for those groups 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 should be done individually, not in teams.
Late PolicyAssignments are due at the beginning of class on the assigned date. Assignments will be accepted with no penalty during a "grace period" up to 5:00 PM (as determined by time stamp on electronic turnins) on the due date, but such assignments may be graded and returned later than on-time submissions. Except in exceptional circumstances, late submissions lose 10% per calendar day.
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.
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'.
email@example.com (Last modified: 3/26/99)