Skip to main content

projection2_source

Function projection2_source 

Source
pub fn projection2_source() -> Result<String, String>
Expand description

Second Futamura Projection: PE(PE, interpreter) = compiler

Specializes the partial evaluator with respect to a fixed interpreter, producing a compiler that takes any CProgram as input and produces optimized residual CStmt/CExpr data.

For the Core self-interpreter (which is the identity evaluator on CProgram data), PE(PE, int) resolves to the PE itself operating directly on program data — the interpreter’s dispatch loop is the CExpr/CStmt case analysis that the PE already implements. The result is the PE with its entry points renamed to compileExpr/compileBlock: these ARE the specialized compiler functions with no PE dispatch overhead (BTA, memoization, etc. are absent because the interpreter’s representation IS the PE’s representation).

NOTE: this is the renamed-PE REPRESENTATION of P2 — it ASSERTS the collapse by renaming. The GENUINE projection that DEMONSTRATES it by actually running PE(pe_source, pe_mini) is genuine_projection2_residual (and run_genuine_p2_on_target). Enforcement gates use the genuine path; shortcut_quarantine_lock forbids any Jones-certifying gate from using this rename.