Princeton University
Computer Science Department

Computer Science 320
Compiling Techniques

Lennart Beringer

Spring 2016

Schedule and Readings | Assignments | Lecture Notes

Course Summary

Understand the design and construction of compilers. Concepts include syntactical analysis, semantics, code generation, optimization, and run-time systems. Problems in processing imperative languages, such as C, as well as functional languages such as ML, will be examined. A complete compiler for a small language will be implemented in ML.

Prerequisites: 217 and 226.


2/28 - Some old midterm and final exams (in some cases with solutions) are here.

Administrative Information

Lectures: TTh 3:00-4:20pm, Room: Computer Science 104
Instructor: Lennart Beringer
Teaching Assistant (programming assignments): Kringelbach, Mikkel (mikkelk@cs...)
Piazza: We will set up a Piazza site for the class here.

Required Texts:
Recommended Texts:


Install SML/NJ on your computer. The most recent version is SML/NJ version 110.79 although any version younger than (and including) 110.67 should be fine. Follow the instructions on this page.

You may find it useful to run SML under emacs. This will let you take advantage of rudimentary support for automatic indentation, syntax-highlighting, and special keybindings. Details.

Documentation: Source code useful for the programming assignments is available on the Web.


Your grade will be calculated as follows (with adjustment for quizzes and participation):


There will be a midterm exam covering the material of first six weeks and a final exam for which material from the entire course is in scope. The exercises at the end of each chapter of Modern Compiler Implementation in ML are representative of the questions that will appear on the exam. We will also make other representative questions available nearer to the exams. The best way to study for the exams is to do these exercises.


There will be 9 programming assignments, released successively at the assignments page. Submission will be via dropbox, with deadlines generally on Mondays at 9:00 pm.

Unless announced otherwise, all assignments are non-collaborative. Programming, like composition, is an individual creative process. Individuals must reach their own understanding of the problem and discover a path to its solution. During this time, discussions with friends are encouraged. However, when the time comes to write the code that solves the problem, such discussions are no longer appropriate - the program must be your own work (although you may ask teaching assistant for help in debugging). If you have a question about how to use some feature of C, UNIX, ML, etc., then you can certainly ask your friends or the teaching assistant.

Do not, under any circumstances, copy another person's program, and don't make your code available to others. Writing code for use by another or using somone else's code in any form violates the University's academic regulations.

You can get help with the assignments by sending electronic mail to cos320 or directly to the TA, by posting questions to Piazza, by coming to the office hours, or by making an appointment with the instructors. Ask for help when you need it!

The late policy is to encourage submissions that are on-time. Any project can be late for up to 2 days without penalty. Up to 6 days total may be used for the assignments HW 1 to HW6, so use your late days wisely. After 2 days, zero credit is given for the assignment. The lateness policy for the assignments 7 to 9 will be announced at a later time.

There will be no extensions due to scheduling conflicts, computer downtime, or other such factors, except under truly extraordinary circumstances. Extensions will be granted only for university-sanctioned excuses such as illness, and then only with the proper documentation. You are responsible for planning ahead and managing your time so that you can complete the assignments on time. You must either finish on time or accept the consequences of doing otherwise.

Penalties are waived only for unforeseen circumstances, like illness, and then only with an appropriate written excuse.

Submitting Programming Assignments

Submit your solutions to the programming assignments electronically using dropbox. Details will be provided for each assignment. Each submission will be required to contain a README file in which you should briefly explain any significant design or implementation choices, and mention the kind of help you gave or received.