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:
Claude
2026-11-14 05:59:11 +00:00
parent 3338abdc38
commit 1aa33f31bf
27 changed files with 330 additions and 90 deletions
+11 -2
View File
@@ -319,13 +319,18 @@ def main():
help="every case of v3's whole POST, every module and word, not the Required set alone "
"(#189 Phase 7, Task 8: the measure of parity); with --out, and no document written")
ap.add_argument("--out", default=None, help="write the table here, not system/post_cases.c")
ap.add_argument("--only", default=None, help="with --all: only these modules, comma-separated (to find what a case leaves behind)")
args = ap.parse_args()
global OUTPUT
if args.out:
OUTPUT = os.path.abspath(args.out)
if args.all: # the whole POST's own rules (post_all_rules.py), beside 79's
import post_all_rules
rules.STANDARD.update(post_all_rules.STANDARD)
rules.DROPPED.update(post_all_rules.DROPPED)
required, left_out, cases, seen = set(REQUIRED), [], [], {}
for module in (MODULES_ALL if args.all else MODULES):
for module in ([m for m in MODULES_ALL if not args.only or m in args.only.split(",")] if args.all else MODULES):
for word, name, text, should_error in read_module(os.path.join(MODULE_DIR, module)):
if word not in required and not args.all:
continue
@@ -395,7 +400,9 @@ def main():
continue
lines = pack("T|", atoms(rule.get("text", case["text"])))
assert lines, label
if "depth" in rule:
if "head" in rule: # the form of a printout whose values are the run's own
emit(label, lines, {"expect": "V4_POST_HEAD", "stack": [], "depth": rule.get("depth", 0), "out": rule["head"]})
elif "depth" in rule:
emit(label, lines, {"expect": "V4_POST_DEPTH", "stack": [], "depth": rule["depth"], "out": ""})
else:
emit(label, lines, expectation(rule.get("error", False), rule.get("stack", []), rule.get("out", "")))
@@ -481,6 +488,8 @@ def code(text):
def expects(rule):
if rule.get("error"):
return "an error"
if "head" in rule:
return "%d value(s) left; prints, to begin with, `%s`" % (rule.get("depth", 0), rule["head"].replace("\n", "\\n"))
if "depth" in rule:
return "%d value(s) left; output not compared" % rule["depth"]
return "stack `%s`, prints %s" % (" ".join(str(v) for v in rule.get("stack", [])) or "empty",