This course introduces students to the design and implementation of compilers for programming languages. Specifically, students will learn how to systematically translate modern, high-level, programming languages into efficient, executable machine code.
The course introduces a number of important concepts, such as parsing and program analysis that are useful in many other contexts beyond compilers, such as software engineering and security. Perhaps the most useful outcome of the course is that students will deeply understand the capabilities and limitations of modern compilers, and how they can be used most effectively. This knowledge is important for aspiring language designers and implementors, but also for debugging and optimizing just about any application.
This course is extremely programming intensive, as most of the understanding comes from constructing (small) compilers.
Computer Science 51 or Computer Science 61. (Ideally, both CS51 and CS61.) Students should be comfortable programming in OCaml. Note that this is a programming-intensive course: some weeks may require tens of hours of programming.
You can try the self assessment to help figure out whether you are adequately prepared. Also, the first homework assignment (released in the first week) is designed to help get you up to speed in programming in OCaml.
Time and Place
Tuesdays and Thursdays, 12:00pm-1:15pm, room Maxwell Dworkin G125.
- Instructor: Stephen Chong
- Teaching Fellows:
- Nenya Edjah
- Michael Horton
- Teddy Liu
- Zach Yedidia
All questions and issues related to assignments, course content, etc., should be posted to Piazza. Questions related to grades, special consideration, etc. can be sent directly to Prof. Chong. In general, sending email to individual course staff will delay a response. Note that course staff may take up to 48 hours to respond.
Homeworks, exams, and grading
There will be a final exam on Thursday December 19, 9am-12pm (location TBD). Extension school students will take the same exam, during a 24-hour window starting Thursday December 19 9am EST. There are no midterm exams. There will be ~6 projects during the semester. The exact number and timing will be determined later.
Your grade will be determined by a weighted average of your scores on projects, the final exam, and class participation. The percentage breakdown (roughly and subject to change) is 75% projects (including ~1% for the Embedded EthiCS homework), 20% final exam, and 5% participation (which includes attendance and participation in class and office hours, and contributing to online discussion).
The textbook "Modern Compiler Implementaton in ML" by Andrew W. Appel is recommended but not required. In most cases, the class materials should suffice. The instructor will provide the lecture slides after the lecture (or before if they are ready in time).
Embedded EthiCS Module
Ethical reasoning is an essential skill for today's computer scientists. At Harvard Computer Science, we teach ethical reasoning by integrating ethics modules into courses throughout our curriculum. These modules are part of the Embedded EthiCS program, a collaborative effort by Computer Science and the Philosophy Department. The module for this course will focus on an ethical issue raised by the technical material for the course, and will be developed by a graduate or postdoctoral fellow in Philosophy working in collaboration with course faculty and postdoctoral fellows in Computer Science. Among other things, Embedded EthiCS modules teach students to:
- Identify and anticipate ethical and social issues in their work.
- Think clearly about those issues, both alone and collaboratively.
- Communicate their understanding of those issues effectively.
- Design systems that take into account ethical and social concerns.
CS153 will have an Embedded EthiCS module. The date for the module will be announced shortly; all students are expected to attend. The module will consist of one or two class sessions, together with an assignment that will constitute part of your grade for the course. You can learn more about Embedded EthiCS at the program's website: https://embeddedethics.seas.harvard.edu/.
See here for more information.
Office hours are managed via a Google calendar, shown here:
There will be ~6 projects in this course, mostly involve implementing parts of a compiler. Implementation will be in OCaml, and we assume that students are comfortable with programming in OCaml. See the schedule for the timing of the projects.
Projects are done individually: you must write all your own code. Do not share code with others (including letting others look at your code), do not accept code from others, and do not look for code online. However, you are encouraged to talk about the project with others, to share ideas and thoughts. All students should respect the Harvard academic integrity policy and the course collaboration policy below.
There may be opportunity for extra credit by augmenting your compilers (or the language we're compiling) with new features or optimizations. However, a word of warning: the extra credit only applies if the rest of the compiler is working.
Plan ahead and get the work done. We will not accept submissions that do not type-check and compile. See below for the late-minute and extension policy.
Diversity and Inclusion*
I would like to create a learning environment that supports a diversity of thoughts, perspectives and experiences, and honors your identities (including race, gender, class, sexuality, religion, ability, etc.) To help accomplish this:
- If you have a name and/or set of pronouns that differ from those that appear in your official Harvard records, please let me know!
- If you feel like your performance in the class is being impacted by your experiences outside of class, please don't hesitate to come and talk with me. I want to be a resource for you. If you prefer to speak with someone outside of the course, members of the SEAS Committee on Diversity, Inclusion, and Belonging are excellent resources.
- I (like many people) am still in the process of learning about diverse perspectives and identities. If something was said (by anyone) in class, office hours, Piazza, or project group work that made you feel uncomfortable, please talk to me about it.
- As a participant in course discussions, office hours, and group projects, you should also strive to honor the diversity of your classmates.
If you ever are struggling and just need someone to talk to, feel free to stop by office hours, or to reach out to me and we can arrange a private meeting.
Your success in this class is important to me. We will all need accommodations because we all learn differently. If there are aspects of this course that prevent you from learning or exclude you, please let me know as soon as possible. Together we'll develop strategies to meet both your needs and the requirements of the course.
I encourage you to visit the Accessible Education Office to determine how you could improve your learning as well. If you need official accommodations, you have a right to have these met. There are also a range of resources on campus. The Bureau of Study Counsel provides many resources, including academic counseling and peer tutors. (Extension School students, please see this page for more information.)
If you have a letter from the Accessible Education Office, please try to get that to me earlier rather than later. Concretely, please try to give it to me by the end of the second week of classes.
If you experience significant stress or worry, changes in mood, or problems eating or sleeping this semester, whether because of CS15 or other courses or factors, please do not hesitate to reach out immediately, at any hour, to any of the course staff to discuss. Everyone can benefit from support during challenging times. Not only are we happy to listen and make accommodations with deadlines as needed, we can also refer you to additional support structures on campus, including, but not limited to:
- Counseling and Mental Health Services, 617-495-2042 or 617-495-5711 after hours
- Let's Talk
- Room 13, 617-495-4969
We do not require that students purchase any books, hardware, or software. While not required, having one's own laptop is helpful. Students without their own laptops are encouraged to reach out at the start of the course to discuss possibilities.
Late minutes, Penalties, and Extensions
Each student has 14,400 "late minutes" (which is the number of minutes in 10 days) which can be applied to any of the projects. A late minute extends the due date/time by 1 minute. At most 4,320 late minutes (= 3 days) can be used on any single project. (This allows us to grade your projects and return them to you within a reasonable period.)
Late minutes are intended to help you manage your time effectively. They are not meant to be a substitute for starting projects early.
Late minutes are not meant to be used for health issues (including mental health issues), family emergencies or other extenuating circumstances. In those situations, please contact Prof Chong, or have your senior tutor do so.
I try to be explicit about the expectations I have of students enrolled in this course. If you have any questions or concerns about what is expected of you, please get in touch!
- Attendance: You are not required to attend lecture. However, you are expected to stay up to date on the course material, either by attending lecture, by reading the lecture notes, and/or by watching the lecture video. If you normally attend lecture in person, and won't be able to (say due to illness or another commitment) you are welcome to write to me and let me know, but you don't have to do so.
- Devices in Class: I appreciate that different people learn differently. For some students, using a device in class can be an effective learning aid (for example, to take notes). However, for many students, laptops and smart phones are a distraction. I encourage you to bring or use electronic devices with you to class only if you think it will improve your learning. We will have part of the lecture room reserved to be device free.
- Preparation for Lectures: You are not required to do any preparation before lecture. However, depending on how you best learn, you may find it useful to look at the lecture notes before class. Prof. Chong will try to make the lecture notes available the day before lecture.
- Office Hours: You should come to office
hours, both of Prof. Chong and of the Teaching Fellows!
Office hours are a great opportunity to participate in the
course and get to know course staff and other students!
You don't need to do much or any preparation to attend office hours. You are welcome to ask any kind of question: about understanding the material covered in lecture or in projects, about extensions to the ideas presented in the course, about how the material applies beyond the course, etc. You are welcome to work on your project during office hours, but note that course staff may need to attend to other students during the office hours and may not be able to help you debug your code.
Office hours in this course are drop-in: you do not need to make an appointment, it is fine to just show up.
If you would like to attend office hours but can't, please let us know! We can attempt to adjust our office hours, or to arrange a separate time to meet.
- Course Participation: 5% of the total grade is based on your participation in the course. That is, your engagement with the course material, and the students and staff in the course. You can demonstrate your participation in many ways: attend office hours, ask or answer questions on Piazza (which might be about comprehension of material, extensions of the material we cover in class, how what we study in the course applies more broadly, ...), attend lecture and ask questions in class, try extra credit parts of projects, ...
- Seeking help: If you find that you are struggling with understanding the material, or do not have enough time to spend on this course, or if there is anything going on in your life that is affecting your engagement with the course, please get in touch. We would rather hear from you early and often than only hear from you when you are in crisis.
- Projects and Extensions: You are
responsible for managing your time as you work on the
projects. We encourage you to start early on your projects:
there is high variance in the amount of time it takes
students to complete these projects, and projects often take
longer than you anticipate.
Each student has a number of late minutes that can be used for projects. These are designed to help you manage your other deadlines and commitments by providing you with flexibility. They are not meant to be used for exceptional circumstances: if you have a health issue (including mental health), a family emergency, or any other exceptional circumstance, please contact the course staff and we may be able to arrange accommodations.
- Collaboration: See below for the Collaboration Policy.
Discussion and the exchange of ideas are essential to doing academic work. For projects in this course, you are encouraged to consult with your classmates as you work on projects. However, after discussions with peers, make sure that you can work through the problem yourself and ensure that any answers you submit for evaluation are the result only of your efforts. In addition, you must cite any books, articles, websites, lectures, etc that have helped you with your work using appropriate citation practices. Similarly, you must list the names of students with whom you have collaborated on problems.
Do not pass solutions to problem sets nor accept them from another student. For programming projects, this means do not share code. Do not post course materials (including problem sets, solutions, exams, etc.) to websites (including public GitHub repositories, and similar) or course-content archives. Also, it is never okay to look up solutions to homework problems in this class, i.e., don't look on the web for solutions.
You can definitely engage in "high level" discussions with your peers, for example, about the problem statement. You can definitely engage in "low level" discussions with your peers, for example, about OCaml syntax and libraries, compiler error messages, etc. "Mid level" discussions require discretion and should be limited in this course.
If you are ever in doubt, ask the course staff to clarify what is and isn't appropriate.