Crush Overview
Open as a notebook (.crush-nb, how to run it)
Verified against crush-ast
v0.13.0(dc0d0278, 2026-12-03).
Crush is a small, capability-based scripting language with polyglot blocks, and the toolchain around it: a parser, a compiler to bytecode, a sandboxed VM, and an intermediate representation (CAST) that other languages can be translated into. It is alpha software — this guide documents what runs today and says so when something doesn’t.
What Crush is
- A language.
let,fn,if/while/for,match,try/catch, arrays and objects, closures and function values, structs withimplmethods andtraits, green tasks, a pipeline operator. Dynamically typed at run time with optional compile-time type hints. See Syntax. - Capability-gated. A program can’t print files, open sockets or start
processes unless the host turns the matching capability on. Capability calls
are ordinary dotted calls —
fs.read("x"),io.print("y"). See Capability System. - Polyglot.
@python -> out { },@javascript { }and@bash { }blocks run other languages and exchange variables with Crush. They currently run as ordinary subprocesses outside the capability model unless you build the optional sandbox. See Polyglot Programming. - A pipeline. Source becomes CAST (an AST in JSON), then CASM (bytecode), then
runs on a VM (
crush-vm), with a faster VM, a JIT and ahead-of-time backends also in the repository (Engines, AOT and Walkers). Walkers translate Python, JavaScript, Rust and other languages into the same CAST.
New since 0.9.0
Up to the pinned commit (v0.13.0); each item links to its page.
- Imports and packages.
import a.b [as x] [{ f }]loads.crushfiles at compile time, through-L,CRUSH_PATHand crush-pkg dependencies;pub fnis enforced per package (since v0.12.0) and a dependency’s own dependencies resolve (v0.13.0); a struct or trait name declared in two files is a compile error. (Modules) catchcatches run-time faults: division by zero, a bad index, a failing capability. (Control Flow)- Calls on any expression (
fs[0](1),make()(2),S { n: 3 }.size()), the method forma.pop(),regex.matchcallable, exponent literals (1.5e3). (Closures, Types) process.execreturns a map{exit_code, stdout, stderr}. (Capability System)- Quotas and networking.
--max-wall-ms N|unlimitedbounds the whole run,--max-steps unlimited;net.*andtcp.recv/tcp.accepttake{timeout_ms};net.http_requestreturns response headers. (Capability System)
New in 0.9.0
Each item links to the page that documents it (and every example there was run).
- Slices on strings, and steps.
s[0:5],s[-5:],s[::2],s[::-1]on strings and arrays; they lower toseq.slice. (Types) - Hex and binary literals.
0xff,0b101. (Syntax) - A debugger.
crush debug FILE --step --inspect: breakpoints by line, step, watch, print, with the inspection itself a grant. (Debugging) - Windows.
crush gui run FILE --uiand theui.*API, from the separatecrush-guipackage. (Windows) - Raw sockets.
tcp.*behind--tcp(client) and--tcp-listen(server);--netstays HTTP-only.net.*is compiled into the default build, and the oldhttp.*names are refused with their replacement. (Capability System) - One diagnostics format.
--message-format jsongives one schema across the tools, and semantic errors carry a line and column. (Diagnostics) - Easier install.
cargo install crush-lang-sdk(notcargo install crush, which is an unrelated crate), or the prebuilt Linux binaries on the GitHub release; v0.9.0 is the first release to have them. (Getting Started) @bashblocks can read Crush variables again, by$name. (Polyglot)
Hello, Crush
print("Hello, Crush!")
Hello, Crush!
Run it with the toolchain built from crush-ast (see Getting Started):
crush run hello.crush
A taste
struct Point { x: Int, y: Int }
impl Point {
fn distance_sq(self) { return self.x * self.x + self.y * self.y }
}
let points = [Point { x: 3, y: 4 }, Point { x: 1, y: 1 }]
let far = |p| p.distance_sq() > 10
let i = 0
while i < len(points) {
let p = points[i]
if far(p) {
print("far: " + p.distance_sq())
}
i = i + 1
}
far: 25
Security model, in short
- Deny by default. Every capability group (
--fs,--net,--process,--polyglot, …) is off until you enable it on the command line (or register it, when embedding). - Quotas. Instruction count, stack depth, output size, call depth and wall-clock time for polyglot blocks are bounded.
- Honest limits. Polyglot blocks run with the host’s authority in the default build; the bubblewrap sandbox is opt-in at build time. The capability chapter lists what is not enforced.
Where things stand
| Area | Status |
|---|---|
Core language (functions, loops, try/catch, match) | works |
| Closures and function values | works on the VM; AOT refuses them by name |
Structs, impl, trait, @kind, struct patterns | works on the VM; AOT refuses method calls by name |
spawn / yield / await, parallel_map | works on the VM |
import (multi-file programs), crush-pkg packages | works, resolved at compile time; visibility is per package, a private function used from another package is the warning W-VIS01 (Modules) |
Capabilities, @capabilities, the standard library | works; the standard library is on by default |
Polyglot: Python, JavaScript (declared -> outputs), Bash | works (host authority by default); @bash reads the Crush variables it names as $name |
| Polyglot sandbox | opt-in build, verified on Linux with bwrap |
| CAST / CASM formats | documented in their own sections |