Explorar o código

feat(express): tiny procs 23/24/25/26 bodies + heap verdict (bogus-syntax = OOM)

Eric Streit hai 2 semanas
pai
achega
333923c48e
Modificáronse 2 ficheiros con 54 adicións e 4 borrados
  1. 36 0
      SESSION.md
  2. 18 4
      src/compiler/EXPRESS.MOD

+ 36 - 0
SESSION.md

@@ -241,3 +241,39 @@ Next: GENZ80 media hunt; stage-2 pty-driven MCD diff per module.
 - Probes banked: INTEGER()/CARDINAL() zero-cost, ORD() zero-cost,
   CARDINAL->INTEGER assign OK, ADDRESS->RecordPtr OK, ABS needs INTEGER,
   CARDINAL/INTEGER mixed ops incompatible, H5Ptr(cur)^ transfer-deref banned.
+
+## EXPRESS session 2026-10-08 (ZZ verification campaign)
+- Method: per-proc ZZ modules (matching globals/imports/slots) + score.py
+  (masks targets/procrefs; fct_leave-0x80 matches: ZZ-programs and
+  library-top-levels both set it; nested must replicate nesting).
+  IN-order rule: `field IN BITSET(n)` (not `n IN ...`) — pushes field first.
+  OrElse pushes TRUE (no underflow). `leaveN` drops N/2 (junk cleaned).
+  ODD() gives and; DEC/INC(v,n) give dup; BITSET{11}=2048 etc. as values.
+- VERIFIED EXACT: proc32 IsOrdinal (nested, byte-exact), proc33 IsSet
+  (51/51), proc34 BaseTypeOf (54/54), proc5 PopExprDesc (153/153, nested
+  IsOrdinal, CentralError not ReportError, IF/ELSIF/ELSE, OR-assign),
+  proc35 FoldConstOp (74/74, IF/ELSIF/ELSE, inner-AND), proc7 ConstToCard,
+  proc8 ConstToInt (13/13), proc9 MatchOpClass (14/14), proc21
+  ParseDesignatorBase (63/63), proc36 CheckAssignable (32/32), proc20
+  ParseSelector (206/206, zero mid-returns, REPEAT-extra, DEC, StrLen-tangle
+  `(S-1)=(H-L)` balanced), proc16 EvalConstExpr (123/123), proc38
+  ParseFactor + proc37 ParseTerm (nested ee/ec). = 14 procs.
+- proc15 at 233/236 (only temp-reserve prologue missing: HeadPtr temps
+  have no reserve source under retail strictness; Borland-lax
+  record-to-pointer suspected — accepted toolchain delta like native
+  proc12). WHILE (not LOOP) for outer (only EXIT-loops push_code_addr).
+- proc12 (BoolCondHelper, ×18 calls, headless) = NATIVE Z80 (accepted).
+  proc40 (ParseSetCons) OOMs retail (heap wall); tail grind continues.
+- Nesting map confirmed by leave-bit + call opcodes; reorder + stub-tail
+  for module-level proof after grind.
+
+## EXPRESS heap verdict (2026-10-08)
+- Full-MOD failure at PopExprDesc-END is HEAP, not syntax: identical bodies
+  compile in small ZZs. Retail heap exhausts cumulatively during parsing;
+  when it dies mid-parse it reports BOGUS syntax errors (not clean OOM).
+  Clean OOM appears only if heap lasts past parsing. So full-MOD retail
+  compile is impossible, period (even with correct sources).
+- Consequence: per-proc ZZ verification is the PRIMARY method (no heap
+  issues, fast feedback). Full-MOD only for stub-tail prefix scoring
+  (which also needs reorder + nesting pass first).
+- Tiny procs 23/24/25/26 bodies verified-compiling (ZZ); scoring next.

+ 18 - 4
src/compiler/EXPRESS.MOD

@@ -102,15 +102,29 @@ PROCEDURE PushOperand(d: HeadPtr);
 BEGIN HALT; END PushOperand;
 PROCEDURE PopOperand(d: HeadPtr);
 BEGIN HALT; END PopOperand;
-PROCEDURE GetRangeBase(v: CARDINAL);
-BEGIN HALT; END GetRangeBase;
+(* proc25 @000c — option-12 guard. *)
+PROCEDURE GetRangeBase(v: ADDRESS);
+BEGIN
+  IF NOT (12 IN Scanner.scanOpt) THEN Errors.AskContinue(v) END;
+END GetRangeBase;
+(* proc24 @0038 — kind-4 with word3 > 2. Name TBD (audit). *)
+PROCEDURE Proc24(t: RecordPtr): BOOLEAN;
+BEGIN
+  RETURN (t^.word4 = 4) AND (CARDINAL(t^.word3) > 2);
+END Proc24;
+(* proc26 @001a — pointer-to-current-scope test. *)
 PROCEDURE IsPointer(t: RecordPtr): BOOLEAN;
-BEGIN HALT; END IsPointer;
+BEGIN
+  RETURN (t^.word4 = 11) AND (CARDINAL(t^.word5) = CARDINAL(Scanner.scopeCur));
+END IsPointer;
 PROCEDURE TypeKindOf(): CARDINAL;
 BEGIN HALT; END TypeKindOf;
 (* proc23 @002a stub — ~LookupField (tiny predicate; TBD by MCD audit). *)
+(* proc23 @002a — field-selector test. FIXME: word2 =0 shape TBD by score. *)
 PROCEDURE LookupField(t: RecordPtr): BOOLEAN;
-BEGIN HALT; END LookupField;
+BEGIN
+  RETURN (t^.word4 = 11) AND (CARDINAL(t^.word2) = 0);
+END LookupField;
 (* DEF-export stubs (signatures exact per DEF; bodies TBD by MCD audit). *)
 PROCEDURE CentralError(ok: BOOLEAN; code: CARDINAL);
 BEGIN HALT; END CentralError;