Princeton University
Computer Science Dept.

Computer Science 320
Compiling Techniques

Professor David August

Spring 2002

Directory
Schedule and Readings | Assignments | Lecture Notes | Course Newsgroup | Links

Course Summary

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

In as much as time allows at the end of the semester, this course will explore a recent trend in uniprocessor computing - increased reliance on sophisticated back-end compilation. The compiler, no longer just a consideration in instruction-set architecture design, has become the driving factor behind many architectural innovations. These include explicit ILP, predication, speculation, and various forms of prediction.

Prerequisites: 217 and 226.


Announcements

2/20 - Assignment 2 now due 2/22 at 11:59PM.

Special Project


Administrative Information

Lectures: TTh 3:00-4:20pm, Room: 103
Professor: David August
Teaching Assistant (director of programming assignments): Yaoping Ruan
Undergraduate Coordinator: Tina McCoy

Required Texts:

Computers

You will be using Sparc machines:

Software

  1. Put /u/cs320/ml in your search path; your .cshrc file might look like this:
            set path=(. /u/cs320/ml ....)
        
  2. Run sml to start the ML session. During such a session run CM.make(); to compile.
  3. 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.

Grading

Your grade will be calculated as follows:

The final exam is worth twice as much as the midterm.

The advanced project is optional.

Exams

There will be a midterm exam and a final exam. 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. The best way to study for the exams is to do these exercises.


Assignments

There will be about 10 weekly programming assignments. These assignments are described in Modern Compiler Implementation in ML and in these Web pages: 1 2 3 4 5 6-9 10 and are (mostly) due Mondays at 11:59pm. You can get help with the assignments by sending electronic mail to cs320 or directly to the teaching assistant (see above), posting questions to the pu.cs.320 newsgroup, or by calling or visiting Professor August or the teaching assistant. Ask for help when you need it!

The late policy is to encourage submissions that are on-time. Therefore, you will lose 30% credit on the first day and 10% for each additional day late. This means that all credit is lost after 11:59pm on the next Monday after the due date.

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.

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 assistants 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 assistants.

Do not, under any circumstances, copy another person's program. Writing code for use by another or using another code in any form violates the University's academic regulations.

Submitting Programming Assignments

Submit your solutions to the programming assignments electronically using the following command.
/u/cs320/bin/submit number files
number is the assignment number and files is the list of files for that assignment. For example,
/u/cs320/bin/submit 12 README regalloc.sml
submits the files README, and regalloc.sml for the assignment described in chapter 12.

The submit command copies your files to the directory /u/cs320/submit/login/number and lists all the files that you have submitted for assignment number. login is your user account name. If you execute submit after the assignment deadline, your files are placed in directory number-late. You can run submit more than once, and you can submit partial lists of files.




There's also unsubmit, which allows you to `unsubmit' one or more files. For example,

/u/cs320/bin/unsubmit 31 main.c
would remove your main.c from the submission directory.

You can omit the /u/cs320/bin/ prefix if you add /u/cs320/bin/ to your PATH variable.

Keeping in Touch

The best way to contact Professor August or the teaching assistant is by electronic mail.

Also, pu.cs.320 is a local newsgroup specifically for COS 320. You should read the articles in this group as they appear for important information, such as clarifications and hints on the assignments, last minute schedule changes, new software, etc. You can use a web browser to browse pu.cs.320, or you can use rn to read unread news. To use rn, make sure that /usr/princeton/bin is in your PATH. To view unread articles in pu.cs.320, type

rn pu.cs.320
`man rn' displays the (very long) man page for rn. (The first time you run rn, it'll display a brief introduction to its use.)

If you add the line

rn -c pu.cs.320 
to your .login file, you'll be advised of unread articles in pu.cs.320 each time you log in. To post an article, type `Pnews pu.cs.320' and follow the instructions; you can also post replies to articles from within rn; see the man pages for details.