COP 5621 -- Compiler Construction

Fall 2002

Mondays and Wednesdays, 2:00-3:15, ECS 132



Course Description

In this course, we will study the technology underlying modern compilers. The course will be centered on the development of a compiler for a language called Tiger. Tiger is a small language designed especially for a student compiler project, but it is quite expressive and interesting. Your compilers will be written in Java, using tools similar to the well-known Unix tools lex and yacc for lexical analysis and parsing, respectively. Your compilers will have a sophisticated "back end" to generate good SPARC assembly language code.

Given that one is unlikely ever to write a real compiler, what is the value of taking this course? There are a number of answers:

  1. Even if you're never going to write a compiler, you do (as a programmer) interact with compilers all the time. It is therefore beneficial to have a deeper understanding of what goes on inside a compiler.
  2. Learning about compilers gives one a deeper understanding of the "guts" of programming languages, and a better understanding of (for example) performance issues.
  3. Modern compilers are written using broadly useful technologies like lex and yacc, which can be used in a variety of text-processing applications.
  4. Compilers are large and complex. For this reason, writing a compiler is an excellent testbed for software engineering approaches. In particular, we will have a chance to gain insight into the strengths and weaknesses of Java's linguistic support for well-structured software.

We will try to cover Part I (chapters 1 through 12) of Appel's book, more or less completely.

Computing Environment

The compiler project will be written in Java under UNIX. You will be using the workstations in the SCS Grad Lab (ECS 256) to telnet to the SPARC server (Note that you can connect to goliath from Windows NT machines by using Xwin32.) You will get accounts for the Grad Lab automatically, and you will be able to get a key by seeing the graduate secretary, Maria Monteagudo. If you have trouble with your account, you can see the help staff at the JCCL (ECS 241) or ExLab (ECS 281). If you are new to UNIX, you should spend some time soon looking at the UNIX documentation at

Note that to access Java, JLex, and CUP, you need to set some environment variables. To do this, please add the following lines to your .cshrc file:

  setenv JAVA_HOME /depot/J2SE-1.4
  setenv CLASSPATH "/homes/smithg/javatools:."
Also note that I will be providing you with skeleton files to help you with the compiler project; these files will be accessed at /homes/smithg/javatools/tiger/.

Mailing List

A mailing list, cop5621, has been established to allow you to post questions and carry on discussions. To subscribe, send email to with message body subscribe cop5621. Then you can post messages by mailing to Note that you can improve your class participation score by being helpful on the mailing list!


Grades in this course will be based on a midterm exam and on programming assignments that culminate in the compiler. For the compiler project, you will work in groups of two or three. In lieu of a final exam, you will present your finished compilers to me at the end of the semester.
Compiler project 70%
Midterm Exam 20%
Class Participation10%

Programs will be scored on a 5-point scale:

5: basically perfect
4: mostly fine, some small deficiencies
3: some significant deficiencies
2: major deficiencies, but on the right track
1: hopeless

Academic Integrity

I expect you to maintain a high level of academic integrity in this course. The basic principle to follow is that the work that you submit should be the result of your group's own effort. It is definitely not acceptable to copy code from other groups, books, or from the Web. Furthermore, if you get help from other sources, please be generous in citing them.


I will grant incompletes only in extreme circumstances, such as medical emergencies.


I expect you to attend class regularly and promptly, and to participate in discussions. Please don't be shy about asking questions--if something is unclear to you, it is probably unclear to others as well.

Back to COP 5621 home page.