summary_two-phase-slice9.md 1.1 KB

Two-phase refactor — slice 9 (brace / set literals)

Branch ast-stage-c. Suite 178/178; self-hosting fixpoint OK (3,024,098 bytes; slice 8 was 3,021,285).

What landed

Literal AST
{e, a..b} NkSetLit(elements…), ranges as NkSubrange
T{e, …} NkBraceLit(elements…)

SetLit/TypedBraceLit create the node before their elements and pass it to SetElem/BraceElem, which append each element's node (a range becomes NkSubrange; a BY repeat keeps the value node). Fact now keeps the brace node (astBrace) instead of discarding it, marking astIsLit so it survives the Fact reset; set literals likewise.

Verified (temporary AST.Dump of astUnit, then removed)

b := {1, 3..5};
b := BITSET{0, 2}

gave NkSetLit(1, NkSubrange(3,5)) and NkBraceLit(0, 2).

Deliberately deferred

  • ResultComp call-result suffixes (F()[i], F().f, F()^).
  • Imports, CLASS, nested modules in the unit AST.
  • Lower + .ssa byte-compare.

Next

ResultComp, then imports/CLASS/nested modules, then Lower.