Assignment 7: Garter: Design Your Own Language Extension
Part I Due: Fri 12/01 at 11:59pm, Part II Due: 12/13 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 19, make a private piazza post with title "Partner Needed" and we 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, along with a suite of executable tests demonstrating the expected behavior. Then you will extend the compiler end-to-end to support your new feature with a robust test suite 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.
Raising and handling of exceptions. This extension has similarities to Diamondback and the array portion of Egg-eater.
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.
Implementing an interactive debugger with breakpoints. This is similar to implementing exceptions but more complex.
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 both of an extension to the concrete syntax 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
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
The thoroughness of your test suite in exploring the behavior of your new program feature
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.
For this submission you should submit your usual codebase as usual but
include a document docs/proposal.pdf
with your written
proposal, as well as your test files examples/*
with automated
tests for running them in tests/examples.rs
, labeled with a
comment /* Garter tests */
(or whatever fun snake name you
decide to give to your language). The tests will fail because you
haven’t implemented the feature yet.
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
that documents 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.
That your implementation continues to support features of prior languages.
For this last point, your docs/updates.pdf
should detail which
language features from egg-eater, if any are not supported. Your
implementation should at least support the features in diamondback.