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


MCS-388 draws 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 also serve as the basis for compiler-writing projects. Topics include lexical and syntactic analysis, code generation, data-flow analysis, and optimization.

Office hours

I will be available in my office (OHS 306) 11:30-12:20 and 1:30-3:20 on Wednesdays as well as by appointment. Or try your luck: just stop by and see whether my door is open. You may send me electronic mail at or call me at 507-933-7466. I'll try to put any updates to my office hours on my web page, so check there if in doubt. Already I know that I won't be holding my regular office hours on March 6 and March 13.

World Wide Web

All course materials will be available through my World Wide Web page. The URL for this course is After this syllabus I will give hardcopy handouts only to those students who want them.


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 be to use that language. 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 less of a support network. I'll gladly accept labs written in any programming language.

Text and readings

Our primary text will be the "dragon book," i.e., Compilers: Principles Techniques and Tools by Alfred V. Aho, Monica S. Lam, Ravi Sethi, and Jeffrey D. Ullman, 2nd ed., 2007. When appropriate, I will also distribute supplemental reading.


Some days, shown in the schedule, we will spend the second half of our class time in the OHS 326 computer lab rather than in the usual classroom. Each lab assignment will generally require you to spend additional time out of class.


You are expected to be familiar with the college academic honesty honor code policy and to comply with that policy. In particular, any substantive contribution to your lab projects or homework solutions 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. If you have any questions about the policy, please ask.

Late assignments

All lab assignments are due at the beginning of class on the day indicated. (Exception: Lab 6 is due by the end of 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.

If you are too sick to complete an assignment on time, you will not be penalized. Simply label your assignment as late due to illness. 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.


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 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 hardcopy assignments are always stapled together and that your name is always on them.


Gustavus Adolphus College is committed to ensuring the full participation of all students in its programs. If you have a documented disability (or you think you may have a disability of any nature) and, as a result, need reasonable academic accommodation to participate in class, take tests or benefit from the College's services, then you should speak with the Disability Services Coordinator, for a confidential discussion of your needs and appropriate plans. Course requirements cannot be waived, but reasonable accommodations may be provided based on disability documentation and course outcomes. Accommodations cannot be made retroactively; therefore, to maximize your academic success at Gustavus, please contact Disability Services as early as possible. Disability Services ( is located in the Advising and Counseling Center.

Support for English Language Learners (ELL) and multilingual students is available via the College's ELL Support staff person, Andrew Grace ( or x7395). He can meet individually with students to consult about academic tasks and to help students seek other means of support. In addition, ELL and multilingual students can seek help from peer tutors in the Writing Center. Please let me know if there is any accommodation in the course that would enable you to more fully show your abilities; for example, I would consider allowing extra time on tests, as well as allowing a dictionary in an otherwise closed-book test.


The two topics or activities shown for each date correspond approximately to the two halves of the class period with a brief stretching break in between. However, we will divide the time to meet our needs rather than necessarily at the halfway point.

In the reading column, section 0 means the material at the beginning of a chapter before the first section. Similarly, subsection 0 means the material at the beginning of a section before the first subsection.

This is my best guess as to the rate at which we will cover material. However, don't be shocked if I have to revise the schedule.


2/142.2Syntax definition
2.3-2.4Syntax-directed translation

2/193.0-3.1, 3.3, 3.5Lexical analysis
Lab 1: Generating Code from ASTs

2/214.0-4.2Context-free grammarsHW 1
4.3Writing a grammar

2/264.4.0-4.4.3Top-down parsing
Lab 1 (continued)

2/284.4.4-4.4.5More on predictive parsing
4.5Bottom-up parsing

3/54.6SLR parser generationHW 2
Lab 1 (continued)

3/74.7.0-4.7.4Canonical LR and LALR parser generationLab 1
4.8-4.9Using ambiguous grammars; parser generators

3/125.0-5.4.3Syntax-directed definitions
Lab 2: Scanning and Parsing

3/14No class

3/196.0-6.2Intermediate codeHW 3
Lab 2 (continued)

3/216.3Types and declarations
Lab 2 (continued)

3/266.4, 6.5.2Array access; type conversionsLab 2
Lab 3: Adding Variables

3/286.6Control flowHW 4
Lab 3 (continued)

4/98.0-8.3Code generation
Lab 3 (continued)

4/11Preview of lab 4
Lab 3 (continued)

4/168.4Basic blocks and flow graphsLab 3
Lab 4: Control Flow and Scoping

Lab 4 (continued)

4/239.2Data-flow analysisHW 5
Lab 4 (continued)

4/25Data-flow analysis, continued
Lab 4 (continued)

4/30Preview of lab 5Lab 4
Lab 5: Procedures

5/29.5, notesPartial redundancy elimination
Lab 5 (continued)

5/79.3, notesFoundations of data-flow analysis
Lab 5 (continued)

5/9Hack 1-2Interference graphsHW 6
Lab 5 (continued)

5/14Hack 4.1-4.4Register allocationLab 5
Lab 6: Wildcard Lab

5/16Catch up
Lab 6 (continued)

5/21Synthesis and evaluation
Lab 6 (continued)

5/22Lab 6

Course web site:
Instructor: Max Hailperin <>