Selaa lähdekoodia

docs: record the VAR-parameter rung (ladder 13052)

CALC-COMPILE.md: the rung table gains v-TP3-CALC-VARPARAM (5eb82c4,
ERR 1 13052), the session state is dated and says eighteen rungs, the
baseline is the run just made (74/74 compile, 63/63 executed under both
oracles, non-vacuity 94/94), and the next-session plan marks item 6 done
and names item 11 - comma-separated CASE labels - as the next rung.

SUMMARY.md: the intro now stops at ERR 1 13052 and lists var parameters
among the landed features.
Eric Streit 1 päivä sitten
vanhempi
commit
d1915bb062
2 muutettua tiedostoa jossa 28 lisäystä ja 28 poistoa
  1. 23 23
      CALC-COMPILE.md
  2. 5 5
      SUMMARY.md

+ 23 - 23
CALC-COMPILE.md

@@ -97,7 +97,7 @@ Current rung (measured today, normalised position):
 
 | position | blocker |
 |---|---|
-| **12901** | `procedure IBMCh(var Ch: Char)` — a `var` parameter, and its name shadows a global (`ERR 41`) |
+| **13052** | `'G', 'I', 'O', 'Q':' in `IBMCh` — a comma-separated CASE label list (`ERR 1`) |
 
 Rungs behind it (now passed):
 
@@ -115,12 +115,13 @@ Rungs behind it (now passed):
 | 10927 | `Read(Kbd, Ch)` — a READ with a leading file | `Kbd` + `ClrEol` |
 | 12083 | `NormVideo`/`LowVideo`/`Delay` | attribute byte + busy loop; and the repeat-body parser bug fixed |
 | 12672 | `KeyPressed` | `INT 21h AH=0B`, in Exec86 and bootcom too |
+| 12901 | `var` parameters | by reference + DupTest shadowing (`t73_varparam`) |
 
 Rungs ahead:
 
 | position | blocker |
 |---|---|
-| 12901 | `var` parameters (implement by reference, do not record as value), plus parameter shadowing of globals; then the rest of `CALC.INC` |
+| 13052 | comma-separated CASE labels; then the rest of `CALC.INC` |
 
 Corrections the measurements force, worth stating plainly because the stage list
 below was written before them:
@@ -394,12 +395,12 @@ ladder order (each stage removes the blocker the previous one exposed).
 
 ### Session state — where to resume
 
-Last touched 2026-10-20. **Seventeen rungs are landed across two sessions**
+Last touched 2026-10-21. **Eighteen rungs are landed across three sessions**
 (Stages 1-4, sets, enums, record types, array declarations, element/field
 access, file types, the calling convention and string value parameters,
-`Length`, the CRT identifiers, `Kbd`, and `KeyPressed`). The ladder row has
-moved from the first typed constant at 7791 to **12901, inside `CALC.INC`'s
-`procedure IBMCh(var Ch: Char)`**.
+`Length`, the CRT identifiers, `Kbd`, `KeyPressed`, and `var` parameters).
+The ladder row has moved from the first typed constant at 7791 to **13052,
+inside `CALC.INC`'s `IBMCh` — its comma-separated CASE labels**.
 
 The rung commits and their tags, in order (each is one rung with its own
 fixture, red proof, and — where the harness allows — execution under qemu and
@@ -423,10 +424,11 @@ Exec86):
 | `14ce590` | `v-TP3-CALC-CRT` | `ERR 41 10927` (`Read(Kbd, Ch)`) |
 | `4c165e1` | `v-TP3-CALC-KBD` | `ERR 102 12083` (`NormVideo`) |
 | `89c6ca6` | `v-TP3-CALC-CRT2` | `ERR 41 12672` (`KeyPressed`) |
-| `033eb8e` | `v-TP3-CALC-KEYPRESSED` | **`ERR 41 12901`** (`IBMCh`'s `var` parameter) |
+| `033eb8e` | `v-TP3-CALC-KEYPRESSED` | `ERR 41 12901` (`IBMCh`'s `var` parameter) |
+| `5eb82c4` | `v-TP3-CALC-VARPARAM` | **`ERR 1 13052`** (comma-separated CASE labels) |
 
-- **Code HEAD** `033eb8e` (`v-TP3-CALC-KEYPRESSED`); this commit only updates
-  this document.  Nothing pushed; `origin/master` is behind by ten code
+- **Code HEAD** `5eb82c4` (`v-TP3-CALC-VARPARAM`); this commit only updates
+  this document.  Nothing pushed; `origin/master` is behind by eleven code
   commits.  Two non-ladder commits in the same period are the terminal-config
   work (`v-TP3-TERMCFG`) and the editor key map (`v-TP3-EDITORKEYS`); they do
   not move the ladder and are documented in `TERMINAL.md`.
@@ -528,10 +530,10 @@ Exec86):
   byte-for-byte the same for INTEGER locals, so the compile matrix would have
   been green and only `t40_readln` (and later CALC) would have noticed.
 - **Verified baseline, run on the code HEAD above:** `./tests/run_all.sh` →
-  **OVERALL: ALL PASS**, compile matrix **73/73**, CALC ladder **1/1** at
-  `ERR 41 12901`, terminal config **4/4**, 64 `.COM` linked and **62 executed
+  **OVERALL: ALL PASS**, compile matrix **74/74**, CALC ladder **1/1** at
+  `ERR 1 13052`, terminal config **4/4**, 64 `.COM` linked and **63 executed
   under both qemu and Exec86** (`t64_arrays` is compile-only: its image is past
-  the 8 KB boot-sector read).  `tests/nonvacuity.sh`: **92 ok, 0 failed**.
+  the 8 KB boot-sector read).  `tests/nonvacuity.sh`: **94 ok, 0 failed**.
 - **`tests/nonvacuity.sh`:** re-run after this commit's cases (the set
   membership bit among them); see the commit message for the count. It is not in
   the default `run_all.sh` and must be run **manually** after touching any check.
@@ -567,7 +569,7 @@ Exec86):
 
 ### Next session — the concrete plan
 
-The ladder is at `ERR 41 12901`, **`procedure IBMCh(var Ch: Char)`**.  Everything
+The ladder is at `ERR 1 13052`, **`IBMCh`'s comma-separated CASE labels**.  Everything
 below is ordered by what the ladder will hit next, not by the original stage
 numbers (the measurements have reordered them repeatedly).  Each item is the
 same shape as the rungs already landed: one focused change, one fixture that is
@@ -597,14 +599,10 @@ commit.
    first range's count.  Constant indices and `.field` are already done.
 5. **Pointers and the heap** (`^T`, `New`, `Dispose`, `Buffer^[i]`), 4-byte
    (offset then segment); the heap must hold `Pages` (16,281 bytes).
-6. **`var` parameters by reference — THE NEXT RUNG (12901).**  Today `var` is
-   parsed and then **silently recorded as a value parameter**, which is the §7
-   failure mode and must be replaced, not extended.  Push an address (a 2-byte
-   slot) from the caller, load/store through `[BP+off]` in the callee, and fix
-   `DupTest` in the same increment so an inner declaration may shadow an outer
-   name (duplicates at the SAME level stay errors).  Fixing `DupTest` alone
-   would let CALC past `IBMCh` with a silent miscompile: `IBMCh(Ch)` must
-   update the caller's `Ch`.
+6. **`var` parameters by reference — DONE** (`v-TP3-CALC-VARPARAM`).  The slot
+   holds an address; loads and stores go through it; READ into one pushes the
+   pointer.  `DupTest` now rejects only same-scope duplicates, so a parameter
+   may shadow a global.  `t73_varparam` executes all the address paths.
 7. **6-byte `real`** — literals, `+ - * /` and the six comparisons,
    `and`/`or` on results, integer conversions, `Str`/`Val` with widths and
    decimals, and `ln`/`exp`/`abs`/`sqrt`/`sqr`/`sin`/`cos`/`arctan`/`int`.
@@ -617,8 +615,10 @@ commit.
 10. **Recursion, `forward`, nesting** — `Fact` (direct self-recursion) and
     `Expression`/`Factor` (mutual via `forward`, the definition repeating only
     the name).
-11. **The `case` labels** (`^E`, `^X, ^J`, `#27`, comma lists) once `case` over
-    enumerators and chars is reached.
+11. **The `case` labels — THE NEXT RUNG (13052).**  `case Ch of 'H': ...
+    'G', 'I', 'O', 'Q': ... end`: the parser reads one label and then demands
+    `':'`, so a comma-separated list is `ENoSemi`.  Char labels themselves
+    (`^E`, `#27`) already parse; the list is what `IBMCh` uses.
 
 Then the two that are *outside* the ladder and gate the goal as stated:
 

