Zig WASM runtime in standard library?

The stage1 is a compiled WASM binary that uses WASI preview 1 functions for processing the compiler source code. It does not have WASM runtime, or rather, there is a custom wasm/wasi runtime in C that is used to bootstrap the wasm binary to your local system. If you want to use the WASI interpreter, then you can look at zig/stage1/wasi.c at master · ziglang/zig · GitHub Note that this is not a complete wasi/wasm implementation, only enough for what the stage1 binary needs.
The idea is that you would compile that function using your c tool chain, use the output to run the wasm to further build the stage 2 compiler.
You can read more in this thread: Questions on the bootstrapping process - #4 by kristoff

If you are looking for an embeddable wasm runtime in Zig, you can look at GitHub - rdunnington/bytebox: Standalone WebAssembly VM.

8 Likes