|
|
@@ -52,19 +52,32 @@ A 1,763-line program (182 + 1,581 lines) that stops on the 111th line gives
|
|
|
no sense of progress unless "how far did we get" is a number in a test.
|
|
|
Make it one.
|
|
|
|
|
|
-**Proposal — `tests/fixtures/calc_ladder.tsv` (or a `run_compile_tests.sh`
|
|
|
-section):** run the compiler on a *copy* of `CALC.PAS` (plus, once it exists,
|
|
|
-`CALC.INC`) and assert the exact verdict:
|
|
|
+**Implemented (Stage 1, 2026-10-19) — `tests/fixtures/calc_ladder.tsv` plus
|
|
|
+`tests/calc_ladder.sh`,** run by `run_all.sh` as `CALC ladder`. Each row names a
|
|
|
+program and gives the exact verdict in the same shape as
|
|
|
+`tests/fixtures/expected.tsv`:
|
|
|
|
|
|
```
|
|
|
-calc_ladder ERR <errno> <pos>
|
|
|
+CALC.PAS ERR <errno> <pos>
|
|
|
```
|
|
|
|
|
|
-Each stage updates the row; the row may only move forward. This is the same
|
|
|
-shape as `tests/fixtures/expected.tsv`, so it reuses the existing harness
|
|
|
-instead of inventing a second one.
|
|
|
+The script stages a *copy* of the named program — and of the companions that
|
|
|
+sit beside it, so `CALC.INC` is already there for Stage 2 — into
|
|
|
+`tmp/calc_ladder/`, runs the freshly built compiler on it, and compares. It
|
|
|
+does not build the compiler itself: it calls
|
|
|
+`tests/run_compile_tests.sh --build-only`, which is the one recipe that
|
|
|
+freshness-checks `compiletest`, so the ladder cannot become the second
|
|
|
+staleness test that drifts from the first.
|
|
|
|
|
|
-Two traps to write down next to it:
|
|
|
+The copy is deliberate: the include (Stage 2) resolves relative to the
|
|
|
+including file, so `CALC.INC` has to be beside `CALC.PAS` in the staged tree,
|
|
|
+and the row then measures the compiler rather than an edit-in-place of
|
|
|
+`Resources/TP3`. It is not a fixture in `tests/fixtures/*.pas` (which would
|
|
|
+enter the compile/COM/exec matrices and need a second copy of `CALC.PAS` kept
|
|
|
+in sync).
|
|
|
+
|
|
|
+Each stage updates the row; the row may only move forward. Two traps are
|
|
|
+written next to the file itself:
|
|
|
|
|
|
- **`pos` is not a file offset.** `LoadFile` collapses CRLF *and* lone LF to a
|
|
|
single CR, so `pos` indexes the *normalised* buffer. `CALC.PAS` is 11,241
|
|
|
@@ -336,17 +349,32 @@ ladder order (each stage removes the blocker the previous one exposed).
|
|
|
|
|
|
### Session state — where to resume
|
|
|
|
|
|
-Last touched 2026-10-17. **No compiler change has been made yet**; this line of
|
|
|
-work is still entirely at the planning stage, and everything below is the
|
|
|
-*pre*-CALC baseline that Stage 1 must not break.
|
|
|
-
|
|
|
-- **HEAD** `ce7e8cd` (this document). Nothing pushed; `origin/master` is behind.
|
|
|
+Last touched 2026-10-19. **No compiler change has been made yet** — Stage 1 is
|
|
|
+the measuring device, not a compiler feature, so the front end is still exactly
|
|
|
+the *pre*-CALC baseline that every later stage must build on.
|
|
|
+
|
|
|
+- **HEAD** `ce7e8cd` (this document) plus the Stage 1 commit. Nothing pushed;
|
|
|
+ `origin/master` is behind.
|
|
|
+- **Stage 1 (the ratchet) is landed:** `tests/fixtures/calc_ladder.tsv` +
|
|
|
+ `tests/calc_ladder.sh`, wired into `run_all.sh` as `CALC ladder`. The row is
|
|
|
+ `CALC.PAS ERR 1 7791`, and it was **proved red first** (row set to 7792 →
|
|
|
+ `FAIL expected ERR 1 7792 / actual ERR 1 7791`, rc 1) before the real value
|
|
|
+ was written back. The compile matrix is still **56/56**.
|
|
|
+- **One surprise on resuming:** the working tree was found holding the
|
|
|
+ nonvacuity script's *frame-rule* mutation of `shell/Compiler.mod` (the
|
|
|
+ `locFree := 0FFFEH` / pre-decrement-base revert), i.e. a mutation from a
|
|
|
+ `tests/nonvacuity.sh` run that the trap did not restore — presumably killed
|
|
|
+ before the restore. It was reverted with `git checkout -- shell/Compiler.mod`
|
|
|
+ before anything was measured. Worth knowing: the mutation's whole shape is
|
|
|
+ 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 this commit:** `./tests/run_all.sh` →
|
|
|
- **OVERALL: ALL PASS** (~74 s), and the compile matrix is **56/56**. Those are
|
|
|
+ **OVERALL: ALL PASS**, compile matrix **56/56**, CALC ladder **1/1**. Those are
|
|
|
the numbers Stage 1's ratchet must leave intact.
|
|
|
- **Not re-run this session:** `tests/nonvacuity.sh` (78 ok / 0 failed at the
|
|
|
last run). It is not in the default `run_all.sh` and must be run **manually**
|
|
|
- after touching any check.
|
|
|
+ after touching any check — including, now, `run_compile_tests.sh`'s
|
|
|
+ `--build-only` branch.
|
|
|
- **Still present and deliberately untracked:** `Resources/TP3/CALC.COM` and
|
|
|
`Resources/TP3/HELLO.COM`, the two reference binaries used for §3.1. They are
|
|
|
derived from the proprietary `TURBO.COM`; do not stage them. The recipe and
|
|
|
@@ -379,10 +407,11 @@ work is still entirely at the planning stage, and everything below is the
|
|
|
|
|
|
### Next session
|
|
|
|
|
|
-**Stage 1 — the ratchet (§1).** Small. Lands the measuring device before the
|
|
|
-work it measures. Green for the current blockers, and it must be *proved red*
|
|
|
-first (assert a deliberately wrong position, watch it fail, then set the real
|
|
|
-one).
|
|
|
+**Stage 1 — the ratchet (§1). DONE.** `tests/calc_ladder.tsv` +
|
|
|
+`tests/calc_ladder.sh`, wired into `run_all.sh`; proved red against 7792 before
|
|
|
+it was set to 7791. It also resolved Q4 in favour of staging copies in
|
|
|
+`tmp/calc_ladder/` rather than teaching the compile matrix about companion
|
|
|
+files.
|
|
|
|
|
|
**Stage 2 — `{$I file}` include.** Small, self-contained, and a prerequisite:
|
|
|
`CALC.PAS:150` *is* the program.
|
|
|
@@ -566,10 +595,12 @@ as the include, because the include is what consumes the slack.
|
|
|
- **Q3.** `Pages = array[0..200] of string[80]` — confirm the element size is 81
|
|
|
and that `New (Buffer)` gets 16,281 contiguous bytes from the heap the way
|
|
|
TP3's `New` does.
|
|
|
-- **Q4.** Does `run_compile_tests.sh`/`CompileTest.mod` support a fixture with a
|
|
|
- companion `.inc` (Stage 2's fixture, and `calc_ladder` needs a copy of
|
|
|
- `CALC.INC`)? If not, decide whether the ladder lives in the harness or in a
|
|
|
- small dedicated script.
|
|
|
+- **Q4 — RESOLVED (Stage 1).** `run_compile_tests.sh`/`CompileTest.mod` still
|
|
|
+ have no fixture-with-companion-file notion, and they do not need one: the
|
|
|
+ ladder is a small dedicated script (`tests/calc_ladder.sh`) that stages
|
|
|
+ `CALC.PAS` and `CALC.INC` as copies in `tmp/calc_ladder/`. That is also what
|
|
|
+ makes the Stage 2 include resolve, since it opens the `.inc` relative to the
|
|
|
+ including file.
|
|
|
- **Q5.** Are range/index checks on by default for `TURBO.COM`? `CALC` sets
|
|
|
neither `{$R}` nor `{$V}`; if the default is *on*, `TU_RANGE_CHECK` and
|
|
|
`TU_INDEX_CHECK` are on the critical path for every index in CALC, not an
|