feat(v4): v3's whole POST, Task 8 round -- the rules, and v4 where the rulings put it (#189)
v3's whole POST on v4 at 983 of 1010 (the table's own count with its drops), from 850.
What remains is capacity ("Dictionary full", the 100-900-deep stacks): next, as ruled.
Found and fixed under the rulings (docs/v4.0.0/POST-PARITY.md):
- IS and DEFER@ refuse a word DEFER did not make, as v3: error 22, "Not deferred".
v4's IS stored into any word -- POST's `42 IS DUP` broke DUP for every case after it.
DEFER marks its word with flag 128 (dict.f18).
- SMUDGE and HIDDEN are compile-only, as v3's table: at the prompt v4's hid the newest word.
- Q./ by zero gives 0 and no error (ruled: v3's table); error 11 retired. The ROM's,
the test's reference and its hand-assembled copy changed alike.
- FENCE is v3's: it protects what is defined so far. The variable is (FENCE).
- The line's length is (#SRC), no longer SPAN: an EXPECT in a line cut the rest of
the line off, and 0 EXPECT could not leave SPAN 0 (FORTH-83).
- POST gains V4_POST_HEAD: the values left and how the output begins -- the form of a
printout whose values are the run's own (TOP-WORDS, WORD-ENTROPY).
post_all_rules.py: the rest of the whole table where it is not taken as v3 ran it --
v4's units for the cases that wrote through HERE as a byte address (CMOVE>, BLANK,
ERASE, FILL wrote into the system's code), the standard's results (COMPARE, SEARCH,
BASE output, THRU, >BODY with FIND's address), v3's descriptions where v3 printed
otherwise, and the cases dropped with their reasons (SP@/SP! by D-2, DABS/DMIN
underflow, CMOVE>.bounds, THRU.negative_end).
make -C v4 test: all v4 tests passed (both widths, mesh-boot, inference).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
@@ -4,14 +4,17 @@
|
||||
\ dict.f18, quit.f18 and forth.f18.
|
||||
\
|
||||
\ Constants the loader supplies:
|
||||
\ FENCE word address of the variable: FORGET will not remove an entry
|
||||
\ (FENCE) word address of the variable: FORGET will not remove an entry
|
||||
\ that starts below the address it holds
|
||||
\ VOC-LINK word address of the variable: the newest vocabulary, or 0
|
||||
\ (BOOT) word address of two cells: DP and (LATEST) as the loader left them
|
||||
\ HEAT-OP ANTICLOCK word addresses of HEAT-OP[0] and ANTICLOCK, the heat
|
||||
\ registers (DECOMPOSITION.md section 7): read-only
|
||||
|
||||
set HDR-NFA here ", FENCE #id, #, 8 #, HDR-NFA #, HDR-LINK set HDR-LINK here : FENCE' FENCE ;
|
||||
\ ( -- ) as v3: what is defined now FORGET will not remove -- the fence is
|
||||
\ raised to HERE (v3's table; no standard defines FENCE, ruled 2026-11-14).
|
||||
set HDR-NFA here ", FENCE #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
: FENCE DP a! @ 3 + 2/ 2/ (FENCE) a! ! ;
|
||||
|
||||
\ ---- the heat registers (DECOMPOSITION.md section 7; #189) -----------------------
|
||||
\ Captain Bob, 2026-11-12: "Add HEAT-OP". The node counts every instruction it
|
||||
@@ -95,13 +98,13 @@ set HDR-NFA here ", VLIST #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK he
|
||||
\ FORGET xxx FORTH-79: remove xxx and every word defined after it, in
|
||||
\ whatever vocabulary; the space they took is free again. A vocabulary that
|
||||
\ goes is no longer CONTEXT or CURRENT: FORTH is. A word that is not there
|
||||
\ is an error, and so is one below FENCE, which is where the capsule's own
|
||||
\ is an error, and so is one below the fence, which is where the capsule's own
|
||||
\ words are (code 10, "Protected word").
|
||||
set HDR-NFA here ", FORGET #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
: FORGET
|
||||
32 WORD (LOOKUP) if MISSING
|
||||
-2 + a! @ \ where its name starts
|
||||
dup FENCE a! @ inv + 1 + -if OK \ name - fence
|
||||
dup (FENCE) a! @ inv + 1 + -if OK \ name - fence
|
||||
drop drop NODE-ERROR b! 10 !b ;
|
||||
OK: drop
|
||||
dup (Q) a! ! 4* DP a! ! \ the space from its name on
|
||||
@@ -153,7 +156,7 @@ set HDR-NFA here ", COLD #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK her
|
||||
: COLD
|
||||
(BOOT) a! @ DP a! !
|
||||
(BOOT)+1 a! @ (LATEST) a! !
|
||||
(BOOT) a! @ 2/ 2/ FENCE a! !
|
||||
(BOOT) a! @ 2/ 2/ (FENCE) a! !
|
||||
(BOOT-ID) a! @ (NEXT-ID) a! !
|
||||
(LATEST) CONTEXT a! ! (LATEST) CURRENT a! ! 0 VOC-LINK a! !
|
||||
10 BASE a! ! 0 SCR a! ! 2 (LOG-LEVEL) a! ! 0 (ACL-HOOK) a! ! EMPTY-BUFFERS
|
||||
@@ -165,20 +168,28 @@ set HDR-NFA here ", COLD #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK her
|
||||
\ ---- deferred words (as v3) -------------------------------------------------------
|
||||
\ DEFER xxx makes xxx, which does whatever word it has been given:
|
||||
\ ' yyy IS xxx gives it one; DEFER@ xxx leaves the one it has. A deferred
|
||||
\ word with none is an error (code 15, "Deferred word not set").
|
||||
\ word with none is an error (code 15, "Deferred word not set"). DEFER marks
|
||||
\ its word with flag 128 (dict.f18); IS and DEFER@ refuse any other word, as v3
|
||||
\ does ("was not created by DEFER"): error 22, "Not deferred".
|
||||
: (DODEFER)
|
||||
pop a! @ if UNSET push ; \ go to it: it returns to xxx's caller
|
||||
UNSET: drop NODE-ERROR b! 15 !b ;
|
||||
set HDR-NFA here ", DEFER #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
: DEFER &(DODEFER) (C)+3 a! ! (DATA) (C)+8 a! @ if NONE drop 0 jump , NONE: drop ;
|
||||
: DEFER &(DODEFER) (C)+3 a! ! (DATA) (C)+8 a! @ if NONE drop LATEST (FLAGS) a! @ 128 OR ! 0 jump , NONE: drop ;
|
||||
: (is!) a! ! ;
|
||||
\ ( "name" -- addr ) the data address of the deferred word named next
|
||||
: (DEFERRED)
|
||||
32 WORD (LOOKUP) if MISSING
|
||||
dup (FLAGS) a! @ 128 and if NOTDEF drop jump PFA
|
||||
NOTDEF: drop drop NODE-ERROR b! 22 !b ;
|
||||
MISSING: drop jump (UNKNOWN)
|
||||
: (defer@) a! @ ;
|
||||
set HDR-NFA here ", IS #id, #, 1 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
: IS
|
||||
(') STATE a! @ if NOW drop (LIT,) &(is!) jump (CALL,)
|
||||
(DEFERRED) STATE a! @ if NOW drop (LIT,) &(is!) jump (CALL,)
|
||||
NOW: drop jump (is!)
|
||||
set HDR-NFA here ", DEFER@ #id, #, 1 #, HDR-NFA #, HDR-LINK set HDR-LINK here
|
||||
: DEFER@
|
||||
(') STATE a! @ if NOW drop (LIT,) &(defer@) jump (CALL,)
|
||||
(DEFERRED) STATE a! @ if NOW drop (LIT,) &(defer@) jump (CALL,)
|
||||
NOW: drop jump (defer@)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user