Skip to main content

translate_program

Function translate_program 

Source
pub fn translate_program(
    source: &str,
    source_language: &str,
    target_language: &str,
) -> Result<ProgramTranslation, ProgramTranslationError>
Expand description

Translates a program between JavaScript, Rust, Lean and Rocq.

Programs in the portable core are parsed, type-checked and emitted as native target programs that print the same lines and restate the same theorems; ProgramTranslation::semantics records the encodings, assumptions, proof obligations, source mappings and provenance of that translation. Other programs are carried in a reversible source envelope, whose ProgramTranslation::diagnostic names the construct that kept them out of the portable core; the envelope never relabels the original text as target-language syntax.