Skip to main content

run_genuine_p2_on_target

Function run_genuine_p2_on_target 

pub fn run_genuine_p2_on_target(
    program: &str,
    core_types: &str,
    interpreter: &str,
) -> Result<String, String>
Expand description

Run genuine P2 on a specific target: PE(pe_source, pe_mini(target))

This is the real Futamura Projection 2 applied end-to-end:

  1. Build pe_mini applied to the target (pe_mini compiles the target)
  2. Encode the combined pe_mini+target as CProgram data
  3. Run pe_source on the encoded data (PE specializes pe_mini for this target)
  4. Decompile the residual to LOGOS source
  5. Execute the decompiled residual to get the target’s output

No decompilation of specialized functions — the PE directly produces the compiled target as CStmt data, which is decompiled to a simple LOGOS program and run.