Warning: Heads-up, this is a fun personal project to drive Claude Code very hard and make a domain-specific programming language. It's a fun personal project, but should probably not be used by anyone.
Weir is a statically typed, Lisp-family programming language targeting native code via Cranelift. It's designed for fast iteration in small-scale game development, combining S-expression syntax with a modern type system and function-level live reloading.
- S-expression syntax with type annotations, collection literals (
[],{}), and threading macros (->,->>) - Declarative static types — explicit function signatures, locally inferred locals, algebraic data types, exhaustive pattern matching
- Typeclasses with higher-kinded types, multi-parameter support, and coherence rules
- Hygienic macros — purely syntactic, can generate type definitions and typeclass instances
- Native compilation — Cranelift JIT for dev mode, AOT compilation for release binaries
- Live reloading — function-level hot-swap in dev mode with cascade recompilation
- Tracing GC with opt-in arena allocation for hot paths
- Package system —
weir.pkgmanifests, path-based dependencies, native C source compilation - C FFI —
extern "C"declarations withunsafeblocks
Working today:
- Compiler pipeline: lexer, parser, macro expander, type checker, Cranelift codegen
- Three execution modes: JIT (
weir run), AOT (weir build), tree-walking interpreter (weir interp) - Dev mode:
weir devwith file watching and function-level live reload - Package system: multi-package projects with dependency resolution and native code support
- OpenGL Tetris demo: full game built with Weir + GLFW/OpenGL via C FFI (
just tetris) - LSP server: diagnostics, hover, completion, go-to-definition, document symbols
- Zed extension: syntax highlighting and LSP integration
- 647 tests across the workspace
Requires Nix with flakes enabled:
git clone <repo-url> && cd weirlang
nix develop # activate dev environment
just test # run all testsRun a single file:
weir run examples/hello.weir # JIT compile and run
weir build examples/hello.weir # AOT compile to binary
weir dev examples/hello.weir # dev mode with live reloadRun a package project:
cd demos/tetris && weir run # discovers weir.pkg, resolves deps, runs via JITcrates/
weir-lexer/ Tokenizer
weir-parser/ S-expression parser → AST
weir-macros/ Macro expander
weir-typeck/ Type checker (local inference, typeclasses, ADTs)
weir-codegen/ Cranelift JIT/AOT backend + dev mode live reload
weir-interp/ Tree-walking interpreter
weir-runtime/ GC, arenas, runtime support
weir-pkg/ Package system (manifest parsing, dependency resolution)
weir-cli/ CLI frontend (clap)
weir-lsp/ Language Server Protocol implementation
weir-ast/ AST types, pretty printer, TCO analysis
design/ Language design documents
std/ Standard library (prelude)
demos/ Demo projects (tetris)
docs/ Documentation website (Astro + Starlight)
See docs/ for the full documentation site, or run just docs-dev to browse locally.
Personal project. No license specified.