Skip to main content


  • In Spring 2021, this course may be taken either in-person (possibly hybrid depending on the lecture room size) or remotely. More signups should be available in the near future. If you have your heart set on being in the course, it should be possible to be in the class even if only remotely.
  • Frequently asked questions:
    1. I didn't enroll in the course in December. Can I still join the course? Almost certainly. You can add yourself to the course waitlist when the add/drop period begins (during Feb 2–5, depending on your year). Note that only CS students were allowed to enroll in 4000/5000-level courses during preregistration.
    2. When does CS 4121/5121 meet? At the same time as CS 4120/5120.
    3. Is there any difference between 4120 and 5120? The latter is for MEng students and requires a little more work on the project.
    4. Is this course going to be similar to last time? Yes.
    5. When will this course be offered next? It is planned to be offered next in Spring 2022, although this is not guaranteed. If not, it should be offered in Spring 2023.
  • The 2021 Compilers Bakeoff is complete.
  • Overview

    An introduction to the specification and implementation of modern compilers. Topics covered include lexical scanning, parsing, type checking, code generation and translation, an introduction to optimization, and compile-time and run-time support for modern programming languages.  As part of the course, students build a working compiler for an object-oriented language.

    Course information

    Course Staff

    Placeholder for staff

    The best way to reach the course staff is normally by posting on the discussion forum. We will be using Ed Discussions for this purpose. However, for private correspondence you can email individual staff members. Please do not ask multiple course staff members the same question privately via email; that just wastes our time. Piazza is normally the right way to ask questions about course content or assignments.


    Computer Science 3110 and either CS 3410 or 3420. The practicum (CS 4121 or 5121) is a required co-requisite. You may not take CS 4120 without taking CS 4121 too, and similarly for CS 5120 and CS 5121. The reason for this is that the group project is part of the grade for both 4120 and 4121. Familiarity with programming in Java is also expected.

    Most project groups choose to use Java to implement their compiler; however, other languages may be used with the permission of the instructor. It is strongly encouraged to use a language with a strong, static type system and automatic garbage collection.

    Course Meetings

    Lectures are MWF 3:45–4:35 in Martha Van Rensselaer Hall (MVR), room 1101. Seating will be assigned to students so they can attend at least two of the three lectures in person. Please consult the seating diagram for the room. On the day you can't attend, or if you are taking the class online, you should use the Zoom meeting.

    Recorded videos for lectures can also be found at the video channel for the course.


    You are required to read the course notes posted on the web site. These will often contain more detail than what was presented in lecture.

    There is no required textbook this semester, but the following textbooks will be helpful sources of information. All of these books will be available on reserve in Uris Library.

    • Modern Compiler Implementation in Java, 2nd ed. Andrew Appel and Jens Palsberg, Cambridge University Press, 2002. ISBN 0-521-82060-X.
    • Compilers—Principles, Techniques and Tools (The “Dragon Book”), 2nd ed. Alfred Aho, Monica Lam, Ravi Sethi and Jeffrey D. Ullman. Addison-Wesley, 2006. ISBN: 0-321-48681-1
    • Engineering a Compiler. Keith Cooper and Linda Torczon. Elsevier/Morgan Kaufmann, 2004. ISBN 1-55860-698-8.
    • Advanced Compiler Design and Implementation. Steve Muchnick. Morgan Kaufmann Publishers, 1997. ISBN 1-558-60320-4.

    The Java language specification may also be useful to you either online or in its printed form:

    • The Java Language Specification. James Gosling, Bill Joy, and Guy Steele. Addison-Wesley, 1996. ISBN 0-201-63451-1

    Another useful text, on linking and loading, is:

    Here are a couple of useful books on coding and software engineering:

    • Design Patterns: Elements of Reusable Object-Oriented Software. Gamma, Helm, Johnson, Vlissides, Booch. Addison-Wesley, 1995. ISBN 0-201-63361-2
    • Refactoring: Improving the Design of Existing Code. Martin Fowler. Addison-Wesley, 1999. ISBN 0-201-48567-2.


    Assignments and Grading

    There are four written homework assignments. You may discuss assignments with other students, but the work must be done on an individual basis. The names of any students you discussed the problems with must be recorded with the corresponding problems.

    The compiler project is divided up into seven programming assignments that are due at various points throughout the term. Compiler projects will be performed by groups of three or four students. The same groups will be maintained throughout the semester, if possible.

    Except in unusual circumstances, you will receive the same grade in CS 4120 and CS 4121 (resp. 5120 and 5121), and all members of a group will receive the same grade on programming assignments. Exceptions to these rules are dealt with on a case-by-case basis.

    Participation includes attending and participating in class (either in-person or remotely), asking good questions on the forum, answering questions on the forum, and filling out the course evaluation form.

    The breakdown of points per assignment is as follows:

    Homework: 15% Homework 1 4
    Homework 2 4
    Homework 3 3
    Homework 4 4
    Programming Assignments: 42% Programming assignment 1 5
    Programming assignment 2 6
    Programming assignment 3 6
    Programming assignment 4 7
    Programming assignment 5 8
    Programming assignment 6 10
    Exams: 40% Prelim 1 15
    Prelim 2 25
    Participation   3
    Total 100

    The weighted quadratic mean of these scores will be used to determine the final score in the course. The main effect of a quadratic mean is to make unusually low scores count for less and unusually high scores count for more. It usually affects the grades of at most a handful of students.

    Assignment late penalties:

    We are flexible about submitting assignments late. You will have six slip days that may be used during the semester to submit work without penalty. Using more than six slip days will lead to significant penalties on subsequent assignments. Any penalties applied will be on an individual basis. Weekends are considered to be a single day for the purpose of computing slip days.

    Slip day usage may be avoided or reduced by obtaining an extension on the assignment. Extension requests should be made via email; copying all group members on the request. They should include a description of why an extension is being requested. Extension requests based on foreseeable events will normally be denied; slip days exist to provide this scheduling flexibility.


    The prelims will cover material from the textbook, lectures, and homework assignments. Both prelims will be evening exams. There will be no final exam, but your final report and demo will be due on the first day of finals.

    Other components

    We expect you to participate in class and elsewhere. 2% of the score will be for class participation (in-class, Piazza, course evals) and for possible in-class pop quizzes.

    Academic Integrity

    The Cornell Code of Academic Integrity will be strictly enforced in this class. A Cornell student's submission of work for academic credit indicates that the work is the student's own. All outside assistance must be acknowledged, and students' academic position must be truthfully reported at all times. We take cheating and fraud very seriously.

    Placeholder for schedule


    Course notes

    Course notes for individual lectures and recitations can be found on the course schedule.

    Useful libraries

    Java language

    The default programming language for this course is Java, though some project groups may choose to use other programming languages. Java is a fairly good programming language for building a compiler. Its strong static typing, automatic garbage collection, and modular data abstraction are all very helpful when building complex software such as compilers. The tool support for Java is also excellent.

    • The Java API is very useful for learning how to use the many existing Java class libraries.

    • The Java Language Specification is helpful if you want to really understand how Java works.

    Brushing Up

    • For students with limited Java experience, we recommend the online notes from CS 1130, Transition to Object-oriented Programming as a refresher. This is a self-paced course consisting of several modules that you can go through at your leisure.

    • Review the introductory chapters in the textbook and the Java reference books listed on the course info page.

    • See Oracle's official Java Tutorial.

    • For students with C++ experience, see this comparison of C++ with Java.

    Computer Labs

    UGC Lab

    If you are taking this course, you should have access to the Undergraduate Computing lab (formerly known as the CSUG lab) on the ground floor of Upson. This can be a convenient place to work with your group.

    CIT Labs

    Cornell Information Technologies (CIT) runs several computer labs across campus for all members of the Cornell community. The JDK and Eclipse are installed on these machines. Check here for locations and times of operation.

    ACCEL Lab

    You can also find the course software in the Academic Computing Center (ACCEL), located in the Engineering Library in Carpenter Hall. Any CS student may register for an account.

    Support Services

    Academic Excellence Workshops

    The Academic Excellence Workshops (AEW) offer an opportunity for students to gain additional experience with course concepts in a cooperative learning environment. Research has shown that cooperative and collaborative methods promote higher grades, greater persistence, and deeper comprehension. The material presented in the workshop is at or above the level of the regular course. We do not require joining the AEW program, but do encourage students to join if they are seeking an exciting and fun way to learn. The AEW carries one S/U credit based on participation and attendance. The time commitment is two hours per week in the lab. No homework will be given. This is a wonderful opportunity for students to seek extra help on course topics in a small group setting.

    Your fellow undergraduate students, who are familiar with the course material, teach the sessions with material that they prepare. The course staff provide guidance and support but do not actually teach the AEW course content or any session. A representative from the AEW program will be speaking about the program and registration procedures in lecture.

    Your AEW liaison for this semester is Jason Zhao.

    See the AEW webpage for further information.

    Other Support Services

    Student Resources For Engineering Students This site has links to a variety of services.
    Free Computer Training CIT offers free computer training throughout the semester. Email for an appointment.
    Student Web Services This website collects services that are more general.
    Engineering Advising Academic advising for engineering students.
    Arts College Student Services A listing of general support services for a variety of concerns students may have.
    Tau Beta Pi Tau Beta Pi Engineering Honor Society Tutoring Program. The members of Tau Beta Pi are selected for their academic aptitude and social commitment. They hold one-on-one tutoring sessions with students in courses that typically have a large enrollment of engineers.
    Learning Styles Not everyone learns the same way. If you are curious about how you learn, check out this collection.
    Gannett The Cornell University Health Service Center. For all health related concerns.
    CAPS If you are experiencing emotional distress, we urge you to contact CAPS, the Counseling and Psychological Services.
    Dear Uncle Ezra When all else fails, ask Uncle Ezra!