From 26112f1003a4f509e229826b301258d192d7fbaa Mon Sep 17 00:00:00 2001 From: giles Date: Thu, 14 May 2026 06:53:36 +0000 Subject: [PATCH] =?UTF-8?q?plans:=20scheme-on-sx=20progress=20log=20?= =?UTF-8?q?=E2=80=94=2011=20phases=20done,=20296=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Loop closer documenting what 10 feature commits landed across the session. Phase-by-phase outcomes captured, including the SX cond multi-expression bug found and fixed during Phase 4. Chisel ledger: - env.sx already EXTRACTED with Scheme as third consumer - evaluator.sx + quoting.sx second-consumer-ready for follow-on kit-extraction commits - hygiene.sx still awaits the deferred Phase 6c (scope-set work) - combiner.sx and short-circuit.sx don't apply (Scheme has no fexprs and uses syntactic and/or) Deferred phases listed: full hygiene, nested quasi-depth, R7RS module rich features, dotted-pair syntax, full call/cc-wind interaction. Loop's defining feature: lib/guest CHISELLING discipline — every commit had a chisel note, and the cumulative work satisfies the two-consumer rule for three new kit extractions. --- plans/scheme-on-sx.md | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/plans/scheme-on-sx.md b/plans/scheme-on-sx.md index aed25cff..e0eca211 100644 --- a/plans/scheme-on-sx.md +++ b/plans/scheme-on-sx.md @@ -147,4 +147,45 @@ lib/scheme/tests/ — Standard pattern: parse, eval, lambda+closure, ## Progress log -_(awaiting Phase 1)_ +- 2026-05-14 — **Phases 1, 2, 3, 3.5, 4, 5abc, 6ab, 7, 8, 9, 10, 11 landed in one loop session.** 296 Scheme tests across 9 suites; ~1830 LoC of substrate. Test runner + scoreboard at `lib/scheme/test.sh` and `lib/scheme/scoreboard.md`. Three reflective kits unlocked: `env.sx` extracted directly as third consumer, `evaluator.sx` and `quoting.sx` second-consumer-ready for the kit-extraction commits (kit code is documented in `plans/kernel-on-sx.md`; Scheme consumer code is in place). + +### Phase-by-phase outcomes + +- Phase 1 (Parser, 62 tests): R7RS lexical syntax with reader macros, three comment flavours (`;`, `#;`, `#| |#`). +- Phase 2 (Eval + env third-consumer, 23 tests): `scheme-make-env` etc. are thin aliases for `refl-env-*` from `lib/guest/reflective/env.sx`. No adapter cfg needed — Scheme uses the canonical wire shape directly. +- Phase 3 (if/define/set!/begin/lambda + closures, 24 tests): factorial 10 → 3628800, counter via closed-over `set!`, curried lambda. +- Phase 3.5 (let/let*/cond/when/unless/and/or, 21 tests). +- Phase 4 (standard env + set! bugfix, 82 tests): variadic arithmetic, type predicates, list/string/char/vector ops, higher-order combinators. **Found and fixed an SX cond multi-expression branch bug** affecting set!. Bugfix unblocked 4 silently-failing tests in Phase 3. +- Phase 5a (call/cc, 8 tests): single-shot escape continuations. +- Phase 5b (raise/guard/with-exception-handler/error, 12 tests): catch-once-then-rehandle-outside pattern avoids handler-self-raise loops. +- Phase 5c (dynamic-wind, 5 tests): basic before-thunk-after with raise propagation. call/cc-escape tracking deferred. +- Phase 6a (define-syntax + syntax-rules, 12 tests): pattern matching with literals + pattern variables + list structure; template substitution. +- Phase 6b (syntax-rules ellipsis, 8 tests): tail-rest single-variable form. `(my-and 1 2 3)` etc. work. +- Phase 7 (eval / interaction-environment, 13 tests): **second consumer for evaluator.sx**. `interaction-environment` closes over the env being built, so user-side defines via `(eval ... ie)` persist across calls. +- Phase 8 (define-library + import, 7 tests): minimal module system. Private definitions stay in library env; only exports are visible after import. +- Phase 9 (define-record-type, 9 tests): tagged-dict records with optional mutators. +- Phase 10 (quasiquote runtime, 10 tests): **second consumer for quoting.sx**. Identical algorithm to Kernel's `knl-quasi-walk` — universal across reflective Lisps. +- Phase 11 (test.sh + scoreboard): single-process aggregating runner, scoreboard markdown. + +### Deferred phases + +- **Phase 6c — full hygiene**. Dybvig-style scope-sets / lifted-symbol algorithm. Would be the second consumer for the deferred `lib/guest/reflective/hygiene.sx`. Current macros work for common patterns but don't prevent introduced-binding capture. Research-grade work; warrants its own loop iteration. +- **Nested quasiquote depth tracking**. +- **R7RS module rich features** (`cond-expand`, `include`, import sets like `only`/`except`/`prefix`/`rename`). +- **Dotted-pair `(a b . rest)` parser syntax** + lambda rest-args. +- **Full call/cc + dynamic-wind interaction**: dynamic-extent re-entry/re-exit tracking. + +### Chisel ledger update + +This Scheme port satisfies the two-consumer rule for **three** reflective kits documented in the kernel-on-sx loop: + +| Kit | Status | +|-----|--------| +| `env.sx` | Extracted — Scheme is the third consumer (after Kernel + Tcl/Smalltalk), uses the canonical shape directly with no cfg | +| `evaluator.sx` | Second consumer ready — Scheme `eval`/`interaction-environment`/`null-environment`/`scheme-report-environment` mirror the proposed `refl-eval`/`refl-current-env`/`refl-make-environment` triple | +| `quoting.sx` | Second consumer ready — Scheme `scm-quasi-walk` is structurally identical to Kernel's `knl-quasi-walk`; the only difference is the unquote keyword names (cfg parameterisation) | +| `hygiene.sx` | Still awaiting (needs Phase 6c) | +| `combiner.sx` | N/A — Scheme has no fexprs | +| `short-circuit.sx` | N/A — Scheme `and`/`or` are syntactic, not operative | + +The kit-extraction commits themselves are follow-on work; this Scheme port is the consumer-side foundation.