On this page:
5.1 Testing
5.2 Submitting
8.14

5 AE: Partial Evaluation🔗

Due: May 9, 2025

In this assignment, you will implement a partial evaluator—a program transformation tool that specializes a program based on known inputs. Partial evaluation aims to optimize a program by precomputing parts of its execution when some arguments are known in advance, effectively producing a new, more efficient version of the original program. The resulting specialized program runs faster by avoiding redundant computation and simplifying control flow. This assignment will guide you through the process of designing and implementing a partial evaluator for a small functional language, helping you understand key concepts such as environment management, symbolic execution, and residual code generation.

Here are a few examples:

5.1 Testing🔗

You should test your code by writing test cases and adding them to relevant files. The starter code is available in pinterp.rkt on Canvas. Use the command raco test [filename] to test your code. Alternatively, pressing “Run” in Dr. Racket will also run your test cases.

For grading, your submitted interpreter will be tested on multiple programs drawn from this language. Writing your own test cases will give you confidence that your interpreter can handle previously unseen programs.

5.2 Submitting🔗

You should submit on Gradescope. You should submit one file: pinterp.rkt for grading, so make sure all your work is contained there! You may add/remove any function you need to these files, as long as the pinterp function is present.