CS 4120: Introduction to Compilers
Fall 2013

Programming Assignment 6: Extensions

due: Tuesday, December 10

No late submissions!

In this assignment you will implement an extension of your choice for the Cubex programming language.

Possible extensions

The slides from lecture 36 give a quick overview of the extensions. Different extensions have different prerequisites of what your compiler needs to be able to do. If your compiler does not meet those prerequisites yet, you need to do the additional work to implement them.


Unless otherwise noted in the description of your extension, your submission has to have three parts:

It is very important that you include the source code of your compiler this time. It may be needed for grading.

The Compiler

As in the previous assignments, this program should take a file name as an argument, read that file, check it and print results to the standard output/a result file as explained below. The possible results are:

What Code Do I Generate?

Unless otherwise noted in the description of your extension, the same rules and regulations as for PA4 and PA5 apply.


This assignment will NOT be graded in the same staged mode as before. Your rather have to choose an extension that fits the status of your compiler and implement it to the fullest extent possible. Our tests may put more weight on easier examples, but there is not guarantee to what extent this may happen.

How to submit

You have to include the complete source code in the jar-file, including inputs for any lexer/parser generators you might use. You will need a manifest file (MANIFEST.MF) that sets the classpath. Your manifest file should look like this:

Manifest-Version: 1.0
Class-Path: . antlr-4.1-complete.jar
Main-Class: [your-class-name-here]

The following code snippet does this packaging for you (.g4 is the file extension for ANTLR files).

jar cvfm x3c.jar MANIFEST.MF *.class *.java *.g4

The preamble file

Like the generated code, this file may only #include the library files we provided. You can use it to implement all data structures and functions common to all generated programs.

The text file

Finally, we ask that you submit a small text file (.txt) that contains the following information:

Source control

We recommend that you use some kind of source control. Be aware that your repositories should not be publicly viewable on the web. GitHub offers private repositories for students.


You should thoroughly test your solutions before turning them in. We will try to automatically test your submissions to a large extent. By now, you should now how to make your submissions testable. Share test cases with your fellow students, and ask on Piazza if parts of the semantics of your extension are not clear to you.