Skip to main content

compile_to_wasm

Function compile_to_wasm 

pub fn compile_to_wasm(source: &str) -> Result<Vec<u8>, ParseError>
Expand description

Compile LOGOS source DIRECTLY to a self-contained WebAssembly module — no rustc, no cargo, no wasm-bindgen, no toolchain. Uses the SAME front-end as vm_outcome ([crate::ui_bridge::with_parsed_program] → [crate::vm::Compiler::compile_with_types]), so the emitted module runs the IDENTICAL bytecode the VM does; the AOT WebAssembly backend then lowers the whole program to .wasm.

Returns the bytes of a .wasm file. A program outside the backend’s supported fragment yields a [ParseError] carrying the backend’s unsupported … reason — the corpus lock turns that into a tracked, shrinking gap rather than a silent skip.