CMSC 331: Introduction to Compiler Construction

Fall 2017

Doug Szajda

    Course Syllabus


  • Instructor: Doug Szajda, dszajda@richmond.edu, 219 Jepson Hall, (804)-287-6671 (campus ext. 6671).
  • Meeting Times:
    • Lecture: TR 12:00 - 1:15 pm, Jepson 231.
    • Consulting Lab: W 3:00 pm - 3:50 pm, Jepson G30.

  • Required Texts:
    • Compilers: Principles, Techniques, and Tools (2nd Edition) by A. Aho, M. Lam, R. Sethi, and J. Ullman.

  • Good Additional Resource:
    • Engineering a Compiler (2nd Edition) by K. Cooper and L. Torczon.

  • Office Hours: MW 10:15 am - 11:15 am, R 11:45 am - 12:30 pm. Other days and times by appointment.

    You are welcome to drop by my office at any time, but be aware that there will be occasions on which I will be unable to see students. Also, though I usually keep my office door open during office hours, at other times I may keep my door closed for either noise or climate control purposes. You should be sure to knock before concluding that I am not in my office!
  • Course Summary: This is a 1 unit course on compiler construction. We will focus on the principles of compiler design. Covered topics include lexical analysis, finite automata, parsing, type checking, runtime organization, code generation, and optimization. We will be reading primarily from the text, though an occasional primary source will be assigned. During the semester, we will, via programming assignments, be implementing a full compiler for the Cool language.

  • Pre-requisites: The pre-requisites for this course are CMSC 222 and CMSC 301 (Computer Architecture) or permission of the instructor. Students are expected to be able to implement significant projects in Java, and to be able to implement smaller projects in the MIPS assembly language. Regarding assembly code, I want to be clear: As you know from CS 301, writing assembly code can be tricky. Understanding it is usually less difficult. Because most compilers aim to create some form of assembly code, you will need to be comfortable creating and understanding such code.
  • Lectures: Notes for lectures will be posted prior to class on the course web site. I recommend that you make it a habit to download these notes before hand. Having the notes means less note taking on your part, which should allow you to better focus on the lectures (at least in theory).
    Also, please ask questions! I know that some of you are reluctant to do this, but often the alternative to asking questions is remaining confused, which is usually not a good outcome. Moreover, by asking questions you are helping your classmates and I be more efficient with our time. Every questions asked and answered in class meeting time is a question that I don't have to answer repeatedly during office hours. Also, your student colleagues who have the same question (it is almost guaranteed that there will be some) no longer have to make time to come to my office to have the question answered. It's a win-win situation.

  • Discussions: A portion of class meeting time will be spent on discussion. The intention is to help you think about the material that has been presented. Please do your best to be an active participant in this.
  • Attendance Policy:

    Regular attendance for the entire class time is expected! I began taking regular attendance in my classes about a year ago -- I've had too many students disappear for weeks on end in the past. Taking attendance nips that in the bud, so to speak. If you should miss a class due to illness, you are responsible for obtaining class notes! (That is, I will not give you a private encore of the lecture).


  • Labs:

    There is a laboratory component to this course, and you are expected to attend. Though we will not be doing CS 150 or CS 301 style labs, I intend to use the time to both have you work on your programming assignments (in an environment where I can help answer questions) and discuss questions about the written assignments.
  • Written Assignments:

    Written assignments must be completed using LaTeX! To be clear, I will not accept handwritten assignments or assignments generated from any other word processing system (such as Word). In the event that part of an assignment requires the generation of some graphic (e.g., a syntax tree), you may hand draw that portion and append it to the end of the assignment. Detailed instructions for homework submission will be discussed in class (we'll be using Box), but for now know that all written assignment submissions will consist of two files: your latex source file and the corresponding .pdf file generated from it.

    My reasons for requiring LaTeX are three fold: first, you are computer scientists and this is the system used to create many computer related documents. Second, using LaTeX requires more care than simply scrawling a few brief notes on a piece of paper. My hope is that this will spur some of you to spend a bit more time and show more care with your written assignments. Third, I'm old and cranky and just plain tired of trying to decipher some of the chicken scratch I receive on homework.
  • Grades:

    Grade Component Date Percent of Grade
    First Midterm Exam Distributed Thursday, October 5 20%
    Second Midterm Exam Distributed Tuesday, November 14 20%
    Written Assignments Avg. NA 15%
    Programming Assignments Avg. NA 20%
    Final Examination Tuesday, December 8 25%



  • Exams: The two midterm exams for this course will be open book, open note, take home exams. The final will be an in-class exam.

  • My "Managerial" Philosophy: I apologize for having to mention this, especially since you are almost all third or fourth years and thus do not need this clarification. Every once in a while, however, I encounter a student who tests the boundaries, and for that student, I like to have a few things in writing.

    My basic philosophy is this: You are adults. I treat you as if you are adults, and expect you to act as adults. For the 1 out of 100 students that does not understand what this means, here is a little clarification of some (though not all) of the ideals that this entails:
    • You begin assigned work in a timely manner (this includes reading).
    • You complete assigned work on time (this includes reading).
    • You complete assigned work and hand it in on time.
    • If an emergency arises (as they sometimes do) that precludes handing in work or taking an exam, you contact me before the work is due or before the exam begins, whichever applies.
    • You accept responsibility for your actions (and, as the case may be, your inactions).
    • Most important, just because some specific behavior is not mentioned here, that does not mean it's "OK" to engage in it. You know what reasonable expectations are for students, as do I. I treat you like adults and expect you'll act responsibly.


  • My ``exam discussion policy": Once a student has begun an exam, I will answer (for that student) only those questions that concern clarification of the intent of a problem. That is, I will not answer questions that seek to determine whether the problem was done correctly, or whether a particular approach is wise (or unwise).

  • The Other Student Criteria: When grading tests and homework, I use the Other Student Criteria (OSC). All solutions must meet this. The Other Student Criteria states that a solution should provide enough written explanation so that another student in the class (who could not complete the assignment) could read the submitted material and, without asking questions, understand a correct answer.
  • Collaborating on homework/programming assignments: Programming projects and homework may be discussed with others subject to the


    ``Empty Hands'' policy --- you may freely discuss ideas and approaches with other students subject to the restriction that each student must leave the discussion without any written or otherwise recorded material. In your homework write-up or source code, you must also document any person or source that you consulted for that project. Failure to comply with this policy will be treated as an Honor Code violation.

    One final note: some of the programming assignments for this semester may have been assigned in previous semesters (and at other universities). While you may consult previous UR class members concerning projects, you are not permitted, under any circumstances, to receive or view either hard copies or electronic copies of all or parts of their project submissions! Nor can you discuss assignments, or view materials of, students at any other institution. Moreover, you may not, under any circumstances, consult any external (e.g., non-UR) answer keys or solutions pages corresponding to any of the assignments unless I have explicitly given permission to the class to do so. Bottom line: You can use your UR friends to get help, but they should not be providing you with their code (just as in an English class, you might discuss the works of Dickens with a friend, but should not use the paper that they submitted as the basis for your own submission). Non-UR folks are not to be consulted for any reason.



  • Note: Many of the handouts, assignments, and presentation slides used in this course use material graciously provided to me by colleagues. I am particularly grateful to Professor Alex Aiken of Stanford University for generously allowing me to use his material as the basis for my material (including, in many cases, simply using his material word-for-word).

Last Modified:  15-Aug-2017 Contact: Doug Szajda
[an error occurred while processing this directive] [an error occurred while processing this directive]