CSE401 Project Description

This class includes a substantial implementation project. You will modify and extend an existing compiler, written in C++, for a toy language called PL/0. PL/0 is like a severely stripped-down version of Pascal. Initially, PL/0 is barely usable as a programing language. As part of the project, you will add several language features, including arrays, for loops, and arguments and results of procedures, making the language much more usable. The project will be broken up into several stages, each stage lasting two weeks, paralleling the sequence of study of compilers in the text and lectures. Some lectures will explore how the PL/0 compiler is organized and how textbook techniques are realized in the PL/0 compiler.

In particular, the course project is to add the following language constructs to PL/0:

comments ("#" to end of line)
allow "_" in identifiers
if/then/else statements
simple for loops, plus break statements
procedures with results, plus return statements
call-by-reference parameter passing
arrays and array indexing
booleans as first-class data types, with true and false constants and and and or operators
expressions allowed as constants

Each language addition will require language design and specification work (extending the initial PL/0 language specification to include the new features) as well as implementation work (extending the initial C++ implementation of PL/0 to compile the new features).  The details of the project steps will be provided as part of the assignments in the class.

Emphasis in the implementation should be placed on making clean, understandable changes that fit in well to the existing compiler structure. This will make reading the changed code easier, for the instructor, the TA, for you, and for your teammate. Gross, low-level hacks, even for better compiler efficiency, will be neither appreciated nor rewarded.

You are encouraged to organize yourselves into two-person teams to work on the project. When turning in a part of the project, simply list the names of the members of the project team. The grade for that part of the project will be assigned to all members of the team. Teams can be dissolved at any point, after which the two people will do independent work and receive independent grades. You are not required to be on a team, but you are likely to learn more and work less by being on a team.  Grading on the project will be joint; you will both be expected to understand all key aspects of the project.  (Note: For the other parts of the assignments, such as problems from the book, you must work individually.) You may dissolve your group at any time during the quarter, after which you can do the project independently with independent grading.  You can choose to work with a new partner if you have dissolved a partnership or have worked independently.  We will try to provide a matchmaking service for interested students.

All implementation work for this class should be done on ceylon, fiji, sumatra, or tahiti. The C++ source for the initial version of the PL/0 compiler is in the directory /cse/courses/cse401/00sp/pl0 . Instructions on installing and using the compiler are here.  An overview of the compiler (the overall structure, the files, coding conventions, etc.) is available in the directory as OVERVIEW.

Project Due Dates (tentative, subject to change):
9/29: get PL/0 compiler built; write and compile PL/0 programs
10/10 (Tuesday): extend RE description of tokens of PL/0; extend lexical analysis of compiler
10/13: extend EBNF description of syntax of PL/0
4/19: extend AST implementation of compiler
4/24: extend syntax analysis of compiler
5/8: extend type-checker of compiler
5/15: extend run-time storage allocation of compiler
6/2: extend code generator of compiler