Skip to content

brickadia-community/wirescript

 
 

Repository files navigation

Wirescript

Compilers that build Brickadia wire graphs from code:

  • Wirescript - a language that compiles to wire graph saves. Try it in the browser at wirescript.brickadia.dev.
  • (Old, outdated) Bearilog - a module builder CLI for generating logic bricks.

This project requires rust v1.88 or later.

Wirescript

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

Features

  • Pure + exec contexts: signal-flow expressions and sequential on handlers
  • var / static var / let / buffer (one-tick delay) bindings
  • Records, tuples, destructuring, and spread
  • mod macros with ref params and chip microchip grouping
  • Imports across files: named, namespace (import * as u), and transitive
  • await, Sleep / SleepTicks, local exec signals, and emit
  • 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
  • $asset syntax 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.

Bearilog CLI

Output to BRDB file

This will build a module and output it to a BRDB file.

cargo run ./examples/cpu reg64_16 -o example.brdb

Render 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 --iobelow

Display a module

This will build a module and print out its structure

cargo run ./examples/cpu reg64_16

Display a module as a graphviz graph

Output for a browser:

cargo run ./examples/cpu reg64_16 -g

Render from CLI:

cargo run ./examples/cpu reg64_16 -g | dot -q -Tsvg > output.svg

About

A compiled language to Brickadia Logic Gates

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Rust 96.9%
  • JavaScript 1.8%
  • HTML 0.9%
  • TypeScript 0.2%
  • Witcher Script 0.1%
  • Shell 0.1%