Skip to main content

compile_to_wasm_linked

Function compile_to_wasm_linked 

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

Compile LOGOS source to a LINKED WebAssembly module that uses the real logicaffeine_base::BigInt runtime for arbitrary-precision integer arithmetic: an overflowing integer expression (Show 99999999999 * 99999999999, Show 2 to the power of 200) computes the EXACT big number — matching the VM’s promote-on-overflow — instead of trapping, and Show prints its decimal.

Unlike compile_to_wasm (fully self-contained, no toolchain), this is TOOLCHAIN-DEPENDENT: the BigInt-aware emitter ([crate::vm::wasm::assemble_program_linked]) produces a RELOCATABLE object that is linked against logicaffeine_base (compiled once to wasm32-unknown-unknown) with the Rust toolchain’s rust-lld. The runtime object is cached per process, so the amortized cost is one link. Returns the bytes of a .wasm file, or a ParseError carrying the reason the backend or linker declined (an unsupported program shape, or an unavailable toolchain / base wasm32 build).