|
|
@@ -95,35 +95,34 @@ Current rung (measured today, normalised position):
|
|
|
|
|
|
| position | blocker |
|
|
|
|---|---|
|
|
|
-| **7972** | `Numbers : set of Char = ['0'..'9']` — a **set** typed constant (`ParseType` `TkSet`, `ERR 102`) |
|
|
|
+| **8098** | `Attributes = (Constant,Formula,…)` — an **enumeration** type (`ERR 41`) |
|
|
|
|
|
|
Rungs behind it (now passed):
|
|
|
|
|
|
| was | blocker | done by |
|
|
|
|---|---|---|
|
|
|
-| 7791 | `FXMax : Char = 'G'` — typed constant (`DefConst`, `ENoSemi` 1) | Stage 4 (scalar) |
|
|
|
-| 7791 | `EofLine = ^M` — caret character constant (`ERR 41`) | Stage 3 |
|
|
|
+| 7791 | `FXMax : Char = 'G'` — scalar typed constant | Stage 4 (scalar) |
|
|
|
+| 7791 | `EofLine = ^M` — caret character constant | Stage 3 |
|
|
|
+| 7972 | `Numbers : set of Char = ['0'..'9']` — set typed constant | sets, increment 1 |
|
|
|
|
|
|
-Rungs ahead, unchanged in the census but they now sit *behind* 7972:
|
|
|
+Rungs ahead:
|
|
|
|
|
|
| position | blocker |
|
|
|
|---|---|
|
|
|
-| 8036 | `Attributes = (Constant,…)` — enumeration (`ERR 41`) |
|
|
|
-| 8060 | `SetOfAttri = Set of Attributes` (`ERR 102`, `ENoLib`) |
|
|
|
+| 8060+ | `SetOfAttri = Set of Attributes` — a set over an enum (`ERR` — needs enums) |
|
|
|
| 8237 | `CellRec = record` (`ERR 102`, `ENoLib`) |
|
|
|
|
|
|
-Two corrections the measurements force, both worth stating plainly because the
|
|
|
-stage list below was written before them:
|
|
|
+Corrections the measurements force, worth stating plainly because the stage list
|
|
|
+below was written before them:
|
|
|
|
|
|
- **The include (Stage 2) does not move the rung.** It is at normalised `9404`,
|
|
|
past the stop, so Stages 3-4 had to happen before the include is ever reached.
|
|
|
- **`7791 → 8036` in one stage was optimistic.** `CALC.PAS:114`,
|
|
|
`Numbers : set of Char = ['0'..'9']`, is a typed constant whose *type* is a
|
|
|
- set, and it comes before the enumeration at 8036. So the compiler now stops at
|
|
|
- **7972**, on sets, and the enumeration at 8036 cannot be reached until sets
|
|
|
- exist — i.e. sets (Stage 6) must come before enums (Stage 5) in the real
|
|
|
- order, not after. The measured ladder is the authority; the stage numbering
|
|
|
- below is kept for reference but is no longer the dependency order.
|
|
|
+ set, and it comes before the enumeration at 8036. Sets had to go first, and
|
|
|
+ now they have — the compiler stops at **8098**, on the enumeration. **The
|
|
|
+ measured ladder is the authority; the stage numbering below is the original
|
|
|
+ plan, not the dependency order.**
|
|
|
|
|
|
---
|
|
|
|
|
|
@@ -138,12 +137,15 @@ stripped.
|
|
|
|---|---|---|
|
|
|
| `{$I CALC.INC}` | `CALC.PAS:150` | **done (Stage 2)** — expanded before parsing; `t56`/`t57`/`t58` |
|
|
|
| typed constants (`X : T = v`) — **scalar** | `CALC.PAS:111` | **done (Stage 4)** — declared class kept; `t59_typedconst` |
|
|
|
-| typed constants — **set/array** | `CALC.PAS:114,137`; `CALC.INC:777` | `ERR 102` — needs initialised storage |
|
|
|
+| typed constants — **set** | `CALC.PAS:114` | **done (sets, increment 1)** — code-resident bytes; `t61_setconst` |
|
|
|
+| typed constants — **array** | `CALC.PAS:137`; `CALC.INC:777` | `ERR 102` — needs initialised storage |
|
|
|
| lexical `^M`, `#nn` | `CALC.PAS:113` | **done (Stage 3)** — `t60_charcaret` |
|
|
|
-| enum type `(Constant,Formula,…)` | `CALC.PAS:120` | `ERR 41` |
|
|
|
+| enum type `(Constant,Formula,…)` | `CALC.PAS:120` | `ERR 41` — the current rung |
|
|
|
| subrange types `'A'..'G'`, `0..20`, `string[70]` | `CALC.PAS:117,119,130` | OK |
|
|
|
-| `set of Char`, `set of Attributes` | `CALC.PAS:114,121,127` | `ERR 102` |
|
|
|
-| set constructor `[a..b, c]`, `in`, `+`, `*`, `=`/`<>`, assignment | 47 × `in`, 6 × `+ [`, 2 × `*` | not implemented |
|
|
|
+| `set of Char` / `set of <subrange>` | `CALC.PAS:114` | **type + sizing done** (hybrid bytes) |
|
|
|
+| `set of <enum>` | `CALC.PAS:121,127` | needs the enum base |
|
|
|
+| set constructor `[a..b, c]`, `in` (compile-time) | `t61_setconst` | **done** — folding only |
|
|
|
+| set `in` (run-time), `+`, `*`, `=`/`<>`, assignment, set *variables* | 47 × `in`, 6 × `+ [`, 2 × `*` | `ENoLib` — next sets increment |
|
|
|
| `record` + field select `Sheet[FX,FY].CellStatus` | `CALC.PAS:126` | `ERR 102` |
|
|
|
| `with` | 13 sites | `ERR 102` (via `record`) |
|
|
|
| 2-D array `array['A'..'G',1..FYMax] of CellRec` | `CALC.PAS:133` | one range only |
|
|
|
@@ -403,11 +405,17 @@ The ladder row now sits on **sets**.
|
|
|
typed-constant red proof is the interesting one: dropping the class keeps the
|
|
|
compile matrix green at the same `OK 65 4` and only execution sees `71` for
|
|
|
`'G'`.
|
|
|
-- **The ladder now stops at `ERR 102` at `7972`** — `Numbers : set of Char =
|
|
|
- ['0'..'9']`, a set-typed constant. Structured typed constants need
|
|
|
- initialised storage this compiler does not have, so they are refused with
|
|
|
- `ENoLib` rather than accepted-and-ignored. The enumeration at 8036 is past
|
|
|
- this rung, so **sets must land before enums**.
|
|
|
+- **Sets, increment 1, are landed** — the hybrid type, the constructor, set
|
|
|
+ typed constants, and compile-time `in`. Fixture `t61_setconst` (`.out` TRUE
|
|
|
+ FALSE TRUE TRUE), and the storage decision is recorded in Stage 6: a typed
|
|
|
+ constant's bytes are emitted in the code stream behind a `jmp` (as string
|
|
|
+ literals already are), addressable through `DS` because a `.COM` has one
|
|
|
+ segment — no `seg cs`, which is the single divergence from the original.
|
|
|
+ Still `ENoLib`: run-time `in`, set *variables*, `+`/`*`/`=`/`<>`, assignment.
|
|
|
+- **The ladder now stops at `ERR 41` at `8098`** — `Attributes =
|
|
|
+ (Constant,…)`, an **enumeration** type. So enums are the next rung and the
|
|
|
+ `SetOfAttri = Set of Attributes`/`CellStatus : set of Attributes` lines come
|
|
|
+ right behind them.
|
|
|
- **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
|
|
|
@@ -417,13 +425,11 @@ The ladder row now sits on **sets**.
|
|
|
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**, compile matrix **61/61**, CALC ladder **1/1** at
|
|
|
- `ERR 102 7972`, 51 `.COM` linked and 51 executed under both qemu and Exec86.
|
|
|
-- **`tests/nonvacuity.sh`:** the last full run before this commit was
|
|
|
- **79 ok / 0 failed**; this commit adds two more compiler cases (the typed-const
|
|
|
- class, and `^`/`#` as literals) and it was re-run after them — see the commit
|
|
|
- message. It is not in the default `run_all.sh` and must be run **manually**
|
|
|
- after touching any check.
|
|
|
+ **OVERALL: ALL PASS**, compile matrix **62/62**, CALC ladder **1/1** at
|
|
|
+ `ERR 41 8098`, 52 `.COM` linked and 52 executed under both qemu and Exec86.
|
|
|
+- **`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.
|
|
|
- **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
|
|
|
@@ -456,16 +462,18 @@ The ladder row now sits on **sets**.
|
|
|
|
|
|
### Next session
|
|
|
|
|
|
-**The next rung is a SET.** The ladder stops at `ERR 102 7972` on
|
|
|
-`Numbers : set of Char = ['0'..'9']`, a set-typed constant, because this
|
|
|
-compiler has no initialised data to hold the value. So the honest next step is
|
|
|
-not "enums" (Stage 5) but **sets and the storage decision that makes a
|
|
|
-structured typed constant representable at all** — either the original's
|
|
|
-code-resident scheme (`seg cs`, program jumps over the values, `RESUME-TP3.md`
|
|
|
-§3.14) or an init block copied at startup. That decision also gates `XPOS`, the
|
|
|
-enum-indexed array of strings in `CALC.INC:767-778`, and arrays and records
|
|
|
-generally, so it is worth settling once, in writing, before the set layout is
|
|
|
-written. `CALC.PAS:114` is the fixture to move.
|
|
|
+**The next rung is an ENUM.** The ladder stops at `ERR 41 8098` on
|
|
|
+`Attributes = (Constant, Formula, Txt, OverWritten, Locked, Calculated)`: a
|
|
|
+type whose definition is a parenthesised list of identifiers, which `ParseType`
|
|
|
+has no arm for. Land the enumeration type next (Stage 5), then the set-over-enum
|
|
|
+lines at `CALC.PAS:121,127` follow immediately, and the rest of the set
|
|
|
+operations (run-time `in`, set variables, `+`/`*`/`=`/assignment) alongside.
|
|
|
+
|
|
|
+The storage decision that sets needed is **settled and recorded** (Stage 6): a
|
|
|
+typed constant's bytes live in the code stream behind a `jmp`, addressable
|
|
|
+through `DS`; no `seg cs`, because a `.COM` is one segment. That is the same
|
|
|
+decision the enum-indexed array of strings (`CALC.INC:767-778`) and `XPOS` will
|
|
|
+use, so it does not need re-litigating.
|
|
|
|
|
|
**Stage 1 — the ratchet (§1). DONE.** `tests/calc_ladder.tsv` +
|
|
|
`tests/calc_ladder.sh`, wired into `run_all.sh`; proved red against 7792 before
|
|
|
@@ -562,11 +570,41 @@ Locked,Calculated)`. 1 byte if fewer than 256 values, else 2 (`RESUME-TP3.md`
|
|
|
§2). Ordinal values 0..n; this feeds `Succ`/`Pred` and `set of T`.
|
|
|
Ladder: 8036 → 8060.
|
|
|
|
|
|
-**Stage 6 — sets.** Type sizing (1 bit per element, ≤ 32 bytes, hybrid bounds
|
|
|
-per `RESUME-TP3.md` §2), constructor `[a..b, c]`, `in` (bit test — 47 sites,
|
|
|
-the single most-used operator in CALC), `+` union, `*` intersection,
|
|
|
-`=`/`<>` against `[]`, and assignment. `set of Char` is a 32-byte value; decide
|
|
|
-inline vs a runtime helper. Ladder: 8060 → 8237.
|
|
|
+**Stage 6 — sets. Increment 1 DONE; the rest is the next milestone.**
|
|
|
+
|
|
|
+Done:
|
|
|
+- **Type sizing** — TP3's hybrid layout (coeur-tp-ocr 4.7.2): only the whole
|
|
|
+ bytes covering the base range are stored, element `e` is bit `(e MOD 8)` of
|
|
|
+ byte `((e DIV 8) - (base DIV 8))`, high byte last. `set of Char` is 32 bytes,
|
|
|
+ `set of 12..17` is 2. `elem` carries the origin (a multiple of 8).
|
|
|
+- **The constructor** `[a..b, c]`, and `[]`.
|
|
|
+- **Set typed constants** — `Numbers : set of Char = ['0'..'9']`.
|
|
|
+- **Compile-time `in`** — a constant element against a set whose bytes are in
|
|
|
+ the image, answered as TPSRC2 `xsetin` does (AH > 255 → FALSE, else test the
|
|
|
+ bit). Fixture `t61_setconst`, `.out` TRUE FALSE TRUE TRUE.
|
|
|
+- **The storage decision the plan demanded**, and it is the original's own:
|
|
|
+ a typed constant's bytes are emitted **in the code stream behind a `jmp`**,
|
|
|
+ exactly as string literals already are, and the name becomes addressable.
|
|
|
+ The **divergence** from `RESUME-TP3.md` §3.14 is one line: the original had
|
|
|
+ separate code and data segments and therefore prefixed `seg cs`; a `.COM` has
|
|
|
+ one segment, so `DS` already covers the code area and no prefix is needed.
|
|
|
+ The bytes are ordinary RAM, so a typed constant stays assignable, as TP3's
|
|
|
+ static typed constants are.
|
|
|
+
|
|
|
+Still to do (all currently `ENoLib`, none of them silently accepted):
|
|
|
+- **Run-time `in`** — a variable element or a set variable. The bit arithmetic
|
|
|
+ is the same, but it must be emitted, not folded.
|
|
|
+- **Set variables** — a 32-byte local/global (`DefVar` still refuses `size > 2`
|
|
|
+ for a non-string) and their layout in the frame.
|
|
|
+- **`+` union, `*` intersection, `=`/`<>`, assignment, `[]` in context.**
|
|
|
+- **`set of <enum>`** — needs the enum base first (the current rung).
|
|
|
+
|
|
|
+Reference note: `Resources/COMPIL4/` (Wirth's Pascal-P4, `P.PAS` + `P41..P48`)
|
|
|
+was added as a cross-check. It is a **different** design — a fixed
|
|
|
+`setsize = 8`-byte bitset over `0..sethigh (63)`, with `in` as a built-in
|
|
|
+runtime opcode — so it informs the *algorithms* but not the representation.
|
|
|
+TP3's hybrid bytes remain the ground truth here, per the repo rule.
|
|
|
+Ladder: 8060 → 8237 (now `8098` → the enum).
|
|
|
|
|
|
**Stage 7 — records.** Non-compacted field layout (`RESUME-TP3.md` §2), field
|
|
|
selection as address arithmetic, `with` (13 sites), records as array elements.
|
|
|
@@ -731,5 +769,10 @@ as the include, because the include is what consumes the slack.
|
|
|
§3.11 parameters (the SEG:OFF push), §3.14 typed constants, §4 options.
|
|
|
- `TP3-COMPILER.md` — what the compiler does today and why.
|
|
|
- `Resources/turbopascal3source/TP3/TPSRC1-10` — the ground truth.
|
|
|
+- `Resources/coeur-tp-ocr/coeur-tp-03-d.txt` §4.7 — sets explained: the hybrid
|
|
|
+ byte layout this port implements (4.7.2) and the memory order (4.7.3).
|
|
|
+- `Resources/COMPIL4/` — Wirth's Pascal-P4 (`P.PAS`, `P41..P48`), added as a
|
|
|
+ cross-check. Its sets are a *fixed* 8-byte bitset over 0..63 with `in` as a
|
|
|
+ runtime opcode, so it informs the algorithm, not the representation.
|
|
|
- `Resources/TP3/CALC.PAS`, `CALC.INC`, `CALC.HLP` — the target.
|
|
|
- `shell/tests/probe/README.md` — read before touching any emitter.
|