CSE 504 Compiler Design

Spring 2009

Blackboard Course Description Grading Schedule Lecture Notes
Prerequisites Manuals Instructor and TA Texts Special needs Survival Tips

Course Objectives

Compilers and interpreters are among the most widely used tools in software development. It is important for a computer scientist to understand the process by which programs written in high-level languages are translated and executed. Among other things, this will help you write better programs, and enable you to make more effective use of available compiler technology. The main objective of this course is to gain an in-depth understanding of the compilation process.

An important side benefit of this course would be that you will gain significant experience in OO-programming with C++.

There is a misconception that ``compiler design'' is specialized, useful only if you work in a department that earns its living by writing compilers. In reality, lexical, syntactic and semantic analyses are an integral part of most large-scale systems that process non-trivial input. In addition, most large-scale systems support programmability using special-purpose macro or scripting languages. An understanding of the language translation process is hence critical for building such systems.

Course Description

In the class, we will discuss the theory and principles of developing compilers and interpreters. In the projects, you will then apply this theory (directly and indirectly) to develop a complete compiler for a high-level language. The problem of language translation is traditionally decomposed into many phases. Most common are:

All phases use a symbol table to keep track of the properties (types, number of parameters etc.) of each symbol (variables, procedures etc.). In the end, code is generated, which will be executed either directly by a machine (the so-called compiled-code approach) or by a software program that implements an "abstract machine" (the interpreter approach). Some languages (e.g., C) prefer the compiled-code approach due to its increased efficiency. Others (e.g., Java) prefer the interpreted approach due to its portability and flexibility.

The compiler will be written in C++. We don't expect that students already know C++ --- in fact, most students view this course as an opportunity to learn C++ at some level of depth. The structure and nature of a compiler makes it a natural candidate for learning OO-programming and appreciating its benefits.

We will use GNU g++ compiler on Linux, Solaris or within the cygwin environment for Windows. If you are unfamiliar with working in an UNIX environment, including the use of Makefiles and so on, then you should plan on spending some time in the first couple of weeks of the course to catch up.

To help you decide if you are ready for the course, the first programming assignment will be handed out in the first week of classes, and will be due within ten days. In this assignment, you will build a symbol table manager. This is a very simple assignment that exposes you to STL, but the more important learning experience will be in understanding how to work with C++ compilers, and their (at times obscure) error messages. Following this assignment, we will develop modules for each phase of compilation.


Schedule:

Lecture times: 3:50pm to 5:10pm on Mon, Wed.
Lecture location: The official meeting place is Earth and Space Rm 079.
But some meetings (including the first one) will be held at CS Building Rm 2311.
Mid-term:
Spring Break:April 6--10
Last lecture:May 6, Wednesday
Final Exam:May 18, Monday 5pm to 7:30pm

Lecture Notes:


Instructor:

R. Sekar
Office: 2313E Computer Science
Office Hours: Mon-Wed 2:00pm to 3:30pm

TAs:

Alok Tongaonkar
The TA works on a part-time basis and will not be holding office hours. Students should instead go to the instructor's office hours.


Texts:

We will use the latest edition of the "Dragon book". Compilers: Principles, Techniques, and Tools, Second Edition by Aho, Sethi, Ullman, and Lam. Addison-Wesley


Grading

The weightage for programming assignments, midterm and final exams will be as follows.

You are advised to start working on the projects at the earliest possible time even if the deadlines are far away. The date the projects are due will be clearly specified. Projects are due by 11:59pm on the specified date. Late projects will be penalized at the rate of 5% for the first day, 15% the second day and 25% per day after that. So, there is no point submitting a project more than 4 days late! No further extensions will be allowed.

Any form of copying in the course, and all forms of academic dishonesty, are considered serious offenses, and will be prosecuted to the maximum extent permitted by university policies.The minimum penalty for any form of copying, whether from your friends, the Internet or outside sources, or from previous offerings of the course, will be an F-grade.


Prerequisites

Official prerequisites are CSE 304 and 307. I am usually willing to allow students that do not have one of these prerequisites, as long as I can be satisfied about their programming background. If you have only one of these prerequisites, please do come an talk to me so that I can sign any permission slips that you may need.


Manuals for Compiler Tools

The following manuals are available online. These manuals are linked from GNU documentation site.


Special Needs

If you have a physical, psychological, medical or learning disability that may impact on your ability to carry out assigned course work, I would urge that you contact the staff in the Disabled Student Services office (DSS), in the ECC building (where the Computer Store used to be), 632-6748v/TDD. DSS will review your concerns and determine, with you, what accommodations are necessary and appropriate. All information and documentation of disability is confidential.


Survival Tips