Syllabus and general information for MCS-388: Compiler Design (Spring 2001)

Overview

MCS-388 attempts to draw together the theory and practice of compiler construction. Much of the material will have a strong theoretical foundation. However, with the exception of the last couple topics (due to time constraints), this material will serve as the basis for compiler-writing projects. Topics include lexical and syntactic analysis, naive code generation, data-flow analysis, register allocation and assignment, suppression of partial redundancies, and instruction scheduling.

Office hours

I will be available in my office (OHS 303) on Tuesdays from 10:30 to 11:20, on Wednesdays, Thursdays, and Fridays from 9:00 to 9:50, and by appointment. You may send me electronic mail at max@gac.edu or call me at extension 7466. I'll try to put any updates to my office hours on my web page, so check there if in doubt.

World Wide Web

All course materials will be available through my World Wide Web page. The URL for this course is http://www.gustavus.edu/~max/courses/S2001/MCS-388/. After this syllabus I will give hardcopy handouts only to those students who want them.

Prerequisites

MCS-388 draws heavily on MCS-265, MCS-287, and MCS-284. Some notions from MCS-375 and MCS-236 also crop up. You're expected to be able to program. Since the compiler-building tools and pre-existing code modules I supply will be centered around the Java programming language, the path of least resistance will probably be to learn that language as we go if you don't already know it. On the other hand, there are comparable compiler-building tools centered around other languages, so if you would rather use another language, that's fine too, you'll just have a little less of a support network. I'll gladly accept labs written in any programming language: C++, Scheme, ML, Ada, you name it.

Text and readings

Our primary text will be the "dragon book," i.e., Compilers: Principles Techniques and Tools by Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman, Addison Wesley, 1986. We will also use some additional material: documentation, some of which will be on-line or in the lab area and some of which I'll hand out, and supplementary readings, which I will hand out. (There's also an on-line Java Tutorial at http://java.sun.com/docs/books/tutorial/, hardcopies of that tutorial in the BookMark as a supplemental text for MCS-270, and copies of a couple Java books in the MCS Lab monitors' room, any of which you are welcome to use as a supplement.)

Labs

Most Thursdays, we will meet in the OHS 326 computer lab rather than in the usual classroom. As shown on the syllabus, there are a few occasions when we'll break the usual pattern by having class on a Thursday and/or lab on a non-Thursday.

Each lab has two or three lab days set aside for us to work together, but will also require you to spend additional time out of class.

Attendance is mandatory for all lab sessions, unless you have already turned in your lab report. I will excuse up to two absences per student, for any reason. Use yours wisely. If you exceed this allowance, I may reduce your course grade by one letter grade.

Honor

Students are encouraged to discuss the course, including issues raised by the assignments. However, the solutions to assignments should be individual original work unless otherwise specified. If an assignment makes you realize you don't understand the material, ask a fellow student a question designed to improve your understanding, not one designed to get the assignment done. To do otherwise is to cheat yourself out of understanding, as well as to be intolerably dishonorable.

Any substantive contribution to your solution by another person or taken from a publication should be properly acknowledged in writing. Failure to do so is plagiarism and will necessitate disciplinary action.

The same standards regarding plagiarism apply to team projects as to the work of individuals, except that the author is now the entire team rather than an individual. Anything taken from a source outside the team should be be properly cited.

One additional issue that arises from the team authorship of project reports is that all team members must stand behind all reports bearing their names. All team members have quality assurance responsibility for the entire project. If there is irreconcilable disagreement within the team it is necessary to indicate as much in the reports; this can be in the form of a ``minority opinion'' or ``dissenting opinion'' section where appropriate.

Late assignments

All lab assignments are due at the beginning of class on the day indicated. Late lab assignments will be penalized by one ``grade notch'' (such as A to A- or A- to B+) for each weekday late or fraction thereof. However, no late assignments will be accepted after graded assignments are handed back or solutions are distributed.

If you are too sick to complete an assignment on time, you will not be penalized. Simply write ``late due to illness'' at the top of the assignment, sign your name and hand it in. Other circumstances will be evaluated on a case-by-case basis.

Please see the separate homework policy, linked to the web version of this syllabus.

