Skip to main content

Module supercompile

Module supercompile 

Source
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:

  1. Driving — symbolic execution one step at a time, maintaining an abstract store mapping variables to known values
  2. Folding — memoizing function evaluation results to avoid recomputation and detect infinite recursion
  3. 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