Programming Assignment 7: Object-oriented features
Due: Friday, December 16
In this assignment you will complete your compiler project by adding object-oriented features. The new, extended language is called OO Xi. It adds classes and inheritance to Xi. The differences between OO Xi and Xi are described in the OO Xi specification.
In addition, you are expected to fix bugs and limitations in your compiler existing from previous assignments.
Part of the programming assignment is also to extend OO Xi with a new feature of your choosing.
You will also give a short presentation about and demonstration of your compiler.
The compilers from the various groups will be compared in the 2011 CS 4121/5121 Compiler Bakeoff. The winning compiler time will gain bragging rights and be immortalized on the web page above.
Language extension
We expect you to design and implement some new, small feature for OO Xi. Some examples of features you might add are the following, roughly in order of difficulty.
- Allow constants to be defined in interface and source files, integrated with constant folding (relatively easy).
- Support more powerful multiple-assignment syntax, with multiple expressions appearing on the right-hand side (relatively easy).
- Java-style break and continue that can jump to named labels.
- Make Xi type-safe by detecting uninitialized variables.
- Multiple inheritance with sparse dispatch vectors (relatively challenging).
But you don't have to implement one of these choices—be creative! It doesn't have to be a big feature. You will get a bit more credit for attempting more complex features, but you will also get credit for building a rock-solid implementation of your feature and for documenting it clearly. So don't bite off more than necessary.
Your language should be backward compatible with the OO Xi spec so correct programs written according to that spec still work.
Final project demo
You will give a short presentation and demonstration of your compiler to the course staff. This is a chance to explain how your compiler works, to talk about any interesting design decisions, and to show us anything especially cool that you did. Aim for a 20-minute presentation plus demo, with 10 minutes left for questions. The signup for presentation slots is already open on CMS.
Interface
Your driver must support the same command-line interface as in Programming Assignment 6.
Updates to provided code
We have updated the lexer interface files to support the new lexemes in OO Xi. Download cs4120-pa7.jar if your group is using the PA1 lexer interface. Updated documentation is also available.
An updated version of the libxi runtime library is needed for development with OO Xi. It comes with two object-oriented example programs and corresponding assembly code. The xifilt utility was updated and now understands OO Xi symbols. Untar the archive and use "make" to build it as usual. The include directory contains the updated OO Xi interface files. Download it here: runtime-v4.tar.gz.
The XiQt GUI Library enables OO Xi programs to build graphical user interfaces that work cross-platform.
Example programs
Some example programs are available for testing your compilers:
- mandelbrot
- A graphical Mandelbrot set explorer using XiQt.
- kmp
- A Knuth-Morris-Pratt string matcher (mostly not OO, but uses the new file interface).
Submission instructions
As in previous assignments, please ensure that all your Java code lives in a package containing the NetId of at least one of your group members. Your code should compile without errors or warnings. Your code should not contain any superfluous print or debug statements.
Submit the following:
- Your overview document.
- A JAR archive containing the following:
- Your compiled code (
*.class
). - A manifest file defining your JAR's
Main-Class
to be your driver. This will enable us to run your JAR file directly. See Sun's tutorial for help with this. - All source files (
*.java
,*.flex
,*.cup
, etc.). Do not forget to include your source. Failure to do so will likely result in a 0 for this assignment.
- Your compiled code (
- A source archive (
.jar
,.zip
, or.tar.gz
) containing your testing code and test cases. - Optionally, a source archive (
.zip
, or.tar.gz
) containing up to three benchmarks your group would like to submit.
Submitting functional tests and benchmarks
For fun and good karma, you are encouraged to submit programs that you think are good functional tests or good performance benchmarks. We encourage each group to submit up to three short programs of each kind, following the guidelines set in previous assignments.
Each test case will be a valid OO Xi source file. It should conform to the format restrictions described in the previous programming assignment description for functional test cases.