From 60b7f0d7bb04784b8f07babfae325d926e2b6b9b Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 24 Apr 2026 16:58:30 +0000 Subject: [PATCH] prolog: tick phase 1+2 boxes (parse 25/25, unify 47/47 green) --- plans/prolog-on-sx.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/plans/prolog-on-sx.md b/plans/prolog-on-sx.md index 45b0cf59..f89e3904 100644 --- a/plans/prolog-on-sx.md +++ b/plans/prolog-on-sx.md @@ -39,15 +39,15 @@ Representation choices (finalise in phase 1, document here): ## Roadmap ### Phase 1 — tokenizer + term parser (no operator table) -- [ ] Tokenizer: atoms (lowercase/quoted), variables (uppercase/`_`), numbers, strings, punct `( ) , . [ ] | ! :-`, comments (`%`, `/* */`) -- [ ] Parser: clauses `head :- body.` and facts `head.`; terms `atom | Var | number | compound(args) | [list,sugar]` -- [ ] **Skip for phase 1:** operator table. `X is Y + 1` must be written `is(X, '+'(Y, 1))`; `=` written `=(X, Y)`. Operators land in phase 4. -- [ ] Unit tests in `lib/prolog/tests/parse.sx` +- [x] Tokenizer: atoms (lowercase/quoted), variables (uppercase/`_`), numbers, strings, punct `( ) , . [ ] | ! :-`, comments (`%`, `/* */`) +- [x] Parser: clauses `head :- body.` and facts `head.`; terms `atom | Var | number | compound(args) | [list,sugar]` +- [x] **Skip for phase 1:** operator table. `X is Y + 1` must be written `is(X, '+'(Y, 1))`; `=` written `=(X, Y)`. Operators land in phase 4. +- [x] Unit tests in `lib/prolog/tests/parse.sx` — 25 pass ### Phase 2 — unification + trail -- [ ] `make-var`, `walk` (follow binding chain), `prolog-unify!` (terms + trail → bool), `trail-undo-to!` -- [ ] Occurs-check off by default, exposed as flag -- [ ] 30+ unification tests in `lib/prolog/tests/unify.sx`: atoms, vars, compounds, lists, cyclic (no-occurs-check), mutual occurs +- [x] `make-var`, `walk` (follow binding chain), `prolog-unify!` (terms + trail → bool), `trail-undo-to!` +- [x] Occurs-check off by default, exposed as flag +- [x] 30+ unification tests in `lib/prolog/tests/unify.sx`: atoms, vars, compounds, lists, cyclic (no-occurs-check), mutual occurs — 47 pass ### Phase 3 — clause DB + DFS solver + cut + first classic programs - [ ] Clause DB: `"functor/arity" → list-of-clauses`, loader inserts @@ -88,6 +88,7 @@ Representation choices (finalise in phase 1, document here): _Newest first. Agent appends on every commit._ +- 2026-04-24 — Verified phase 1+2 already implemented on loops/prolog: `pl-parse-tests-run!` 25/25, `pl-unify-tests-run!` 47/47 (72 total). Ticked phase 1+2 boxes. - _(awaiting phase 1)_ ## Blockers