Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Crush Banner

Crush Logo The Crush Language Guide

Crush is a capability-based scripting language with polyglot blocks, plus the toolchain that runs it: a compiler to bytecode, a sandboxed VM, and an intermediate representation (CAST) that other languages can be translated into.

Alpha. This guide documents what the toolchain does today, verified against crush-ast v0.13.0 (dc0d0278, 2026-12-03): every crush example on these pages is compiled and run by scripts/check-examples.py, and a corpus of 130 standalone programs with their exact output lives in examples/verified/ (The Verified Corpus). Features that exist in the design but not in the implementation are marked not yet implemented, with the crush-ast ticket; behaviour that is wrong today links the crush-ast issue.

What this guide covers

SectionWhat you’ll learn
Getting StartedBuild the toolchain, run a program, embed the VM from Rust
Crush LanguageSyntax, types, control flow, functions, closures, structs and methods, concurrency, capabilities, polyglot blocks, engines
ExamplesRunnable programs
CASTThe AST format that walkers and the compiler share
CASMThe bytecode formats the VM executes
AppendixGlossary, quick reference, language comparisons

The compilation pipeline

 Crush source (.crush)                     Other languages (.py / .rs / .go / ...)
        │                                              │
  crush-frontend                                walker (language-specific)
  parse · check · optimize                              │
        │                                               │
        └───────────────►  CAST  (JSON AST)  ◄──────────┘
                              │
                        compiler
                              │
                  CASM  (bytecode: JSON IR or CVM1 text)
                              │
             assembler → CVM1 binary (.cvm1)
                              │
        crush-vm  (portable VM · FastVM · JIT · AOT backends)

crush run prog.crush runs the whole left-hand path in one step.

Hello, Crush

fn main() {
    io.print("Hello, Crush!")
}
Hello, Crush!

io.print is a capability call: a call that crosses the VM boundary to the host, and so only works if the host grants it. Capability calls are written like any other dotted call — there is no @ prefix. (The @ sigil in Crush introduces polyglot blocks such as @python { ... }, and annotations.)

Press Run under the example to run it in your browser, or Edit to change it first. Running the Examples explains the buttons and labels, and what the in-browser runtime can and cannot do.

Where the source lives

The language implementation is the standalone crush-ast repository, extracted from the exosphere agent-native OS monorepo on 2026-06-12. It contains the CAST intermediate representation, tree-sitter grammar, polyglot walkers, compiler frontend, VM runtime, package manager, and installer.

The upstream exosphere project retains a subprocess-based walker registry that invokes the crush-ast walker binaries, and its own crush-cast/casm/nanovm crates for the Crush language compiler running inside the agent-native OS.

License

Licensed under either of MIT or Apache License 2.0 at your option.