# V3 step 8.2 — self-compile gaps fixed for `SymTab` (104/104) Closing the measured step-8.1 gaps so V3 can compile its own sources. Suite 104/104 (new `t_constfold`), build warning-free. ## What landed 1. **Named-CONST constant folding.** `SymTab` now stores a CONST's literal value text (`SetSymVal`/`GetSymVal`, new `val` field); the grammar folds a CONST reference to its literal and folds integer `+ - * DIV MOD` on two literals (`QbeGen.Fold2`). So `ARRAY [0 .. MaxPend - 1]` and friends fold, in bounds, subranges, sets, `FOR` limits and expressions. New test `tests/t_constfold.mod` (42). 2. **Forward type references in a `TYPE` block.** `POINTER TO X` where `X` is declared later now resolves: `SymTab.ForwardType` enters an unresolved alias inside a type block, completed by the later `TypeItem` via the existing opaque `SetTarget` path (`BeginTypeBlock`/`EndTypeBlock` gate it). `TypeIdent` uses it on lookup failure instead of erroring 201. 3. **Trailing `;` before a record's `END`.** `RecordType` accepts `RECORD fieldlist [;] END` (grammar now `{ ";" [ RecField ] }`). 4. **Qualified type names** (`FileIO.File`). `TypeIdent` accepts `Module.Type` via `SymTab.QualType`; a bare module name as a type still reports 221. 5. **Capacity.** `MaxTypes` 256→4096, `MaxPend` 64→256, `MaxMods` 32→64. The compiler's own sources exceed 256 type descriptors (this alone caused ~465 spurious 230s). 6. **Compact zero-filled array data.** `ArrData` emits QBE `{ l n, z n*esz }` instead of one `w 0` per element. Emitting a million-element `sessBuf`/`nestBufs` element-by-element was the apparent "hang" once the type table stopped truncating them. 7. **Source hygiene.** `Resolve` moved ahead of `PushClassScope` in `SymTab.mod` (declaration-before-use; ISO-clean). ## Result `SymTab.def` + `SymTab.mod` now compile **clean** under V3 (0 errors; verified with a stub program module). `QbeGen` is close: down from 205/465 errors to **85 `invalid call` + 38 undeclared + 1 `invalid Statement`**, dominated by two remaining gaps: - **Within-module forward procedure calls** (10 distinct callees: `Revive`, `LocAdd`, `ResClass`, `HApp`, `LocFindUp`, `UpAddrOf`, `AllocLocal`, `FlushStrings`, `HeapSize`, `ArrData`). gm2 hoists these; ISO wants declaration-before-use or `FORWARD`. - **Single-character string literals** (`"0"`, `"$"`, `"-"`) are typed `CHAR`, so passing them to `ARRAY OF CHAR` formals (`Cpy(d, "0")`) reports "invalid call". V3 needs context-sensitive CHAR/string coercion. ## Files `compiler/src/{M2.atg,SymTab.def,SymTab.mod,QbeGen.def,QbeGen.mod}`, `compiler/tests/t_constfold.mod`, `compiler/run_tests.sh`.