Skip to content

Latest commit

 

History

History
69 lines (49 loc) · 3.61 KB

5.md

File metadata and controls

69 lines (49 loc) · 3.61 KB

EC PA5: Optimizations

                                                                             /--------------\
                                                                             |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:

  1. Fix your code from PA4 (3 EC points).

  2. 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.

Specifics

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.

Submission

  1. 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 tests
      • run: run your compiler; it should be called as F=<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
    • Sample Makefiles for C++ and Rust will be uploaded to Blackboard. Feel free to reuse or adapt them.
  2. To submit your project, submit all your project files separately in Blackboard, under assignment pa5, on or before the due date.