You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 27, 2026. It is now read-only.
Partial Evaluator is a code processor that simplifies code if possible. Given a program and a set of its dependent variables/inputs, the program is partially evaluated given specific values to some of its inputs.
It produces a specialized program (residual program) that works the same way as the initial program given these set of static values.
Terms to simplify in a function call:
Arithmetic expressions
Static variables
Conditionals
Current Approach:
Search the function for terms that can be simplified
Replace the terms with simplified terms
Search the function multiple times till no other terms can be simplified
Arithmetic Expressions
Arithmetic Expressions are converted to a parse tree of a standard form
Expression are expanded into a sum of products
Terms are combined if they are the same
Arithmetic Operators
Subtractions ( - ) are expressed as multiplying by -1
Multiplications ( * ) are sorted by number first and variables later
Addition ( + ) are sorted by variables and terms are combined if variables are the same
Division ( / ) are expressed as multiplying by a single reciprocal with a denominator being another expression
Static variables
Look through the parse tree for static variables
Replace them with their corresponding values
Conditionals
Look through the parse tree for conditional statements and conditional expressions
If the conditions can be evaluated, partially evaluate to one of its branches
If not, partially evaluate its conditions and both branches