Epsilon: A WASM virtual machine written in Go

https://news.ycombinator.com/rss Hits: 11
Summary

蔚 Epsilon Epsilon is a pure Go WebAssembly runtime with zero dependencies. Fully supports WebAssembly 2.0 Specification Runs on any architecture supported by Go (amd64, arm64, etc.) without requiring CGo Allows embedding WebAssembly modules in Go applications Includes an interactive REPL for testing and debugging Installation go get github.com/ziggy42/epsilon Quick Start Basic Execution Load and run a WebAssembly module directly from a byte slice: package main import ( "fmt" "os" "github.com/ziggy42/epsilon/epsilon" ) func main () { // 1. Read the WASM file wasmBytes , _ := os . ReadFile ( "add.wasm" ) // 2. Instantiate the module instance , _ := epsilon . NewRuntime (). InstantiateModuleFromBytes ( wasmBytes ) // 3. Invoke an exported function result , _ := instance . Invoke ( "add" , int32 ( 5 ), int32 ( 37 )) fmt . Println ( result [ 0 ]) // Output: 42 } Using Host Functions Extend your WebAssembly modules with custom Go functions and more using ImportBuilder : // Create imports before instantiation imports := epsilon . NewImportBuilder (). AddHostFunc ( "env" , "log" , func ( args ... any ) [] any { fmt . Printf ( "[WASM Log]: %v " , args [ 0 ]) return nil }). Build () // Instantiate with imports instance , _ := epsilon . NewRuntime (). InstantiateModuleWithImports ( wasmFile , imports ) Interactive REPL Epsilon includes a REPL for interactively testing and debugging modules. # Run the REPL go run ./cmd/epsilon Essential Commands Category Command Description Loading LOAD <path|url> Load a module from a file or URL Running INVOKE <func> [args...] Call an exported function State GET <global> Read a global variable Debug MEM <offset> <len> Inspect linear memory System LIST List loaded modules and their exports Example Session: $ go run ./cmd/epsilon >> LOAD https://github.com/mdn/webassembly-examples/raw/refs/heads/main/understanding-text-format/add.wasm 'default' instantiated. >> INVOKE add 10 32 42 Testing & Benchmarks Running Tests # Run unit tests go test ./eps...

First seen: 2025-12-09 09:29

Last seen: 2025-12-09 19:30