Skip to content

Hello! 👋 My name is Nathan Weir. This is a fun personal project for using AI to build a bespoke, domain-specific programming language. It is not a serious, professional project. This site and the language itself are largely generated via Claude Code. If you find yourself programming with Weir, have fun - but use at your own risk!

Weir Language

A statically typed Lisp targeting native code via Cranelift — designed for fast iteration in game development.

A weir is a low dam built across a river to control water flow. It doesn’t block the river — it guides it. Weir the language follows the same principle: guard rails that prevent bugs without preventing expressiveness.

S-Expression Syntax

Lisp-family syntax with modern ergonomics — type annotations, collection literals ([], {}), threading macros (->, ->>), and keywords (:name).

Static Types

Declarative static typing with local inference. Explicit function signatures, inferred locals, algebraic data types, and exhaustive pattern matching.

Live Reloading

Function-level hot-swap in dev mode. Edit code, see changes instantly — the runtime patches function pointers without restarting your program.

Native Performance

Cranelift JIT for dev mode (fast compilation), AOT compilation for release binaries. Tracing GC with opt-in arena allocation for hot paths.

Package System

weir.pkg manifests with path-based dependencies, native C source compilation, and automatic dependency resolution.

C FFI

Call C libraries directly via extern "C" declarations. Build games with GLFW, OpenGL, SDL, and more — with unsafe blocks for safety.

;; Define a struct
(defstruct Vec2
(x : f64)
(y : f64))
;; Define a sum type
(deftype EnemyState
Idle
(Patrol Vec2 Vec2)
(Chase i64)
Dead)
;; Function with type annotations
(defn spawn-wave ((n : i32) (origin : Vec2)) : (List Enemy)
(map (fn (i)
(Enemy
:pos (Vec2 (* (to-f64 i) 32.0) (.y origin))
:health 100
:state Idle))
(range n)))
;; Pattern matching is exhaustive
(match enemy-state
((Patrol start end) (move-between start end))
((Chase target-id) (pursue target-id))
(Idle (stand-still))
(Dead (remove-entity)))

Weir is under active development. What works today:

  • Full compiler pipeline: lexer → parser → macro expander → type checker → Cranelift codegen
  • Three execution modes: JIT, AOT, and interpreter
  • Dev mode with file watching and live reload
  • Package system with multi-package projects
  • OpenGL Tetris demo (GLFW + OpenGL via C FFI)
  • LSP server with diagnostics, hover, completion, and go-to-definition
  • Zed editor extension with syntax highlighting
  • 647 tests across the workspace