Pipit interpreter provider
The Pipit provider runs generated Go code in Piko's interpreted development mode (dev-i). Piko converts .pk templates to Go, then Pipit compiles that source to bytecode in memory. Template edits reload without rebuilding the server binary.
Overview
The provider implements Piko's interpreter port using Pipit. Pipit supplies standard-library symbols, while Piko adds its runtime packages. Local project packages can compile from source. Native symbol tables expose third-party Go packages and any project packages you choose to compile into the server binary.
The provider pools interpreters from a shared initial state. This avoids loading the full symbol set for every request. Compiled dev and prod modes execute generated Go directly and do not need interpreter registration.
Configuration
NewProvider takes optional functional options instead of a config struct. There is no Debug or WatchMode field. Piko's file watcher handles hot reload. Most setups need no options.
import (
"piko.sh/piko/wdk/interp/interp_provider_pipit"
)
provider := interp_provider_pipit.NewProvider(
interp_provider_pipit.WithBytecodeEmission(".piko/bytecode"), // optional
)
WithBytecodeEmission(directory) enables an experimental dump of source and compiled bytecode to disk during compilation, useful when debugging register overflow or other VM-level compilation issues. Leave it disabled in normal use.
WithRestrictedSymbolSurface() restricts imports to registered host namespaces, local script packages, and queued modules. Language built-ins remain available. Other imports fail at compile time, and unsafe is always denied in this mode.
Restricted mode also applies resource limits. Explicit provider options can override them. See the interpreter API reference for limits and defaults.
Bootstrap
Register the provider on the server before calling Run.
import (
"piko.sh/piko"
"piko.sh/piko/wdk/interp/interp_provider_pipit"
)
server := piko.New(/* options */)
server.WithInterpreterProvider(interp_provider_pipit.NewProvider())
err := server.Run(piko.RunModeDevInterpreted)
Run starts the server and blocks until shutdown. dev-i startup fails if no interpreter provider is registered.
For native package symbols, generate the tables from piko-symbols.yaml with piko extract generate. Register piko_symbols.Symbols through server.WithSymbols(...) before Run. Restart after changing native packages or regenerating their symbols.
See also
- About interpreted mode, what
dev-iis for and when to reach for it. - How to run interpreted mode for setup, symbol extraction, and bytecode inspection.
- About WASM, the same bytecode VM also runs in WebAssembly contexts behind a
js && wasmbuild tag.