Files
ww/.gitignore
Hojun-Cho ab173b095a examples: lisp — pure-ww Lisp interpreter, REPL, in-process tests
Demo program that lives entirely on lib/* and libwwrt.a — no @symbol
FFI of its own. The interpreter sits in lispcore.ww (exports for the
test driver); lisp.ww is a 3-line entry that calls lispcore.repl().

Language surface: integers, floats, symbols, strings, lists, lambdas
with closures, define / set! / if / quote / let / begin, recursion
(fact / fib / ackermann / gcd), map / filter / reduce as user code.

REPL is line-buffered: each read tries to parse one top-level form,
asks for more on "unterminated list", evaluates and prints, then
shifts consumed bytes off the front of the buffer. Lookahead-aware —
the parser primes one extra token so we shift to L.curstart, not
L.pos, otherwise the first byte of the next form gets eaten.

lisp_test.ww exec'd as a regular binary (ww test drops -I in single-
file mode); 66 probes cover arithmetic, lists, closures, recursion,
errors. test_*.lisp drive the live REPL through `make demo`.

The wwstage cgen still mis-lowers a handful of patterns at this
shape of program — top-level array indexing, global-ptr deref,
two-level field stores, f64 routing through *T, alloc(structlit{})
for f64/str fields, (slice | E) returns, xs[i].kind chains, f64
compound assigns. Each workaround is annotated at its use site;
the full taxonomy is in examples/lisp/CLAUDE.md.
2026-05-12 22:33:24 +09:00

42 lines
1.4 KiB
Plaintext

# Build outputs.
/out/
# Claude Code session artifacts.
.claude/
# Stray executables produced by ad-hoc `ww build` runs in the project
# root. Real source for these lives under selfhost/test/ as .ww files.
/loop
/sym_link
# Per-module build artifacts. The .combined.ww files under selfhost/
# are intentionally tracked — they're frozen bootstrap inputs.
selfhost/**/*.o
selfhost/**/*.s
# Test-probe leftovers. `ww build` drops .combined.ww next to the
# source; the selfhost/test/ probes don't need them tracked.
selfhost/test/*.combined.ww
# `ww build` on a lib/ module leaves a .combined.ww next to the
# source. None of these are bootstrap inputs (those are under
# selfhost/cmd/*/main.combined.ww) — they're just transient.
lib/**/*.combined.ww
# examples/ build outputs. Each example has its own Makefile that
# leaves the .s/.o/.combined.ww plus a stripped binary behind.
examples/**/*.o
examples/**/*.s
examples/**/*.combined.ww
examples/mandelbrot/mandelbrot
examples/cmatrix/cmatrix
examples/lisp/lisp
examples/lisp/lisp_test
# Stage-0 binaries under bootstrap/<arch>/. Untracked by default —
# committing them is the v1.0 lock per PLAN.md (the new trust
# surface). `make bootstrap-snapshot` populates the dir from the
# current wwstage; `make nocc` verifies they self-reproduce.
# To ship, `git add -f bootstrap/amd64/{ww,w6c,w6a,w6l}` explicitly.
bootstrap/*/*