Lower)Branch ast-stage-c. Suite 178/178; self-hosting fixpoint
OK (3,042,040 bytes).
The two-phase frontend's inert AST is now feature-complete: the
parser builds a tree for every declaration (incl. CLASS, imports,
nested modules), every statement, and every expression, alongside
the legacy emit path (which is unchanged, so the fixpoint stays
byte-identical). The tree is not consumed yet — Lower is the next
phase.
| Tag | Doc | What |
|---|---|---|
v3-ast-slice9 |
summary_two-phase-slice9.md |
brace/set literals (NkBraceLit/NkSetLit) |
v3-ast-slice10 |
summary_two-phase-slice10.md |
ResultComp suffixes; unbounded NkBlock/NkDeclSeq (AstAppend) |
v3-ast-slice11 |
summary_two-phase-slice11.md |
imports (NkImport) |
v3-ast-slice12 |
summary_two-phase-slice12.md |
nested modules (NkUnit) |
v3-ast-slice13 |
summary_two-phase-slice13.md |
CLASS/CLASS IMPLEMENTATION; TypeBlock collection fix |
(Slices 1–8 — expressions, designators, calls, statements, declarations,
unit root, builtins, CASE/WITH — landed 2026-10-03; see
summary_two-phase-session-2026-10-03.md.)
NkBlock/NkDeclSeq silently dropped statements past
the 7th — now chunked/unbounded.NkImport leaf mis-classification made walks mis-read its child 0.TypeBlock never collected its items — only the last TYPE/CLASS
declaration survived to DeclSeq (latent since slice 6).SetChild cannot skip an unset child — class-implementation
methods/body were dropped; a body-less class impl also leaked the last
method's body.Each slice was gated by build.sh + run_tests.sh + fixpoint.sh, with
the tree shape checked by a temporary AST.Dump in the root
production (removed before commit).
Lower phase)astCur (expr), astStmt (stmt), astDecl (decl),
astUnit (root); lists built with AstAppend (unbounded chunks).NkDesignator(base, selector…) — NkSelector op SelField/SelIndex/
SelDeref; NkCall(callee, actual…).ty
(SymTab.TypeIndex) rather than structural type trees.NkUnit(name, decls, body, imports); NkClassDecl(name, parents,
fields, methods), methods NkProcDecl (op: normal/virtual/forward).docs/wip/local-array-bug.mod).LowerLower walk + .ssa byte-compare (plan §3 phase 2): re-emit from
the AST, compare to the legacy .ssa, then flip and delete the inline
emit + forward-patching (FwdPatchAll/FixLoadClass/FixStoreClass,
the Design forward path, the grammar's FwdVar*).MaxChild cap still applies to CASE arms / WITH designators / call
actuals — give them the chunked treatment.cd ~/Projets/Projets-Modula2/MyWork/m2compiler-V3
git checkout ast-stage-c
cd compiler && ./build.sh && ./run_tests.sh # 178/178
cd .. && ./bootstrap/fixpoint.sh # FIXPOINT OK