Axmouth's CornerRust, infrastructure, and other questionable decisions.
Back to the archive
Project file

Solid Snake

A low level, modular bytecode, finite register VM focused on safety and extensibility, with plans for a Python like, statically typed language on top.

Early prototypeRustWebAssemblySourceLive
> let x = 2 + 3> print(x)5

A statically typed, Python-flavored language with Rust-inspired guarantees, and the register-based bytecode VM it compiles to. The idea is a language that reads like Python but does not let you shoot yourself in the foot, running on a small hardened VM that stays boring and predictable underneath.

The name is a Metal Gear Solid nod. There is no stealth action here, just a VM that tries not to mess around.

You can try it in the browser. The web demo compiles and runs Solid Snake in a sandboxed wasm build, with the example programs one click away. No install.

What works today

The language is real and runs end to end:

  • Functions, recursion, if, while, for, and the usual arithmetic over Int, Float, Bool, and String.
  • Structs with methods, protocols with nominal conformance, and extend blocks.
  • Generics: generic types and functions, monomorphized, including generic protocol bounds.
  • Enums as tagged unions, and match as both a statement and an expression, with exhaustiveness checking.
  • Errors as values: Result, Option, and the ? operator, all in the prelude.
  • Collections: arrays, growable lists, and string-keyed maps, with for over a shared iterator protocol.

The prelude is library code written in the language itself. Only the syntax that needs compiler support lives in Rust.

Running a program

cargo run -p solid-snake-compiler -- path/to/program.ss

Or a snippet inline:

cargo run -p solid-snake-compiler -- -c 'let x = 2 + 3
print(x)'

The VM underneath

The VM is register based and deliberately small. Values are raw u64 interpreted per instruction, with no global runtime typing. Memory is segment-indexed and every access is bounds checked. Calls follow a fixed convention, R0 for the return value and R1 upward for arguments, over a sliding frame stack.

Types and safety are the compiler’s job. The VM stays a plain, checkable execution layer, which also keeps a future native or C compilation target on the table.

Workspace

solid-snake-vm

The register-based bytecode VM: instruction set, encoding, execution, a heap with reference counting, and the builtin functions.

solid-snake-compiler

The language front end and code generator: lexer, parser, type checking, monomorphization, IR, and bytecode generation.

solid-snake-wasm

A wasm build for running in the browser, sandboxed away from the real machine, so a program can never touch the actual filesystem or network.

Status

Early but real. The language runs, the test suite is green, and the near-term direction is file and network I/O toward a self-hosted small web server.