forth: [, ], STATE, EVALUATE (+5; Hayes 463→477, 74%)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled

This commit is contained in:
2026-04-25 01:23:23 +00:00
parent 89a879799a
commit b1a7852045
5 changed files with 81 additions and 15 deletions

View File

@@ -91,7 +91,7 @@ Representation:
- [x] Double-cell ops: `D+`, `D-`, `D=`, `D<`, `D0=`, `2DUP`, `2DROP`, `2OVER`, `2SWAP` (already), plus `D>S`, `DABS`, `DNEGATE`
- [x] Number formatting: `<#`, `#`, `#S`, `#>`, `HOLD`, `SIGN`, `.R`, `U.`, `U.R`
- [x] Parsing/dictionary: `WORD`, `FIND`, `EXECUTE`, `'`, `[']`, `LITERAL`, `POSTPONE`, `>BODY` (DOES> deferred — needs runtime-rebind of last CREATE)
- [ ] Source/state: `SOURCE`, `>IN`, `EVALUATE`, `STATE`, `[`, `]`
- [x] Source/state: `EVALUATE`, `STATE`, `[`, `]` (`SOURCE`/`>IN` stubbed; tokenized input means the exact byte/offset semantics aren't useful here)
- [ ] Misc Core: `WITHIN`, `MAX`/`MIN` (already), `ABORT`, `ABORT"`, `EXIT`, `UNLOOP`
- [ ] File Access word set (via SX IO)
- [ ] String word set (`SLITERAL`, `COMPARE`, `SEARCH`)
@@ -106,6 +106,18 @@ Representation:
_Newest first._
- **Phase 5 — `[`, `]`, `STATE`, `EVALUATE` (+5; Hayes 463→477, 74%).**
`[` (IMMEDIATE) clears `state.compiling`, `]` sets it. `STATE`
pushes the sentinel address `"@@state"` and `@` reads it as
`-1`/`0` based on the live `compiling` flag. `EVALUATE` reads
the (addr,u) string from byte memory, retokenises it via
`forth-tokens`, swaps it in as the active input, runs the
interpret loop, and restores the saved input. `SOURCE` and
`>IN` exist as stubs that push zeros — our whitespace-tokenised
input has no native byte-offset, so the deeper Hayes tests
that re-position parsing via `>IN !` stay marked as errors
rather than silently misbehaving.
- **Phase 5 — parsing/dictionary words `'`/`[']`/`EXECUTE`/`LITERAL`/
`POSTPONE`/`WORD`/`FIND`/`>BODY` (Hayes 448→463, 72%).** xt is
represented as the SX dict reference of the word record, so