Clarus is a small, compiled, event-driven language for building native
System 6/7 applications on 68k Macintosh computers. Programs are written as
typed declarations — windows, menus, records — plus event handlers; there is
no main. The compiler emits C for host builds and native 68k code directly
for the Macintosh, and it also runs on the Mac, as ClarusC.APPL.
window Game {
title: "Bounce"
size: 200, 200
canvas Board { at: 0, 0; fill: both; buffered }
var x: fixed = 10.0
var dx: fixed = 2.0
}
every 1 ticks {
var g: Game = Game.front
if g != nil {
g.x = g.x + g.dx
if g.x > 190.0 or g.x < 0.0 { g.dx = -g.dx }
g.Board.clear()
g.Board.fillCircle(int(g.x), 100, 8)
}
}The language is specified in docs/clarus-language-reference.md. Project status and sequencing live in docs/ROADMAP.md.
- Language reference — complete v1 draft (the normative spec).
- Host toolchain —
scripts/clarus-run.shcompiles and runs a program on the development machine, against a portable C runtime. - Self-hosting — done.
clarusc, the compiler written in Clarus (clarusc/*.cla), compiles itself: the three-stage bootstrap reaches a byte-identical fixed point, and the generated C snapshot is committed atclarusc/clarusc.cso the compiler can be rebuilt from any C compiler with no prior Clarus toolchain. - Macintosh target — native 68k
.APPLbinaries (clarusc emit68k, no C and no cross-compiler in the path), the full UI runtime — windows, menus, forms, tables, text editing, files — andClarusC.APPL, which compiles Clarus programs on the Mac itself. - Networking —
connectionover a serial port or AppleTalk (ADSP),serviceBrowsername discovery, and ATP request/responseservices. A command-line host build is a real LocalTalk-over-UDP peer on the same wire as an emulated Mac, so the two ends can find and call each other. - Toolbox catalog —
toolbox/*.claholds curated Inside Macintosh trap declarations for programs that need to reach past the language's own abstractions; see docs/clarus-toolbox-cookbook.md. - Next — MacTCP.
A C compiler is the only prerequisite. Bootstrap clarusc from the
committed snapshot:
cc -I runtime/host -o clarusc clarusc/clarusc.c runtime/host/rt.c
./clarusc FILE... # type-check only
./clarusc emit -o OUT.c FILE... # emit C for a host buildDay to day, one script does the bootstrap, the emission, the C compile and the run:
scripts/clarus-run.sh FILE.cla [-- args...]The test gates are two more scripts — the first after every change, the second before merging:
scripts/test-task.sh # ~1-2 minutes
scripts/test-merge.sh # ~15 minutes; needs the emulator| Path | Contents |
|---|---|
docs/ |
Language reference, cookbook, roadmap, and history |
clarusc/ |
The self-hosted compiler, written in Clarus, plus its committed C snapshot |
runtime/ |
The Clarus and C runtime modules spliced into every build |
toolbox/ |
Curated Inside Macintosh trap declarations, per manager |
examples/ |
Complete sample programs (atalkclock, texteditor, bookmarks, …) |
tests/ |
The test harness: a Make + POSIX-shell runner plus its C tools |
testdata/ |
Golden tests: valid programs, diagnostics, runtime behavior |
MIT — see LICENSE.
Copyright 2026, Andrew C. Young andrew@vaelen.org