session-2026-09-22-step8.md 2.1 KB

Session save — 2026-09-22/23 (m2compiler-V3, step 8.1)

Where we are

HEAD: 6877b81. Milestone tags v3-step8.1 (plus all of v3-step5.1…v3-step7.1). Suite 103/103, build warning-free. Tree clean; git.txt untracked (ignored). No remote.

Step 8.1 (this landing)

  • Redux sweep of the compiler's own sources: M2.atg, SymTab.mod, QbeGen.mod, compiler.frm, parser.frm, scanner.frm converted (&→AND, ~→NOT, <>→#, octal NNC→CHR(n)), string/comment-aware. Still builds under gm2; 103/103. (FileIO left as the host library — stage-1 split.)
  • V3 lenient SYSTEM imports: FROM SYSTEM IMPORT TSIZE; parses (pervasive names accepted and ignored; built-in applies).

Measured gap: V3 compiling SymTab

Running V3 over SymTab.def + SymTab.mod reveals the next work (recorded in docs/summary_step8.1.md):

  1. Named-CONST folding — ARRAY [0 .. MaxPend - 1] and similar bounds are 230: V3 folds only literals; a named CONST loads as a temporary. Dominant cause of the failures. Needs compile-time constant-expression folding (named CONSTs + +/-).
  2. Type-operand TSIZE/SIZE — TSIZE(ScopeNode) (a type name) is unsupported; V3's built-in takes a designator.
  3. Cascading ident expected/201s that should clear once the two above are fixed.

Remaining for step 8

  1. Named-CONST folding (biggest unblocker) + type-operand TSIZE/SIZE.
  2. Cross-stage FileIO selection in the build (stage 1 host library, stage 2 runtime/syslib/FileIO).
  3. bootstrap/fixpoint.sh: Stage1 (gm2) → Stage2 (V3) → Stage3 (V3), diff -r all .ssa byte-identical, suite green on all stages (rolling-bootstrap design per the Blaise map).

Deferred elsewhere: class lowering (vtable/THIS), procedure-type variables, cross-class VAL/CAST, FLOAT/TRUNC, CAP, long↔REAL conversions, string escapes, WITH-field VAR actuals.

Resume commands

cd /home/eric/Projets/Projets-Modula2/MyWork/m2compiler-V3/compiler
./build.sh && ./run_tests.sh   # expect 103/103, zero gm2 warnings

Recommended next: named-CONST constant folding in V3.