Branch ast-stage-c. Suite 182/182; self-hosting fixpoint OK
(3,123,487 bytes; L1 was 3,104,868). Plan: docs/plan-lower.md.
LowerStmt (sequence iteration + statement dispatch merged, so no
FORWARD — gm2's whole-program pass rejects it) now emits:
IF/ELSIF/ELSE — flattening the AST's nested-NkIf chain into the
grammar's single shared lEnd, threading lElse, exactly as the
grammar does.WHILE, REPEAT, LOOP + EXIT (via PushLoop/TopLoop).FOR without BY (cslew/add loop), with the same
StoreVar/LoadVar/Op3 order.HALT.CanStmt mirrors the same shapes; FOR with a BY clause stays out of
the subset (needs constant evaluation).
FORWARD declarations in Lower.mod broke gm2's whole-program pass
("too many errors in pass 3") even though -c compiled the module.
Merging the mutually-recursive bodies (CanBody↔CanStat,
LowerBody↔LowerIf) into single dispatching procedures removed it.
gen_ssa/TLower2L.ssa — a program with IF/ELSIF/ELSE, WHILE,
REPEAT, LOOP/EXIT, FOR and a conditional HALT — is
byte-identical to the legacy image (lower_ok t_lower2.mod).
L3: procedures/functions (headers, params, locals, RETURN, calls) —
BeginFunc/FuncParam/EndFuncHeader/EndFunc/CallBegin… This is
where LowerUnit starts walking declaration bodies, not just the program
body.