Spring 2022

CS 132: Compiler Design

TTh 9:35am–10:50am in MCSC 325

Syllabus

A syllabus describes the purpose of a course and what you will learn from it. A syllabus also often provides lots of details such as course policies and how grading works.

All policies in this syllabus are subject to change if there is a compelling academic justification. I will announce any changes, and I don't expect that there will be many.

Overview

This course is about the design and implementation of compilers—a piece of software that translates one computer language to another. Topics include elegant theoretical results that underlie compilation techniques, practical issues for implementing programming languages efficiently, and low-level interactions with operating systems and architectures. Over the course of the semester, we will build a working compiler for a strongly typed, object-oriented language.

By the end of this course, you will:

  • Understand the major theory and systems issues that inform how we implement a compiler (including parsing, intermediate representations, analysis and optimization, and code generation.
  • Apply these ideas in practice by building a working compiler for a small but realistic programming language.
  • Acquire skills and tools that will be useful to you in the future, even if you never work on another compiler.

Your rights

Basic needs

Before you can learn, all your basic human needs must be met. Your physical and mental health are more important than whatever is going on in class.

If you aren't feeling well, please take care of yourself (and possibly others) by staying home from class. If you think you will be unwell for awhile, contact your Academic Dean to let them know. Typically, a Dean will then contact me to arrange flexibility for our course, if necessary. If you feel comfortable doing so, please also contact me directly. You don't need to tell me any personal details if you don't want to, you can just let me know that you're in touch with a Dean about getting some flexibility for the course.

Your rights as a student

My goal is to create a learning environment that is accessible, equitable, inclusive, and welcoming. If facets of the instruction or design of this course result in barriers to inclusion—either to an individual or a specific group—please let me know as soon as possible. If for any reason you don't feel like talking to me, please feel free to contact the HMC Dean of Faculty, the Dean of Students, or the Academic Deans, depending on whom you feel most comfortable contacting.

Resources

Here are a few things you will need for CS 132.

Accounts

Gradescope:
You will turn in assignments and take exams on Gradescope.
GitHub:
A GitHub account, to receive the starter code for the assignments and to keep track of your work.

Software

Docker:
We will use Docker to create a development environment. I will provide a Docker image that contains a Linux-based, Haskell-enabled system in which we will develop our compilers. (This system is similar to the one you probably used in CS 131, if you took it at Mudd.)
VS Code:
Visual Studio Code is the supported text editor for CS 132. Download the latest version of the editor, and install the Remote Containers extension. If you would like to collaborate remotely with a partner, the Live Share extension is useful.

Books

There are no required textbooks for the course, but I may point out some helpful resources along the way.

Classroom materials

For class, you will want to bring something to take notes with (for example, pencil and paper). We may occasionally use computers and / or an electronic device that can access the internet.

Office hours

I will hold regular office hours. These are scheduled times each week when you can talk with me about the course and the assignments. Please join me! I hope and expect that office hours will be an important and useful part of your time in this course.

Coursework and grading

In CS 132, we combine several forms of learning. There are many ways to succeed in CS 132, and I hope that a good grade is the byproduct of lots of learning. There is a lot of information about coursework and grading in this section—maybe more than you want to know right now. I'm including all this information so that it's easier for you to keep track of your learning and your grades throughout the semester. For now, you might want to briefly skim this section for any questions you might have, then return to it throughout the semester.

Coursework

There are several kinds of work we will do this semester. Some of it is graded, some of it is not.

Assignments.

There will be approximately nine graded assignments. The assignments help you directly apply skills and concepts we learn in class. Most of the points will come from the autograder (alas, we do not have any grutors for this course). You can expect to spend about 6 hours each week on assignments. Occasionally, you may spend more. If you come to office hours, I can usually help you be more efficient.

Reflections.

There will be a weekly reflections that asks you to reflect a bit on the topics from that week. Expect to spend about 30 minutes each week on the reflection.

Exams

There will be on graded exam. The exam help you think about and demonstrate a deeper understand of the topics and connections among topics that you are asked to do on an assignment. The date for the exam is posted on the course website.

Project

We will end the semester with a small project that builds on the themes of the course. I will provide a set of possible projects for you to choose from, and you can also suggest your own project. I hope that you will be able to combine your experiences and interests with the themes of the course, to work on something that is exciting to you. You can expect to spend about 15 total hours on the project, over about 2.5 weeks.

Deadline policy

Deadlines are useful because they put limits on our time: They let us know how much time to set aside for something, and they let us know when we need to move on :). However, deadlines can sometimes be punitive: If we need some flexibility in our lives (for example, to accommodate a particularly busy week), a deadline might prevent us from doing our best work.

