瀏覽代碼

docs: refresh stale status/gap/feature docs (2026-10-08)

- STATUS.md: L7 complete (Lower is the only emitter); current figures
  (suite 184/184, FIXPOINT OK 3,392,601); note the post-flip work
  (emit deletion, note-ring fix, dead-code sweep, -lower retirement,
  array-of-record fix, statement-context suffixes).
- analysis_gaps.md: mark historical; the "No AST, single pass" claim is
  superseded (full AST + two-phase Lower); statement-context result
  suffixes landed; chained post-call calls still blocked (need composite
  results).
- features.md: procedure-type variables / indirect calls are done, not
  deferred; refresh the header.
Eric Streit 4 天之前
父節點
當前提交
b46a3ae555
共有 3 個文件被更改,包括 44 次插入 和 35 次删除
  1. 27 26
      docs/STATUS.md
  2. 14 6
      docs/analysis_gaps.md
  3. 3 3
      docs/features.md

+ 27 - 26
docs/STATUS.md

@@ -1,39 +1,40 @@
-# m2compiler-V3 — status (2026-10-07)
+# m2compiler-V3 — status (2026-10-08)
 
 This answers "where are we after all the refactoring?".
 
-## MILESTONE (2026-10-07): the switch is flipped
+## MILESTONE (2026-10-08): L7 complete
 
-**Lower is now the only active emitter.**  A plain `./M2` run emits
-the image through `Lower` from the AST; the grammar's inline emit is
-still present but runs suppressed (`SetNoEmit`) and is discarded, so
-it no longer reaches the buffer.  Verified:
+**Lower is the only emitter**; the grammar's inline emit is gone from
+every production where it could be removed cleanly, `-lower` is retired,
+and the dead scaffolding is swept.  Verified:
 
-- `run_tests.sh` is **204/204** (the `expect_run` tests now exercise
-  Lower end to end through qbe/cc/execution).
-- `bootstrap/fixpoint.sh` is **FIXPOINT OK** (3,553,701 bytes).
+- `run_tests.sh` is **184/184**.
+- `bootstrap/fixpoint.sh` is **FIXPOINT OK** (3,392,601 bytes).
 
-The `-lower` flag is now test-only: it does not change *what* is
-emitted, only names the image `<mod>L.ssa` for the byte-compare
-harness.  The byte-identity milestone (Lower == legacy inline on every
-single-file test and every session) is what made this a no-op flip.
+The L7 flip itself (2026-10-07) was a no-op because `Lower` had been
+verified byte-identical to the legacy inline emit on every single-file
+test and every session.  Since then:
 
-The remaining work is purely mechanical: delete the grammar's inline
-emit (533 `QbeGen.*` call sites), retire the `-lower` flag and the
-now-degenerate byte-compare tests, then remove the dead
-`LowerSession`/`MaterializeGlobals` scaffolding.
+- the inline emit was deleted from statements, control flow,
+  declarations, expressions/designators, calls and `ProcHeading`;
+- a latent VAR-actual **note-ring bug** was found and fixed
+  (`RestoreSession` now clears the ring);
+- dead code was swept (tree-wide scan: 0 unreferenced procs);
+- `-lower` and the now-degenerate byte-compare tests were retired;
+- the **array-of-record inline length-word** bug was fixed (inline
+  expansion for small arrays, a generated run-time init for large ones);
+- **statement-context result suffixes** (`F()^.x := e`) were added.
 
 ## TL;DR
 
 - **The compiler works and self-hosts today.**  `run_tests.sh` is
-  **204/204** and `bootstrap/fixpoint.sh` is **FIXPOINT OK**
-  (3,553,701 bytes, byte-identical stage2/stage3).
-- The **two-phase refactor (L0–L7) is done**: `Lower` reproduces the
-  whole compiler image byte-for-byte from the AST, so flipping the
-  emitter was a no-op.
-- **Lower is the only active emitter.**  The grammar's inline emit is
-  retained but suppressed; deleting it (and the `-lower` test flag) is
-  the remaining cleanup.
+  **184/184** and `bootstrap/fixpoint.sh` is **FIXPOINT OK**
+  (3,392,601 bytes, byte-identical stage2/stage3).
+- The **two-phase refactor (L0–L7) is done**: `Lower` emits the whole
+  session from the AST and is the only active emitter.
+- What remains is cleanup (delete the last suppressed writers +
+  `SaveSession`/`SetNoEmit`), language coverage (`GOTO`, generics,
+  chained post-call calls), and robustness — see "What remains" below.
 
 ## What the refactor actually is
 
