Assignment 7: Garter: Design Your Own Language Extension
Part I Due: Fri 12/02 at 11:59pm, Part II Due: 12/14 at 11:59pm
NOTE: This final, 2-part assignment, must be completed with a partner. We are releasing it early so that you have ample time to find a partner if you don’t already have one. If you have not found a partner by class time on Monday, November 21, e-mail the professor Max New and he will pair you with someone else who does not have a partner.
Thus far in the class we have provided you with a specification for a new language feature or analysis and you have implemented it according to the provided specification. For this final project you will take over, and both design the language extension and implement it. The assignment is broken up into two parts: first you will submit a written document specifying the syntax, semantics and an outline for how to implement a new language feature. Then you will extend the compiler end-to-end to support your new feature and implement tests to demonstrate your new language in action.
Here are a couple of recommended features for you to choose from that should be feasible and that the professor and GSI/IAs will be most prepared to help with. We will be providing additional background resources on these topics on Piazza to help you with your design.
Floating point numbers and operations on them. This extension has similarities to the Cobra assignment, but floating point numbers use unique assembly code registers and instructions that you will need to learn.
Raising and handling of exceptions. This extension has similarities to Diamondback and the array portion of Egg-eater.
Implementing an interactive debugger with breakpoints. This is similar to implementing exceptions but more complex.
Classes and objects. This extension has similarities to the closure portion of Egg-eater.
If you would like to choose a different language feature to implement, e-mail the professor to confirm that it is sufficient and feasible. Whatever language feature you choose it should involve an extension to the parser and a non-trivial extension to the remainder of the compiler.
You may choose to base your extension off of either your diamondback or egg-eater compiler, or something in between such as diamondback with arrays added but not closures. You do not need to perform register allocation for your final compiler.
1 Part I: Written Specification
For part 1 you will submit a 3-5 page technical specification for your chosen language extension in pdf format.
This document should address the first four steps of our language extension recipe we’ve seen throughout the course:
Its impact on the concrete syntax of the language
Examples using the new enhancements, so we build intuition
Its impact on the abstract syntax and semantics of the language
Any new or changed transformations needed to process the new forms
Executable tests to confirm the enhancement works as intended
The last part, executable tests will be a part of part 2.
You will be graded on
Whether you thoroughly cover all 4 of the topics above
The logic of your design
The clarity of your writing
We will grade the written assignments quickly so as to quickly alert you to any design flaws we find and help you to correct them.
2 Part II: Implementation
For the final submission you will implement your proposed language feature and submit the following for grading:
The repository with your compiler implementation
A collection of executable tests to demonstrate that your extended compiler works as intended
A short pdf document detailing any changes from your submitted Part I design, if any
This should be in the following format:
Your
Cargo.toml
,runtime/stub.rs
andsrc/
files.Your example programs in
examples/*
, with automated tests running them intests/examples.rs
so that we can runcargo test
to see that you are passing your tests.Files
docs/proposal.pdf
containing your original proposal and a filedocs/updates.pdf
thatdocuments any changes to your original proposal or design components unforeseen in your original proposal.
You will be graded on
To what extent you successfully implement the proposed feature.
The thoroughness of your test suite.
That the implementation matches your final amended specification.