Ver Fonte

docs: per-unit Lower blocked by parse-time QbeGen state (the flip is a grammar rewrite)

Eric Streit há 6 dias atrás
pai
commit
ff38570839
1 ficheiros alterados com 22 adições e 12 exclusões
  1. 22 12
      docs/summary_lower_l7.md

+ 22 - 12
docs/summary_lower_l7.md

@@ -59,15 +59,25 @@ Suite **204/204**; FIXPOINT OK (3,405,813 bytes).
    `ProcLink` fails after scopes close.
 3. Definition-module proc replay (done), nested globals (done).
 
-## Plan (revised)
-
-The session re-emit is a useful *verification* tool for small sessions,
-but the flip needs per-unit emission.  Concretely:
-
-1. Fix the external-proc flag (`NoteProc` should record `IsExternal` at
-   the EXTERNAL arm, not at the heading).
-2. Decide the flip mechanism: **two `QbeGen` states**, or remove the
-   grammar's inline `QbeGen` calls.  Either is a big, non-incremental
-   change; the fixpoint is the gate.
-3. Then `Lower` runs per unit (AST valid, scope open), which also makes
-   the external-proc and module-level resolution work naturally.
+## Per-unit emission attempted — blocked by parse-time state
+
+Tried plan item 3 (Lower emits each unit at its END, with the legacy
+output suppressed via `SetNoEmit`).  Small sessions and every `lower_ok`
+single-file test byte-match, **but the compiler's session hangs/differs**:
+
+- The grammar's inline `QbeGen` calls still run during parse; `noEmit`
+  only suppresses the *output*, not the **state**.  So `nTemp` (stuck at
+  211), `inBody` (stuck TRUE, so `main`'s header is dropped), `nLoc`,
+  `funcDepth`, … are all corrupted before Lower's per-unit emit.
+- `EndModule` had to respect `noEmit` too, or it closed the session.
+
+Conclusion: per-unit Lower needs the grammar's parse-time `QbeGen`
+**state** neutralised — which is exactly the flip.  Options:
+1. **Remove/replace the grammar's 533 `QbeGen.*` calls.**  The blockers
+   are the ~20 semantic checks that read `QbeGen` values (`IsImm`,
+   `ConstInt`, `Fold`); they must be reworked to use `SymTab`/the AST.
+2. **Two `QbeGen` states** — but a second 4 MiB `sessBuf` pushes the
+   compiler image past its own buffer, so this does not self-host.
+
+So the flip is a grammar rewrite of the emit actions, gated by the
+fixpoint.  Reverted to the green session-re-emit state (`ce2fc67`).