+ 5 - 5
SUMMARY.md

@@ -2037,15 +2037,15 @@ census of what `CALC.PAS` actually needs and the reference measurements from
 the original `TURBO.COM`. Two tracks run in parallel: the ladder (front-end,
 verifiable on small fixtures) and the layout (§3, the only thing that stops
 the compiler *emitting* a 16,560-byte program). The ratchet and front-end
-features through **`KeyPressed`** are landed: the ladder
+features through **`var` parameters** are landed: the ladder
 (`tests/calc_ladder.sh` + `tests/fixtures/calc_ladder.tsv`, run by `run_all.sh`;
-CALC.PAS now stops at `ERR 41` at pos 12901, `IBMCh`'s var parameter), the `{$I}` include,
+CALC.PAS now stops at `ERR 1` at pos 13052, `IBMCh`'s comma-separated case labels), the `{$I}` include,
 `^X`/`#nn`, scalar typed constants, sets, enums, records (CellRec = 80),
 subranges, arrays, element/field access, file types, string value parameters,
 `Length`, the CRT identifiers (`ClrScr`/`GotoXY`/`ClrEol`/`LowVideo`/
-`NormVideo`/`Delay`), `Kbd`, `KeyPressed` (`INT 21h AH=0B`), and
-`INT 10h`+`C6` in Exec86 (fixtures through `t72_keypress`). The next rungs are
-`var` parameters (by reference, with the name-shadowing rule), the remaining string
+`NormVideo`/`Delay`), `Kbd`, `KeyPressed` (`INT 21h AH=0B`), `var` parameters
+(by reference; `t73_varparam`), and `INT 10h`+`C6` in Exec86 (fixtures through
+`t73_varparam`). The next rung is comma-separated CASE labels; then the remaining string
 builtins, file operations, variable-index subscripts + `with`, pointers, `var`
 params, reals, recursion, and the layout change. Items 1-4 below are
 independent of both.