edadma / wasm   0.4.0

ISC License Website GitHub

A WebAssembly interpreter for Scala 3 with a WASI Preview 1 host shim and a small CLI

Scala versions: 3.x
Scala.js versions: 1.x
Scala Native versions: 0.5

wasm

A WebAssembly interpreter for Scala 3 with a WASI Preview 1 host shim and a small CLI. All three pieces are cross-platform (JVM, Scala.js, Scala Native) and share one codebase.

Maven Central Last Commit GitHub Scala Version ScalaJS Version Scala Native Version

Documentation

Full reference at https://edadma.github.io/wasm/ — installation, quickstart, supported opcodes, WASI surface, CLI flags, host imports, spec compliance, and contributor docs.

Install

libraryDependencies ++= Seq(
  "io.github.edadma" %%% "wasm"      % "0.4.0",
  "io.github.edadma" %%% "wasm-wasi" % "0.4.0",  // optional — only if you want the WASI shim
)

Try it

git clone https://github.com/edadma/wasm
cd wasm
sbt 'cliJVM/run examples/hello.wasm'
# Hello, world!

Or against a real rustc-built WASI binary with a host-backed preopen:

mkdir -p /tmp/sandbox
echo "Hello from the host filesystem" > /tmp/sandbox/hello.txt

sbt 'cliJVM/run --preopen /tmp/sandbox:/sandbox \
                wasi/shared/src/test/resources/fixtures/real_rust_fileread.wasm'
# Hello from the host filesystem

Sub-projects

  • interp/ — the interpreter. Zero external dependencies (Scala stdlib only). Published as wasm.
  • wasi/ — WASI Preview 1 host shim (29 syscalls). Zero external deps, depends on interp. Published as wasm-wasi.
  • cli/ — a small command-line runner. Not published; runnable example.

See Development → Architecture for the full source-tree layout, and Development → Testing for the unit suites, W3C testsuite runner, and fixture regeneration.

Status

881 tests on JVM (653 interp + 209 wasi + 19 cli), all green; interp + wasi also green on Scala.js (Node 20+) and Scala Native (0.5.11). W3C testsuite slice: 133 of 142 manifests fully green, 9 pinned in KnownFailures with documented residuals. See docs/spec-compliance for details.

License

ISC — see LICENSE.