This repo is a work-in-progress programming language inspired by Without Boats' "Notes on a Smaller Rust", Graydon Hoare's "The Rust I Wanted Had No Future", the Austral programming language, and to some degree Typescript/Go (for introducing me to the joy of structural interfaces).
Its principle goal is to be enjoyable to use for writing games and toy software. To that end, it should:
- Be fun to write (implementation simplicity drives design decisions; no LLVM backend)
- Allow for very fast iteration (compile very quickly, run reasonably quickly; provide facility for easy testing)
- Prevent frustrating errors (no null pointers; no aliased mutability; sum types)
- Trade a little performance for a little convenience, where necessary (reference-counting; easy copy/clones, etc)
It's just barely ready to write toys in, if you're willing to get your hands dirty: no standard library, no built-in IO of any kind, barely any collections, and a big pile of known bugs.
brick
isn't a final name, but it's the one the language goes by for now!
brick/
: Core language code (parse, typeheck, de-sugar, borrowcheck, low-level IR, and a basic tree-walking interpreter)brick-wasm-backend/
: Emits WebAssembly, plus a wasmtime-based test harness. Not yet capable of producing linked binaries withrust-runtime
brick-runtime/
: Rust-based runtime for the language, linked into both the interpreter and the wasmtime test harnessruntime-binary/
: Helper crate to buildbrick-runtime
for wasm, and provide the runtime bytes to other cratesbrick-wasmtime/
: Helper to create a linked wasmtime module that includes the brick runtimebrick-lsp/
: A proof-of-concept implementation of the Language Server Protocol, currently all it can do is go-to-definition for functionsdata-test-driver/
: Helper project to run both interpreter and wasm tests over a few hundred test scripts intests/
. Originally they were written via the Rust#[test]
handlers but that was slowing compile and testing across two different implementations was difficultbrick-fmt/
: A proof-of-concept autoformatter. It does produce an output but currently strips comments and whitespace, doesn't break lines, and has many quirksbrick-wasmc/
: Currently it just compiles a given set of source files into a wasm file, and then dumps the runtime wasm next to it. Ideally it will link towasm-merge
and link the given source files with the runtime, and produce a single linked wasm module.
This repo requires a recent-ish version of Rust; I've been running it on Rust 1.77.1. You should be able to cargo test
from the root and all tests should pass. If you want to play around with a potential change to the compiler, the test suite should be a pretty good guide.
Things are a little blurrier when actually trying to write programs. Out of the box, your best bet is using brick-wasmtime
as a scaffold. You can either copy its source or declare it as a dependency. Add whatever external bindings your program might want from its environment and you should be good to go. Currently the browser-deployment process is a little more cumbersome which I'd like to address before writing docs about it.