WASM runtime

fjs/wasm/runtime is the runtime of the WASM execution mode of FunctionalScript: the layers a compiled program calls across the WASM module boundary, as the design notes in doc/sasha-gil/wasm lay them out. The interpreter and the Rust backend do not use it, and fjs/js/runtime stays as it is.

LayerWhat it holdsImported by
l0the FunctionalScript view of the L0 core, with JavaScript bodiesl1, its one importer
l1the L1 operations with FunctionalScript bodies, and its native rowsnone yet; the WASM backend will compile it
l1/builtintoday's natives as L1 bodies: charCodeAt, slice, String.fromCharCode, Object.entries, entry, hasEntrynone yet; the WASM backend will bind the names to them
l1/errorthe values L1 throws, copied by name from NaNVM's error.rs; nothing checks the texts across the twol1, l1/native, l1/builtin

L2, the stock runtime, will join here as l2.

Until a WASM backend exists, every body runs on a JavaScript host, so the layers are proved before any WASM is generated.

Emergent Testing

Idle. Press Run to start the suite.

  • ./l0/proof.f.mjs
  • ./l1/builtin/proof.f.mjs
  • ./l1/error/proof.f.mjs
  • ./l1/native/proof.f.mjs
  • ./l1/proof.f.mjs