forth: BASE/DECIMAL/HEX/BIN/OCTAL (+9; Hayes 174/590)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled

This commit is contained in:
2026-04-24 20:40:11 +00:00
parent 35ce18eb97
commit acf9c273a2
8 changed files with 76 additions and 9 deletions

View File

@@ -80,7 +80,7 @@ Representation:
### Phase 4 — strings + more Core
- [x] `S"`, `C"`, `."`, `TYPE`, `COUNT`, `CMOVE`, `FILL`, `BLANK`
- [x] `CHAR`, `[CHAR]`, `KEY`, `ACCEPT`
- [ ] `BASE` manipulation: `DECIMAL`, `HEX`
- [x] `BASE` manipulation: `DECIMAL`, `HEX`
- [ ] `DEPTH`, `SP@`, `SP!`
- [ ] Drive Hayes Core pass-rate up
@@ -99,6 +99,15 @@ Representation:
_Newest first._
- **Phase 4 — `BASE`/`DECIMAL`/`HEX`/`BIN`/`OCTAL` (+9; Hayes unchanged).**
Moved `base` from its top-level state slot into `state.vars["base"]`
so the regular `@`/`!`/VARIABLE machinery works on it.
`BASE` pushes the sentinel address `"base"`; `DECIMAL`/`HEX`/`BIN`/
`OCTAL` are thin primitives that write into that slot. Parser
reads through `vars` now. Hayes unchanged because the runner had
already been stubbing `HEX`/`DECIMAL` — now real words, stubs
removed from `hayes-runner.sx`.
- **Phase 4 — `CHAR`/`[CHAR]`/`KEY`/`ACCEPT` (+7 / Hayes 168→174).**
`CHAR` parses the next token and pushes the first-char code. `[CHAR]`
is IMMEDIATE: in compile mode it embeds the code as a compiled push