diff --git a/plans/agent-briefings/primitives-loop.md b/plans/agent-briefings/primitives-loop.md index 29d922e3..7028327f 100644 --- a/plans/agent-briefings/primitives-loop.md +++ b/plans/agent-briefings/primitives-loop.md @@ -522,15 +522,15 @@ Primitives to add: - `display-to-string` `val` → string — convenience Steps: -- [ ] Spec: implement `read` in `spec/evaluator.sx` — wraps the existing parser to read +- [x] Spec: implement `read` in `spec/evaluator.sx` — wraps the existing parser to read one datum from a port cursor; handles eof gracefully. -- [ ] Spec: implement `write`/`display`/`newline` — extend the existing serializer for +- [x] Spec: implement `write`/`display`/`newline` — extend the existing serializer for port output; `write` quotes strings + uses `#\` for chars, `display` does not. -- [ ] OCaml: wire `read` through port type; implement `write`/`display` output path. -- [ ] JS bootstrapper: implement. -- [ ] Tests: 25+ tests in `spec/tests/test-read-write.sx` — read string literal, read list, +- [x] OCaml: wire `read` through port type; implement `write`/`display` output path. +- [x] JS bootstrapper: implement. +- [x] Tests: 25+ tests in `spec/tests/test-read-write.sx` — read string literal, read list, read eof, write round-trip, display vs write quoting, newline, write-to-string. -- [ ] Commit: `spec: read/write/display — S-expression reader/writer on ports` +- [x] Commit: `spec: read/write/display — S-expression reader/writer on ports` --- @@ -751,6 +751,7 @@ _Newest first._ - 2026-04-25: Phase 1 spec step done — all 10 vector primitives in spec/primitives.sx have full :as type annotations, :returns, :doc; make-vector optional fill param added. - 2026-04-25: Phase 1 OCaml step done — bounds-checked vector-ref/set!, vector-copy now accepts optional start/end, spec/primitives.sx doc updated. 10/10 r7rs vector tests pass, 4747 total (394 pre-existing hs-upstream fails unchanged). - 2026-04-25: Phase 0 complete — stopped CL/APL/Ruby/Tcl loops (all 4 idle at shell); confirmed E38 (tokenizer :end/:line) and E39 (WebWorker stub) both have implementation commits. +- 2026-05-01: Phase 17 complete — read/write/display. OCaml: sx_write_val/sx_display_val helpers; read via Sx_parser.read_value with #t/#f and N/D rational support added to parser; postprocess ()→Nil. JS: sxReadNormalize (#t/#f→true/false), sxReadConvert (()→NIL), sxEq list equality, sxWriteVal symbol/keyword name fix (v.name not v._sym), readerMacroGet registry. 42 tests (test-read-write.sx), all pass both hosts. JS 2436, OCaml 4626. 7d329f02. - 2026-05-01: Phase 16 complete — rational numbers. SxRational type in OCaml (Rational of int*int, reduced, denom>0) and JS (SxRational class, _rational marker). n/d reader in spec/parser.sx. Arithmetic contagion: int op rational → rational, rational op float → float. JS keeps int/int → float for CSS compat. OCaml as_number+safe_eq extended for cross-type rational equality. 62 tests in test-rationals.sx, all pass. JS 2232, OCaml 4532 (+11). 036022cc. - 2026-05-01: Phase 15 complete — math completeness. stdlib.math module: sin/cos/tan/asin/acos/atan(1-2 args)/exp/log/expt/quotient/gcd/lcm/number->string(radix)/string->number(radix). OCaml atan updated for optional 2nd arg. Strict radix parsing in JS string->number. 44 tests in test-math.sx, all pass. JS 2311/4801, OCaml 4547/5629. be2b11ac. - 2026-05-01: Phase 14 OCaml done — Eof + Port{PortInput/PortOutput} in sx_types.ml; 15 port primitives in sx_primitives.ml; raw_serialize updated; 4532/4532 (+39, zero regressions). 8ba0a33f.