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).