proof/: model the TIB name-parse primitive, close it into CONSTANT's full model

input_buffer/input_length/input_pos (include/vm.h:415-417) turned out to
be plain per-VM array/scalar fields, not host pointers -- unlike almost
every other input-adjacent gap in this suite. vm_parse_word (src/vm.c:
137-160) is a pure whitespace-delimited scan over them, now modelled as
forth_parse_word in StarForth_Base.thy (is_ws + dropWhile/takeWhile,
faithful to the C's skip-then-copy-with-truncation loop, including that
input_pos only advances past a truncated token by what was actually
copied, matching the C's `len < max_len - 1` bound exactly).

dict_insert_entry (added last session) now takes the entry's name as a
parameter instead of hardcoding the empty string. forth_constant_full
composes forth_parse_word with dict_insert_entry end-to-end as a worked
example: CONSTANT's real order (stack-underflow guard -> pop value ->
parse name -> vm_create_word) is modelled in full up to the data-field
write, which remains the one still-open gap. The other four entry-half
definitions (:/CREATE/VARIABLE/DEFER) take the parsed name as a caller
parameter for now rather than repeating the same composition four more
times in one pass.

Full suite (54 theories) verifies green.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Robert Allan James
2026-08-14 22:53:11 -04:00
co-authored by Claude Sonnet 5
parent cc46cf83f1
commit 1aca77d55c
4 changed files with 229 additions and 54 deletions
+21 -7
View File
@@ -95,8 +95,20 @@ effort on the scale of what's already here:
- **The disk-backed block-window cache** (`block_subsystem.h` +
`blk_vm_lbn`/`blk_vm_cbuf`/`blk_vm_dirty`/`blk_vm_next`) — blocks
`block_words.c` and `editor_words.c` almost entirely.
- **The TIB / interactive input subsystem**blocks the `(`/`\` comment
words, `KEY`, `."`, `ABORT"`'s compile-time half, `SEE`.
- **The TIB / interactive input subsystem — partially closed 2026-08-14.**
`input_buffer`/`input_length`/`input_pos` turned out to be plain per-VM
array/scalar fields, not host pointers, and `vm_parse_word` (the
whitespace-delimited name-parse every CREATE/VARIABLE/CONSTANT/`:`/
DEFER-family word depends on) is a pure scan — now modelled as
`forth_parse_word` in `StarForth_Base.thy`, composed with
`dict_insert_entry` for CONSTANT in `StarForth_Defining_Words.thy` as a
worked example. Still blocked: words needing a *different* scan shape
over the same buffer — `(`/`\` comment (skip-to-delimiter, not
whitespace-delimited), `KEY` (single raw character, not a parsed
token), `."`/`S"` (delimiter-terminated string literal), `ABORT"`'s
compile-time half, `SEE` (raw pointer walk) — each would need its own
scan function modelled against the same fields, not automatically
unlocked by `forth_parse_word`.
- **Real stdio/file I/O** — `SAVE-SYSTEM`, parts of `string_words.c`.
- **Raw C-string/strtol-backed words** — the rest of `string_words.c`.
- **Raw-pointer DictEntry navigation** (`>BODY`/`>NAME`/CFA-style words) —
@@ -106,11 +118,13 @@ effort on the scale of what's already here:
CONSTANT, DEFER) — **partially closed 2026-08-14.** `dict_insert_entry`
(`StarForth_Defining_Words.thy`) now models the word_id-assignment/
dictionary-table/`latest_id`/`word_id_next`-counter portion, reused by
all five words' `forth_*_entry_half` definitions. Still not modelled:
the name parse (TIB gap, same as everywhere else in this suite),
`vm->compiling_word` tracking (no vm_state field), the data-field (DF)
write each of the five words does afterward (still gap (b) below), and
the pin-shadow name-scan guard (sidestepped via an explicit
all five words' `forth_*_entry_half` definitions, which take the parsed
name as a caller-supplied parameter. `forth_constant_full` composes
`forth_parse_word` (the TIB gap above) in directly for CONSTANT, as a
worked example not yet repeated for the other four. Still not modelled
for any of the five: `vm->compiling_word` tracking (no vm_state field),
the data-field (DF) write each word does afterward (still gap (b)
below), and the pin-shadow name-scan guard (sidestepped via an explicit
`pinned_conflict :: bool` parameter, same technique as the XT-pop gap
elsewhere in this suite).
- **The vocabulary chain mechanics** (VOCABULARY/DEFINITIONS/CONTEXT/CURRENT/