Try it in the browser at wirescript.brickadia.dev.
Looking for larger programs to read or remix? See Meshiest/wirescript-projects - a place for larger projects/examples.
You need Rust v1.88 or later and just (a command runner):
# after installing Rust via rustup:
cargo install just
# or: winget install Casey.Just / brew install just / scoop install justThen, from the repo root:
just # list all recipes
just compile file.ws # compile a .ws file to .brz (load in-game via the load dialog)
just check file.ws # type-check only, with error context
just test # run the wirescript unit testsThe first build compiles the whole toolchain in release mode and takes a few minutes; subsequent runs are fast.
The playground writes, formats, and
compiles Wirescript to .brz entirely in the browser, with searchable docs
(Ctrl-K) and a downloadable SDK (Node.js CLI tools, examples, and a VS Code
extension).
Every var becomes a Variable gate, every operator becomes an expression
gate, and every on handler becomes an exec chain:
var count: int = 0
in trigger: exec
on trigger {
count = count + 1
}
out total = count.Value
out doubled = count.Value * 2
- Pure + exec contexts: signal-flow expressions and sequential
onhandlers var/static var/let/buffer(one-tick delay) bindings- Records, tuples, destructuring, and spread
modmacros with ref params andchipmicrochip grouping- Imports across files: named, namespace (
import * as u), and transitive await,Sleep/SleepTicks, local exec signals, andemit- Receiver method syntax:
entity.SetLocation(...),a.Dot(b) - Typed arrays with 20+ built-in methods
- Vector and quaternion math with component-wise arithmetic and scalar broadcast
$assetsyntax and near-full coverage of Brickadia's logic gates- LSP + VS Code extension: diagnostics, hover, completions, go-to-definition, formatting, rename, organize imports, and inlay hints
The language reference lives in docs/wirescript/. The
compiler is crates/wirescript, the LSP server is crates/lsp, the browser
playground is crates/wasm, and the editor extension is editors/vscode.
The extension in editors/vscode/ runs the native LSP server
for diagnostics, hover, completions, go-to-definition, rename, organize
imports, and inlay hints, plus a Prettier-based formatter and a
Compile and Copy Path command (Ctrl+Shift+B) that compiles the current
file to a .brz and copies its path for Brickadia's load dialog.
Building it requires Node.js:
just lsp # build the native LSP server (target/release/wirescript-lsp)
just vscode # npm install + compile the extension (editors/vscode/out)In VS Code, open the Extensions view, click the ... menu at the top of the
panel, choose Install from Location..., and pick editors/vscode. This
loads the extension from that folder in place, so it keeps working as you
rebuild.
Alternatively, symlink it into your VS Code extensions folder and reload VS Code:
# macOS / Linux
ln -s "$(pwd)/editors/vscode" ~/.vscode/extensions/wirescript# Windows (PowerShell)
New-Item -ItemType Junction -Path "$env:USERPROFILE\.vscode\extensions\wirescript" -Target "$PWD\editors\vscode"The extension locates the LSP binary at target/release/wirescript-lsp
relative to the repo root by resolving its own real path. If you copy the
folder somewhere else instead, point the extension at the binary with
the wirescript.lspPath setting.
After changing compiler or LSP code, rerun just lsp - the extension watches
the binary and restarts the server automatically (on Windows it runs a temp
copy so cargo can rebuild while the server is running).
crates/wasm compiles the checker, compiler, and formatter to WebAssembly.
It powers both the browser playground and the downloadable SDK, and building
it requires wasm-pack:
cargo install wasm-packjust wasmbuilds the Node.js-target module intocrates/wasm/playground/sdk/pkg, used by the SDK's CLI tools (check.mjs,compile.mjs,format.mjs,hover.mjs).crates/wasm/build-playground.sh(bash; needs Node.js andzip) builds the web-target module and assembles the full playground into_site/- static files servable from any HTTP server - along withwirescript-sdk.zip, the downloadable SDK bundle (CLI tools, examples, and a WASM-based VS Code extension that needs no Rust toolchain).
To test the playground locally: cd crates/wasm/_site && python3 -m http.server 8080
(or some other static http server)
This will build a module and output it to a BRDB file.
cargo run ./examples/cpu reg64_16 -o example.brdbRender as a big blob of bricks
cargo run ./examples/cpu reg64_16 -o example.brdb --layout grid --inline
cargo run ./examples/7seg bitwise7seg -o 7segbit.brdb --layout grid --iobelowThis will build a module and print out its structure
cargo run ./examples/cpu reg64_16Output for a browser:
cargo run ./examples/cpu reg64_16 -gRender from CLI:
cargo run ./examples/cpu reg64_16 -g | dot -q -Tsvg > output.svg