/--------------\
|GC+Concurrency| <-- PA3
\--------------/
PA5 |v |||
/--------------\ /-------------\ /--------------\
<file.gpy> => | ir | => <file.s> => | assemble.rs | => <file.o> => | vm | => result
\--------------/ \-------------/ \--------------/
^| PA4 ^| PA1 ^| PA2
Your jobs in this assignment are to:
-
Fix your code from PA4 (3 EC points).
-
Implement tailcall optimization in your compiler (1 EC point).
If you complete both parts, you'll receive up to 4 points of extra credit to be applied to your overall homework grade. If you complete just part 0, you'll receive up to 3 EC points applied to your homework grade.
NOTE: No late days will be accepted (even if you have some left) on this extra credit assignment.
The specific instructions for Part 0 are exactly the same as in PA4.
For Part 1 (tailcall optimization):
-
Update your compiler so that it optimizes tail recursion to use constant stack space as described in Tail Recursion.
-
Make sure your optimizing compiler passes all the previous test cases from PA4.
-
Make sure you additionally pass:
tailcall.gpy
tailcall-fact.gpy
and that your compiler is producing constant-space code.
- In your README, include a short section on how you approached implementating tail recursion. For example, what changes did you make to your compiler? Include some before/after Grumpy assembly
.s
code examples for the test cases above to convince us that your optimized programs actually use constant stack space.
-
You must use one of the following languages to implement your compiler: Rust, C, C++, Python, OCaml. In order for us to support submissions in multiple languages, all submissions must contain at least the following files:
README <-- A short text document describing your project's architecture Makefile <-- The Makefile used to build your project Cargo.toml <-- If you use Rust+Cargo main.<rs|c|cc|py|ml> <-- Your project's root file
NOTES:
- Your
Makefile
should contain the following targets:build
: build your compiler (for Python projects, this target can be a noop but must still exist)test
: runs your unit testsrun
: run your compiler; it should be called asF=<file.gpy> make run
clean
: remove stale files
- We will build your project on
pu2.cs.ohio.edu
(we suggest you test there). - You may (optionally) include additional files that are called from
main
. - For Rust projects, you may use Cargo. However, you still need to provide the above
Makefile
.- Hint: Try
cargo build --release
. It optimizes and removes debug symbols so produces faster code. - You should also submit your Cargo.toml so your project actually builds when we run
make build
- Hint: Try
- Sample
Makefile
s for C++ and Rust will be uploaded to Blackboard. Feel free to reuse or adapt them.
- Your
-
To submit your project, submit all your project files separately in Blackboard, under assignment
pa5
, on or before the due date.