@@ -189,7 +190,7 @@ latent resolutions in the compiler's own image (fixpoint size moved).
 ```sh
 cd compiler
 ./build.sh          # rebuild
-./run_tests.sh      # 204/204
+./run_tests.sh      # 184/184
 cd ..
 bootstrap/fixpoint.sh   # FIXPOINT OK
 ```

+ 14 - 6
docs/analysis_gaps.md

@@ -1,5 +1,10 @@
 # m2compiler-V3 — gap analysis (2026-09-30)
 
+> **Historical (2026-09-30).**  Current state: suite **184/184**,
+> FIXPOINT OK (3,392,601 bytes); there is now a full AST and a two-phase
+> `Lower` emitter (`docs/STATUS.md`).  The list below is kept as the gap
+> analysis from that date; several items have since landed (§7).
+
 Suite **169/169**, self-hosting fixpoint OK (2,754,353 bytes).
 Corpus at this point (with `$V3_LIBS`):
 
@@ -76,10 +81,11 @@ Procedure types and indirect calls do work (`t_proctype` passes);
 
 ## 3. Architecture / robustness
 
-- **No AST, single pass.**  Declaration-before-use is enforced, so
-  forward references in `CONST`/expressions fail (e.g. `arraycons3.mod`
-  declares `TYPE` after the `CONST` constructor and is rejected).  Only
-  `FORWARD` procedures and `ForwardType` are tolerated.
+- ~~**No AST, single pass.**~~  **Superseded (2026-10-08):** the grammar
+  now builds a full AST and `Lower` emits from it (`docs/STATUS.md`).
+  Declaration-before-use is still enforced by the grammar's semantic
+  pass, so forward references in `CONST`/expressions still fail (only
+  `FORWARD` procedures and `ForwardType` are tolerated).
 - **Single image only** — no per-module object emission, no import
   cycles.
 - **Driver robustness** — `M2` exits 0 even with errors (harnesses parse
@@ -109,8 +115,10 @@ assignment (flat blit), nested-`MODULE` lowering, `ADDRESS`↔pointer
 assignment.
 
 Remaining after today: `GOTO`/labels, generics, multiple inheritance
-(deliberate), result *suffixes on statement designators*, and the
-channel/device library holes in §2.
+(deliberate), chained post-call calls (`F().M()`, which needs a function
+to return a record/class — still `230`), and the channel/device library
+holes in §2.  (Statement-context result suffixes, `F()^.x := e`, landed
+2026-10-08.)
 
 ## 7. Done after the gap analysis (this session)
 

+ 3 - 3
docs/features.md

@@ -1,4 +1,4 @@
-# m2compiler-V3 — feature status (at `v3-string-variant-nested`, 169/169 green)
+# m2compiler-V3 — feature status (2026-10-08; suite 184/184 green)
 
 Pipeline: Coco/R `M2.atg` (1748 lines, 73 productions) → `gm2`-built
 `M2` → QBE `.ssa` → `qbe` → `cc` → run. `SymTab.mod` 1623 lines,
@@ -107,8 +107,8 @@ Legend: ✅ done · 🔄 partial · ⏸ not started / deferred.
 - ✅ Separate compilation: `lib.def lib.mod prog.mod` → one image;
   module init functions; opaque completion; strict 235 signature
   checks between a definition and its implementation.
-- ⏸ Procedure-type variables / indirect calls, per-file object
-  emission, import cycles.
+- ✅ Procedure-type variables / indirect calls (`t_proctype`); ⏸
+  per-file object emission, import cycles.
 
 ## Backend (QBE)
 - ✅ Length-prefixed arrays (count + elements), deep record copy,