feat(v4): v3's whole POST is v4's POST -- 990 cases, all passed on Hera (#189)

Phase 7, Task 8: PARITY:V4_POST tests=990 pass=990 fail=0 on Hera (mesh-boot); the hosted
product 945 of them, all passed -- the 45 cases of physics.4th's words need the kernel.

- Enlarged, as ruled ("Enlarge v4 to fit"): a node is 32768 words, its data stack 1024
  deep (v3's), host and kernel alike; the dictionary's end moves with them.
- POST's runner compares every value a case leaves (v3's leave 101); V4_POST_KERNEL marks
  a case of the kernel's words, and a host without a kernel does not run it.
- mkpost.py --all is POST's table (make -C v4 post79), with docs/v4.0.0/POST.md; it reads a
  module's #defines (v3's Mama cases are MAMA_IMPLEMENTED, 0: v3's own POST skips all 20);
  it cuts no line between a word and the name it takes.
- Rules for the last of the table: the min/max and array-sum programs written as meant,
  CREATE's 26-character name (FORTH-79: 31), many_defs.
- POST_FLOOR 990.
- Tests sized for a 32-deep stack and a 16384-word node made deep-stack-ready
  (test_host_depth, test_host_quit, test_host_node, hosted-check, depthsweep.py).

make -C v4 test: all v4 tests passed. make -C kernel/tests test: all passed.
depthsweep at 1024: 230 runs, 0 failures. v4-checks running.

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 08:12:23 +00:00
parent 1aa33f31bf
commit 37469f6c54
23 changed files with 2701 additions and 1299 deletions
+22
View File
@@ -40,6 +40,16 @@ FORM = "v3's own word, its output v3's own words and counts: the form kept, v4's
WE_HEAD = "Word Usage Statistics (Execution Heat Counts):\n=============================================\n"
def TOPHEAD(n): return "Top %d most frequently used words:\n==================================\n" % n
MINMAX = ("FORTH-79 VARIABLE is a defining word: run inside INIT-MINMAX it takes its name from the input then -- "
"'42', then 'UPDATE-MINMAX' -- and a word named 42 hides the number from every case after it (42 U. printed "
"an address). v3's table says the case runs (TEST_NORMAL, 'Min/Max tracker'): written as meant, the variables "
"made outside, named so as not to hide MIN and MAX")
F79NAME = "FORTH-79: a name is up to 31 characters -- 26 is no error; v3's table expects one, v3 raised none (the standard first)"
V3TABLE_RUN = "v3's table says the case runs (TEST_NORMAL); v3 raised an error it does not say"
ARRAY = ("v3's table says the case runs (TEST_NORMAL, 'Array sum program'), but as written ': ARRAY 5 CELLS ALLOT ;' "
"names nothing and 'ARRAY NUMS' is an unknown word in any FORTH: written as meant, NUMS made by CREATE")
STANDARD = {
# ---- memory_words ----
"C,.basic": {"text": "ALIGN HERE 4 * 65 C, C@ . CR", "stack": [], "out": "65 \n", "why": D1},
@@ -153,6 +163,18 @@ STANDARD = {
"TOP-WORDS.after_reset": {"head": TOPHEAD(5), "why": FORM},
"TOP-WORDS.single_word": {"head": TOPHEAD(1), "why": FORM},
"TOP-WORDS.large_count": {"head": TOPHEAD(100), "why": FORM},
# ---- integration ----
"DATA_STRUCTURES.stack_min_max": {"text": "VARIABLE TMIN 2147483647 TMIN ! VARIABLE TMAX -2147483648 TMAX ! "
": UPDATE-MINMAX ( n -- ) DUP TMIN @ < IF DUP TMIN ! ELSE DROP THEN "
"DUP TMAX @ > IF DUP TMAX ! ELSE DROP THEN ; "
"42 UPDATE-MINMAX 17 UPDATE-MINMAX 99 UPDATE-MINMAX TMIN @ . TMAX @ . CR",
"stack": [], "out": "17 42 \n", "why": MINMAX + " -- and run as FORTH runs it: UPDATE-MINMAX's ELSE DROP drops n when it is no new minimum, so 99 never reaches the maximum's test, which takes the 42 the first call left"},
"CREATE.long_name": {"stack": [], "out": "", "why": F79NAME},
"DICT_PRESSURE.many_defs": {"stack": [], "out": "20 \n", "why": V3TABLE_RUN},
"COMPLETE_PROGRAMS.array_sum": {"text": "CREATE NUMS 5 CELLS ALLOT : STORE-NUMS 10 NUMS 0 CELLS + ! 20 NUMS 1 CELLS + ! "
"30 NUMS 2 CELLS + ! 40 NUMS 3 CELLS + ! 50 NUMS 4 CELLS + ! ; "
": SUM-NUMS 0 5 0 DO NUMS I CELLS + @ + LOOP ; STORE-NUMS SUM-NUMS . CR",
"stack": [], "out": "150 \n", "why": ARRAY},
# ---- mixed_arithmetic_words: M+ (ANS); M/MOD (v3's own; the double written as FORTH-79 has it) ----
"M+.basic": {"stack": [], "out": "100 200 \n", "why": ANS_MPLUS},
"M+.overflow": {"stack": [], "out": "2147483647 1 \n", "why": ANS_MPLUS},