github mvm-sh/mvm v0.3.0

4 hours ago

mvm v0.3.0

A Go interpreter that compiles to bytecode and runs on a small stack VM — single
static binary, full standard library bundled, embeddable in Go and C.

Added

  • clear builtin (maps and slices) — the last builtin mvm was missing.
  • comparable as a generic constraint, plus broader generics-parsing improvements.
  • mvm run <import-path> fetches and runs a remote main package; trailing args
    become its os.Args.
  • mvm test runs and validates Example* functions (output checked against the
    // Output: comment), and -bench REGEX runs benchmarks through native testing.
  • -stat prints compile/execute statistics on both run and test.
  • interp.ExitError lets embedders catch interpreted os.Exit / log.Fatal* as a
    typed error instead of terminating the host (ADR-018).
  • cmd/mvmlint, a small linter for mvm-specific code patterns.
  • Stdlib bridges for encoding/gob; encoding/xml round-trips via a new xmlx
    shim (interpreted xml/Text marshalers work through native encoding/xml
    in both directions).
  • Native method hooks and composite interface bridges (one interpreted type
    satisfying several native interfaces at once).
  • Test infrastructure to run the Go standard library's own external _test.go
    suites against mvm's reflect bridges.

Changed

  • Exit virtualization (os.Exit, log.Fatal*) is now unconditional and wired
    automatically on the first Eval (ADR-018).
  • Load/parse/compile errors report file:line:col with a source snippet and a
    caret; runtime panics print a unified interpreted + native stack.
  • mvm test -stat prints the stats block after the test output, just before
    PASS/FAIL.
  • Build targets split: make test (race only), make cover (coverage), and a new
    make fast (-short + race) for a quick inner loop.

Fixed

Numerics (untyped-constant/float mixing, zero value, per-frame cache),
pointer-receiver method lookup and interface wrapping, type switches
(TypeBranch + interface-wrapper edges), and generics/inference (no type loss in
multi-return; inference on func-typed params), among others. Full list in
CHANGELOG.md.

Also new: a live compatibility matrix

https://mvm.sh/compat — mvm now runs the real test suites of the standard
library and ~50 popular packages through the interpreter every week and publishes
per-package pass / partial / fail with a trend over time. ~96% of individual test
cases pass today; the generator is itself a Go program run through mvm. Honest
numbers on purpose.


Try it in the browser: https://mvm.sh/playground
Install: go install github.com/mvm-sh/mvm@latest
Questions & feedback: https://github.com/mvm-sh/mvm/discussions

Don't miss a new mvm release

NewReleases is sending notifications on new releases.