Extend Milestone 1 to support the R2 language, including booleans, conditionals, and type-checking, and add register allocation.
Here’s how I’d go about it:
First, I’d get a simple interpreter working. This is still a VERY SIMPLE language, with booleans and conditionals but no functions. Generate some examples, including some large ones. Consider using a random generation function to create some large examples.
Next, I’d write the type checker. Use the examples that you’ve generated in order to check the type checker. If you’re feeling ambitious, you might want to update your random generator to generate only well-typed terms.
Third, I’d implement the first part of the toolchain, including remove-complex-opera*. Make sure that the result is still a valid program, and produces the same result in your interpreter.
Next, I’d implement explicate-control. If you want to lock this down, implement a simple interpreter for the C1 language, and make sure that your programs are producing the right values.
Okay, so I’m not going to list every step in the compilation process, but I think I would advise you to get everything working, all the way to the bottom with running code, before you implement register allocation.
Here’s a compressed bundle of test files.
For the purposes of evaluation, we’re breaking down the functionality into six separate "tiers". Each one is worth a fraction of the overall points for correctness, as follows:
(10 pts) Milestone 1 code
(3 pts) Type checking
(3 pts) Booleans & Boolean expressions
(2 pts) Conditionals
(2 pts) Register Allocation