# Session save — 2026-09-23 (m2compiler-V3, step 8.2) ## Where we are HEAD `bcf5d8a`. Tags `v3-step8.1`, `v3-step8.2` (+ `v3-step8-summary`). Suite **104/104**, build warning-free, tree clean, no remote (`git.txt` untracked). `SymTab` compiles clean under V3; `QbeGen` is close (two gaps below). ## What this session did - **8.1 — Redux sweep + lenient imports.** Compiler sources swept (`&`→`AND`, `~`→`NOT`, `<>`→`#`, octal `NNC`→`CHR(n)`); V3 accepts `FROM SYSTEM IMPORT TSIZE` (built-ins win). `docs/summary_step8.1.md`. - **Blaise map refreshed** against their 11-phase plan; V3 = phases 1–2 done, phase 5 (self-hosting) in progress, phase 6 partial. `docs/blaise-phases-map.md`. - **8.2 — self-compile gaps fixed.** `docs/summary_step8.2.md`: 1. Named-CONST constant folding (`SetSymVal`/`GetSymVal`, `QbeGen.Fold2`; new test `t_constfold`). 2. Forward type refs in a `TYPE` block (`ForwardType` + `Begin/EndTypeBlock`; reuses the opaque-alias `SetTarget` path). 3. Trailing `;` before a record `END`. 4. Qualified type names (`Module.Type` via `QualType`). 5. Capacities: `MaxTypes` 256→4096, `MaxPend` 64→256, `MaxMods` 32→64 (256 descriptors was the biggest false wall). 6. Compact zero-filled array data `{ l n, z bytes }` in `ArrData` (per-element emission of the 1 MB `sessBuf`/`nestBufs` was the apparent hang). 7. `Resolve` moved before `PushClassScope` (ISO declaration order). ## Measured state of self-compilation - `SymTab.def` + `SymTab.mod`: **clean** (verified with a stub program; no `.ssa` expected — no module body). - `QbeGen.def` + `QbeGen.mod`: 124 errors, down from 465: **85 `invalid call`, 38 undeclared, 1 `invalid Statement`**. ## Remaining gaps (precisely identified) 1. **Within-module forward procedure calls.** 10 callees defined later in `QbeGen.mod`: `Revive`, `LocAdd`, `ResClass`, `HApp`, `LocFindUp`, `UpAddrOf`, `AllocLocal`, `FlushStrings`, `HeapSize`, `ArrData`. gm2 hoists; ISO needs declaration-before-use. Choice: (a) add `FORWARD` decls / reorder the source, or (b) make V3 resolve later-declared module procedures. 2. **Single-char string literals.** `"0"`/`"$"`/`"-"` are typed `CHAR`, so passing them to `ARRAY OF CHAR` formals (`Cpy(d, "0")`) reports "invalid call". Needs a CHAR ↔ length-1 string coercion model. Then: cross-stage `FileIO` selection and `bootstrap/fixpoint.sh` (Stage1 gm2 → Stage2 V3 → Stage3 V3, byte-identical `.ssa`, suite green on all stages; rolling-bootstrap design per the Blaise map). ## Resume commands ```sh cd /home/eric/Projets/Projets-Modula2/MyWork/m2compiler-V3/compiler ./build.sh && ./run_tests.sh # expect 104/104, no gm2 warnings # gap check: ./M2 ../stdlib/storage.def ../stdlib/storage.mod \ ../runtime/syslib/SysShim.def ../runtime/syslib/SysShim.mod \ ../runtime/syslib/FileIO.def ../runtime/syslib/FileIO.mod \ src/SymTab.def src/SymTab.mod src/QbeGen.def src/QbeGen.mod \ /tmp/gap.mod # /tmp/gap.mod: MODULE Gap; IMPORT SymTab; VAR ExitCode:INTEGER; BEGIN ExitCode:=0 END Gap. ```