Expand description
Supercompiler — a unified optimization pass that subsumes constant folding, propagation, dead code elimination, and compile-time function evaluation in a single framework.
The supercompiler performs online partial evaluation via:
- Driving — symbolic execution one step at a time, maintaining an abstract store mapping variables to known values
- Folding — memoizing function evaluation results to avoid recomputation and detect infinite recursion
- Generalization — widening variables modified in loops to ensure termination of the analysis
Scope: pure integer/boolean code only. Collections, IO, and escape blocks are treated conservatively (passed through unchanged).
Structs§
- MsgResult
- Result of Most Specific Generalization (MSG).
Functions§
- embeds
- Homeomorphic embedding check:
e1 ◁ e2. - msg
- Compute the Most Specific Generalization (MSG) of two expressions.
- supercompile_
stmts