Grade changes

Please point out any arithmetic or clerical error I make in grading, and I will gladly fix it. You may also request reconsideration if I have been especially unjust.

Grading

I will provide you with a grade on each homework assignment and lab assignment, in addition to the mid-term and final grades, so that you may keep track of your performance. The homeworks will contribute half of your final grade, with the labs contributing the other half. However, I reserve the right to subjectively adjust your final grade. Please see me if you have any question how you stand. Class participation is not graded; however, it allows you to find and repair the gaps in your understanding before doing the assignments, and thus can dramatically improve your grade. You are responsible for all course material, whether or not you are present when it was covered or distributed.

Please see the separate homework policy, linked to the web version of this syllabus.

Style guidelines

All assignments should be readily readable, and should not presuppose that I already know what you are trying to say. Use full English sentences where appropriate (namely almost everywhere) and clear diagrams, programs, etc. Remember that your goal is to communicate clearly, and that the appearance of these technical items plays a role in this communication process. Be sure your assignments are always stapled together and that your name is always on them.

Accessibility

Please contact me immediately if you have a learning or physical disability requiring accommodation.

Syllabus

In the reading column, section 0 means the material at the beginning of a chapter before the first section. When a reading is indicated as going to a particular page number, it means up to the heading on that page. The same section number on the next class day then indicates to finish the section.

This is my best guess as to the rate at which we will cover material. However, don't be shocked if I have to pass out one or more revised syllabi.
DateReadingTopicDue
2/51.0-2.2Introduction, syntax definition
2/72.3-2.4Syntax-directed translation
2/82.5-2.6Your first compiler (a Thursday class)
2/9Lab 1: A First Compiler (a Friday lab)

2/123.0-3.1, 3.3, 3.5Lexical analysisHW 1
2/14Lexical-analyzer generators
2/15Lab 1 (continued)
2/164.0-4.2Context-free grammars

2/194.3Writing a grammarLab 1
2/214.4-p.188Top-down parsing
2/22Lab 2: Adding Variables
2/234.4More on predictive parsingHW 2

2/264.5, 4.7-p.220Bottom-up parsing
2/284.7-p.230SLR parser generation
3/1Lab 2 (continued)
3/24.7-p.240Canonical LR and LALR parser generation

3/54.8-p.251, 4.9Using ambiguous grammars; parser generatorsLab 2
3/75.0-5.3Syntax-directed definitions
3/8Abstract Syntax Trees (Lab 3 preview) (a Thursday class)
3/9Lab 3: Generating Better Code from ASTs (a Friday lab)

3/12Lab 3 (continued) (a Monday lab)HW 3
3/148.0-8.1Intermediate code
3/15Lab 3 (continued)
3/168.2-8.3, p.481Declarations and simple assignments

3/208.3Array access; type conversions (a Tuesday class)
3/218.4Control flow
3/22Lab 3 (continued)
3/236.0-6.4Type checkingLab 3

4/27.0-7.2Run-time environments
4/47.3Storage-allocation strategies
4/5Lab 4: Control Flow and Scoping
4/6Modern run-time environment issuesHW 4

4/99.0-9.3Code generation
4/119.4Basic blocks and flow graphs
4/12Lab 4 (continued)

4/1810.0-10.2OptimizationLab 4
4/19Lab 5: Procedures
4/2010.4Loops in flow graphs

4/2310.5Data-flow analysis
4/2510.6Iterative data-flow analysis
4/26Lab 5 (continued)
4/27Liveness analysisHW 5

4/30Lab 5 (continued) (a Monday lab)
5/2notesInterference graphs (11:30-12:00)
5/3More on register allocation (a Thursday class)
5/4Lab 5 (concludes) (a Friday lab)

5/7Lab 6: Wildcard Lab (a Monday lab)Lab 5
5/9notesSuppression of partial redundancy
5/10Lab 6 (continued)
5/11notesInstruction schedulingHW 6

5/14Lab 6 (concludes) (a Monday lab)
5/16Synthesis; evaluationLab 6


Course web site: http://www.gac.edu/~max/courses/S2001/MCS-388/
Instructor: Max Hailperin <max@gac.edu>