|
|
@@ -0,0 +1,75 @@
|
|
|
+# Session save — 2026-09-23 (m2compiler-V3, step 8.3)
|
|
|
+
|
|
|
+## Where we are
|
|
|
+
|
|
|
+HEAD `bb94cad`. Tags `v3-step8.2`, `v3-step8.2-summary`, `v3-step8.3`.
|
|
|
+Suite **105/105**, build warning-free, tree clean, no remote
|
|
|
+(`git.txt` untracked).
|
|
|
+
|
|
|
+**Both hand-written compiler modules compile clean under V3:**
|
|
|
+`SymTab` (step 8.2) and `QbeGen` (this step).
|
|
|
+
|
|
|
+## What this session did
|
|
|
+
|
|
|
+- **8.2 — self-compile gaps** (`docs/summary_step8.2.md`):
|
|
|
+ named-CONST folding, forward type refs in a `TYPE` block, trailing
|
|
|
+ `;` in records, qualified type names (`Module.Type`), table
|
|
|
+ capacities (256→4096 types), compact `z`-filled array data.
|
|
|
+- **8.3 — this step** (`docs/summary_step8.3.md`):
|
|
|
+ 1. Within-module forward procedure calls in `QbeGen.mod`: gm2's
|
|
|
+ `FORWARD` is unusable (whole-program pass errors
|
|
|
+ `too many errors in pass 3`; reproduced minimally) and reorder
|
|
|
+ cascades. Fix = declare the 10 internal helpers in
|
|
|
+ `QbeGen.def` (already the "everything the parser calls" surface).
|
|
|
+ 2. Single-char string literals to `ARRAY OF CHAR`:
|
|
|
+ `QbeGen.DeclCharStr` + `ActParam` coercion; cleared the last
|
|
|
+ 85 QbeGen errors.
|
|
|
+ 3. Empty statements `StatSeq = Statement { ";" [ Statement ] }`
|
|
|
+ (Coco/R emits `;;`); new test `t_emptystat` (42).
|
|
|
+
|
|
|
+## Measured state of self-compilation
|
|
|
+
|
|
|
+| Source | Under V3 |
|
|
|
+|---|---|
|
|
|
+| `SymTab.def/.mod` | clean |
|
|
|
+| `QbeGen.def/.mod` | clean |
|
|
|
+| `M2S.def/.mod` (Coco/R scanner) | 30 errors |
|
|
|
+| `M2P.def/.mod` (Coco/R parser) | errors (mostly cascade) |
|
|
|
+| `M2.mod` (driver) | needs `stdlib/strings` in the session |
|
|
|
+
|
|
|
+## Remaining gaps (precisely identified)
|
|
|
+
|
|
|
+1. **Procedure types** — unsupported. `GetCH = PROCEDURE (INT32):
|
|
|
+ CHAR;`, procedure variables (`CurrentCh: GetCH;`), and the
|
|
|
+ `Error: PROCEDURE (...)` callback in `M2S.def`. The main `M2S`
|
|
|
+ blocker (`invalid Type` then cascade). **Step-9-sized**: function
|
|
|
+ pointers + indirect calls in QBE.
|
|
|
+2. **`INT32` alias resolution** in `M2S.mod` var/param types seen as
|
|
|
+ "not a type name" — recheck once procedure types parse.
|
|
|
+3. **Host `FileIO` open-file cap** `MaxFiles = BitSetSize` (16)
|
|
|
+ blocks compiling all ~16 modules in one session (`Too many
|
|
|
+ files`). Raise it, or use the self-hosted `FileIO`.
|
|
|
+
|
|
|
+Then: cross-stage `FileIO` selection and `bootstrap/fixpoint.sh`
|
|
|
+(Stage1 gm2 → Stage2 V3 → Stage3 V3, byte-identical `.ssa`).
|
|
|
+
|
|
|
+## Resume commands
|
|
|
+
|
|
|
+```sh
|
|
|
+cd /home/eric/Projets/Projets-Modula2/MyWork/m2compiler-V3/compiler
|
|
|
+./build.sh && ./run_tests.sh # expect 105/105, no gm2 warnings
|
|
|
+
|
|
|
+# SymTab/QbeGen gap check (needs a stub program, /tmp/gap.mod):
|
|
|
+printf 'MODULE Gap;\nIMPORT SymTab;\nVAR ExitCode : INTEGER;\nBEGIN ExitCode := 0 END Gap.\n' > /tmp/gap.mod
|
|
|
+./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
|
|
|
+
|
|
|
+# M2S (keep the session small — host FileIO caps at 16 open files):
|
|
|
+./M2 ../stdlib/storage.def ../stdlib/storage.mod \
|
|
|
+ ../runtime/syslib/SysShim.def ../runtime/syslib/SysShim.mod \
|
|
|
+ ../runtime/syslib/FileIO.def ../runtime/syslib/FileIO.mod \
|
|
|
+ src/M2S.def src/M2S.mod /tmp/gap.mod
|
|
|
+```
|