I try to strike a balance between setting deadlines that move us along, while also providing flexibility when you need it. Here is the default, built-in flexibility we have for deadlines in our course:

  • Assignments. You have an automatic 24-hour extension on all assignments. You do not need to ask me for it or let me know that you plan to use it. I will configure Gradescope so that it accounts for this automatic extension. If an assignment has multiple parts, you can use the extension on any and all parts. Your grade will not be affected if you use an extension.
  • Reflections. Reflections are due with assignments and have the same 24-hour extension policy.
  • Exam. The take-home exam will be available to you for approximately a week. You can choose to take the exam at any point during that week. The exam is due by the deadline. I will configure Gradescope with any accommodation you have for extra time on an exam. Be sure to leave enough time before the exam due date to take the exam.
  • Projects. The final project will be due on the official last day of classes. This due date is firm because any later date encroaches on finals. There will be one intermediate project deadline, which will have the same automatic extension as assignments.

I want to emphasize that this is the default deadline policy, which has some built-in flexibility that I hope is useful to you. If you need more flexibility (for example, if you have an extended illness or injury), please let me know. The best thing to do is to contact me and possibly an Academic Dean. We will work together to support you.

Grading

I believe that grades should support and measure your learning and not measure other things, such as whether you got sick for a few days during the semester.

With these things in mind, I have designed a point-based grading scheme for this course. As the semester progresses, you will accumulate points as you accumulate knowledge. At the end of the semester, your total number of points will determine your grade.

There are 1,500 total points available, distributed as follows:

Category Points
Assignments 900
Exam 150
Reflections 150
Project 300

At the end of the semester, points correspond to letter grades as follows:

Minimum Points Grade
1395 A
1350 A-
1305 B+
1245 B
1200 B-
1155 C+
1095 C
1050 C-
1005 D+
945 D
900 D-
0 F

Collaboration

I hope and expect that you will work with others in the class, throughout the semester. Here is how collaboration works in CS 132.

Partnering on assignments

Unless otherwise specified, you can work with one other person on an assignment. If the assignment has multiple parts, you should work on all the parts together. Although you must keep the same partner for an entire assignment, you can work with a new partner on the next assignment.

When you work with a partner, the two of you should do all the work together, at the same time. You cannot split up the work and do parts of it separately. Your work should be the result of an equal contribution from both people. Doing otherwise is against the Honor Code and will likely result in a loss of points for both partners.

If you and your partner are working on a problem that involves programming, you should attempt to pair-program in the following way:

  • Choose one person to be the “driver” who controls the keyboard and mouse. The other is the “navigator” who observes, asks questions, suggests solutions, and thinks about slightly longer-term strategies.
  • Switch roles every 30 minutes or so.
  • Again, you must both work on the code together. It is not permissible for one member of the pair to work on the code while their partner is not there participating actively.

Honor Code

Whether you work individually or as a pair, you are always welcome and encouraged to discuss approaches to solving homework problems with any classmate or Prof. Ben. An important rule is: You may not share any written or typed materials of any kind. In particular, you may not send or receive solutions that is related to this course by e-mail, on the web, from another person’s file or printout, or in any other form.

In short: you should conduct yourself in accordance with the Harvey Mudd Honor Code. If you have any questions, ask Prof. Ben.

Course and college policies

Academic accommodations

You have a right to accommodations for temporary or permanent disabilities. I have done my best to design this course to be accessible, following accessibility guidelines for all materials. I have also built flexibility into due dates. If you have a disability (including mental health and chronic or temporary medical conditions) and if you may need some accommodation in order to fully participate in this class, please contact your home institution's, if you have not already done so.

The Claremont Colleges also has a Student Disability Resources Center (SDRC), which provides many resources for students, including an assistive technology loan program.

Social engagement

The mission of Harvey Mudd College is to prepare leaders who understand the impact of their work on society. Our institution is a vibrant part of that society, and we might be affected by the pandemic, by the violence in our world, and by the tumult of politics. I understand that you may wish to take part in civic engagement, and I want to accommodate your reasonable participation in such events. It works best if you can coordinate with me in advance, ideally at least 24 hours before any affected due dates.

Title IX

Harvey Mudd College is committed to providing an environment free of all forms of discrimination and sexual harassment, including sexual assault, domestic violence, dating violence, and stalking. If you or someone you know has experienced or experiences any of these incidents, know that you are not alone.

Please be aware that many HMC employees, including all faculty members, are considered Responsible Employees who are required to relay any information or reports of sexual misconduct they receive to the Title IX Coordinator. This means that if you tell us about a situation involving sexual harassment, sexual assault, dating violence, domestic violence, or stalking, we must report the information to the Title IX Coordinator. Although we have to report the situation, you will still have options about how your case will be handled, including whether or not you wish to pursue a formal complaint. We want to make sure you are aware of the range of options available to you and have access to the resources you need.

If you wish to speak to someone confidentially, you can contact any of the following on-campus resources, who are not required to report the incident to the Title IX Coordinator: (1) the EmPOWER Center (909.607.2689), the Monsour Counseling Center (909.621.8202), and the McAlister Chaplains (909.621.8685). Additional information about your options is also available at www.hmc.edu/tix.