In this assignment you will implement an extension of your choice for the Cubex programming language.
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:
- An executable jar file containing the Cubex compiler for the extended language and its sourcecode.
- A preamble file
cubex_lib.hthat you can
#includein your generated C file.
- A text file as described below.
It is very important that you include the source code of your compiler this time. It may be needed for grading.
The CompilerAs 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:
- If the input has a lexing, parsing or typing error, the program should print "reject"
- Else, the program should output a C program in the same directory, named
What Code Do I Generate?
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:
The following code snippet does this packaging for you (.g4 is the file extension for ANTLR files).
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:
- Who you discussed the problem set with. Remember that the solution must be your own, but you can discuss your ideas with others provided you mention that in this file.
- What the distribution of work in your team was like. Who did what?
- Any additional comments you might have about the problem set.
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.