This page covers the shortest path to building Gengoscript, running a script, and checking that the local toolchain works.
For a guided first example, see tutorial-first-script.md.
Build the native CLI:
zig build -Dpreset=1m cliBuild the WASI runtime:
zig build -Dpreset=1m wasiBuild the embeddable engine artefacts:
zig build -Dpreset=1m engine-build
zig build -Dpreset=1m engine-nativeOutputs:
zig-out/bin/gengobuild/debug/gengo-cli.wasmbuild/debug/gengo-engine.wasmzig-out/lib/libgengo-engine.soon Linux
Native CLI:
./zig-out/bin/gengo script.gengoWASI runtime:
wasmtime --dir . ./build/debug/gengo-cli.wasm -- script.gengoThe test, parity, and bench build steps also invoke wasmtime. If it is not on PATH, pass -Dwasmtime=/path/to/wasmtime to the relevant zig build command.
Run the CLI with no arguments to start the REPL:
./zig-out/bin/gengoBy default, file imports are restricted to the script's own directory. Pass --modules (repeatable) to allow additional directories:
./zig-out/bin/gengo --modules /app/lib --modules /app/shared script.gengoFor the WASI binary, ensure wasmtime mounts any extra directories too:
wasmtime --dir . --dir /app/lib ./build/debug/gengo-cli.wasm -- --modules /app/lib script.gengoRun the conformance suite:
zig build -Dpreset=1m testRun parity checks between the embedded and host backends when relevant:
zig build -Dpreset=1m parityRun benchmarks when you need performance data:
zig build -Dpreset=1m benchPresets control the heap and stack budgets baked into the binary:
| Preset | Heap | Use |
|---|---|---|
256k |
256 KiB | Constrained embedded targets |
1m |
1 MiB | Default — CLI and general scripting |
16m |
16 MiB | Production embedding / large workloads |
unlimited |
256 MiB | No practical limits |
Apply a preset with -Dpreset=<name>.
For GC correctness testing, combine any preset with -Dgc_stress=true (forces GC on every allocation).
tutorial-first-script.mdfor a first scriptembedding.mdfor Zig embeddingengine-api.mdfor C-compatible host integration