Ver Fonte

docs: record tomorrow's plan (AST/two-phase, options 1 and 2)

Eric Streit há 1 semana atrás
pai
commit
018d71c687
1 ficheiros alterados com 30 adições e 0 exclusões
  1. 30 0
      docs/session-handoff-2026-10-01.md

+ 30 - 0
docs/session-handoff-2026-10-01.md

@@ -4,6 +4,36 @@ State: `master` at tag **`v3-wrap-modules`** (`bdcefbb`).  Suite
 **177/177**, fixpoint **OK** (2,899,706 bytes).  Working tree clean
 except the user's `compiler/toto.mod`.
 
+## >>> NEXT SESSION: architectural work (decided) <<<
+
+The single biggest blocker identified this session is the
+**single-pass, no-AST frontend** (declaration-before-use, emit-during-
+parse).  It is the root cause of: text-patched forward variables,
+forward procedures needing a DEFINITION, set values in `CONST`, and
+the statement-context suffix difficulty.
+
+**Decided plan for tomorrow: options 1 and 2.**
+
+1. **Thin AST / two-phase parse for declarations** — parse a unit's
+   declarations fully into the symbol table *before* lowering any
+   body, so forward references (variables, procedures, typed
+   constants, `CONST` constructors) resolve naturally.  This would
+   delete the `FwdPatchAll` / placeholder / text-rewriting machinery.
+2. **Interim discipline (cheaper, preserves no-AST)** — keep no-AST,
+   but finish the symbol table for a module before emitting any
+   procedure body (extend the existing module-level `FlushPend`
+   discipline to procedure bodies).
+
+Suggested order: do **2** first as the structural stepping stone, then
+**1** if the goal is to compile gm2's corpus as-is.  Ask/confirm the
+long-term target before committing to 1: *"compile gm2 corpus as-is"*
+(→ both) vs *"clean classic Modula-2 that self-hosts"* (→ neither is a
+blocker; forward references stay out of scope).
+
+Work on a branch off `v3-session-2026-10-01`; run `fixpoint.sh` **and**
+`run_tests.sh` after every increment; revert the increment if either
+fails; commit only when both are green.
+
 ## What landed today
 
 | Tag | Commit | What |