Explorar el Código

docs: add showcase25 for dynamic sets

Eric Streit hace 1 día
padre
commit
d823a33d7c

+ 1 - 1
README.md

@@ -87,7 +87,7 @@ docs/              STATUS.md, plan.md, plan-*.md, analysis_*.md, summary_*.md
 
 ## Status (2026-10-24)
 
-- Suite **309/309**; self-hosting **fixpoint OK** (byte-identical
+- Suite **310/310**; self-hosting **fixpoint OK** (byte-identical
   stage2/stage3, 3,845,439 bytes); corpus **521/612 compile-OK,
   0 crashes** (`tools/v3-corpus`; the corpus is gm2's testsuite, so it
   mixes conforming Modula-2 with gm2 leniencies — see `docs/gaps/`).

+ 2 - 2
TUTORIAL.md

@@ -10,7 +10,7 @@ From the repository root:
 ```sh
 cd compiler
 ./build.sh          # M2.atg -> scanner/parser/driver -> ./M2
-./run_tests.sh      # 309/309
+./run_tests.sh      # 310/310
 ```
 
 `M2` reads Modula-2 sources and writes QBE IR to `gen_ssa/`.
@@ -149,7 +149,7 @@ TMP="$PWD/.scratch/fixpoint-separate" ./bootstrap/fixpoint-separate.sh
 tools/v3-corpus/corpus.sh
 ```
 
-Current gates: suite **309/309**, fixpoint **OK (3,845,439 bytes)**,
+Current gates: suite **310/310**, fixpoint **OK (3,845,439 bytes)**,
 corpus **521/612 compile-OK, 0 crashes**.
 
 ## 7. Current limits

+ 2 - 0
compiler/run_tests.sh

@@ -443,6 +443,8 @@ expect_run_files_out Showcase24 42 "showcase24 total=42" \
   showcase24pic.def showcase24pic.mod \
   showcase24util.def showcase24util.mod \
   showcase24.mod
+expect_run_files_out Showcase25 42 "showcase25 sets=42 addr=ok" \
+  ../lib/common/sysio.def ../lib/common/sysio.mod showcase25.mod
 expect_run_files TImportProc 7 pvi.def pvi.mod t_importproc.mod
 expect_run_files_out Showcase22 42 "showcase22 total=42" \
   ../runtime/syslib/SysShim.def ../runtime/syslib/SysShim.mod \

+ 66 - 0
compiler/tests/showcase25.mod

@@ -0,0 +1,66 @@
+MODULE Showcase25;
+// Showcase of the latest language additions:
+//   * dynamic SET OF CARDINAL and SET OF INTEGER (sorted range lists),
+//   * a bounded wide set (SET OF [0..100000]) using the inline form,
+//   * set union/intersection/difference and INCL/EXCL/IN,
+//   * ADDRESS/pointer equality (ADR(p^) = p).
+// Prints a summary and exits 42.
+IMPORT SysIO;
+
+TYPE
+  CardSet = SET OF CARDINAL;
+  IntSet  = SET OF INTEGER;
+  Wide    = SET OF [0..100000];
+
+VAR
+  a, b, c : CardSet;
+  i : IntSet;
+  w : Wide;
+  p : POINTER TO INTEGER;
+  addr : ADDRESS;
+  total : INTEGER;
+  ExitCode : INTEGER;
+
+BEGIN
+  total := 0;
+
+  (* dynamic cardinal sets: a = {1,3,65535}, b = {1,3,5} *)
+  a := CardSet{};
+  INCL(a, 1); INCL(a, 3); INCL(a, 65535);
+  b := CardSet{1, 3, 5};
+  IF (1 IN a) AND (3 IN a) AND (65535 IN a) AND NOT (2 IN a) THEN
+    INC(total, 10)
+  END;
+
+  (* union / intersection / difference *)
+  c := a + b;                  (* {1,3,5,65535} *)
+  IF (5 IN c) AND (65535 IN c) THEN INC(total, 10) END;
+  c := a * b;                  (* {1,3} *)
+  IF (1 IN c) AND (3 IN c) AND NOT (5 IN c) THEN INC(total, 10) END;
+  c := a - b;                  (* {65535} *)
+  EXCL(c, 65535);
+  IF NOT (65535 IN c) THEN INC(total, 5) END;
+
+  (* signed integer set and bounded wide set *)
+  i := IntSet{-7, 2, 100000};
+  IF (-7 IN i) AND (2 IN i) AND (100000 IN i) AND NOT (-6 IN i) THEN
+    INC(total, 5)
+  END;
+  w := Wide{1, 100000};
+  IF (1 IN w) AND (100000 IN w) AND NOT (99999 IN w) THEN
+    INC(total, 2)
+  END;
+
+  (* ADDRESS/pointer identity *)
+  NEW(p); p^ := 25;
+  addr := ADR(p^);
+  IF addr = p THEN INC(total, 0) END;  (* type-check/identity check *)
+
+  SysIO.Write("showcase25 sets=");
+  SysIO.WriteInt(total);
+  SysIO.Write(" addr=");
+  IF addr = p THEN SysIO.Write("ok") ELSE SysIO.Write("bad") END;
+  SysIO.WriteLn;
+
+  IF (total = 42) AND (addr = p) THEN ExitCode := 42 ELSE ExitCode := 1 END
+END Showcase25.

+ 1 - 1
docs/STATUS.md

@@ -4,7 +4,7 @@ This answers "where are we now?".
 
 ## Numbers
 
-- Suite **309/309** (`compiler/run_tests.sh`).
+- Suite **310/310** (`compiler/run_tests.sh`).
 - Self-hosting **FIXPOINT OK** — stage2 and stage3 images are
   byte-identical (3,845,439 bytes).
 - Corpus **521 / 612** sources compile with 0 errors, **0 crashes**

+ 1 - 1
docs/comparison-PIM4-gm2-V3.md

@@ -2,7 +2,7 @@
 
 **Date:** 2026-10-24 · **V3 state:** open arrays, dialect library
 folders and separate compilation with `M2 -I`/incremental objects
-(suite 309/309, self-hosting fixpoint OK 3,845,439 bytes, corpus
+(suite 310/310, self-hosting fixpoint OK 3,845,439 bytes, corpus
 521/612, 0 crashes).
 
 **Scope and sources.**

+ 1 - 1
docs/features.md

@@ -1,4 +1,4 @@
-# m2compiler-V3 — feature status (2026-10-24; suite 309/309 green)
+# m2compiler-V3 — feature status (2026-10-24; suite 310/310 green)
 
 Pipeline: Coco/R `M2.atg` (1748 lines, 73 productions) → `gm2`-built
 `M2` → QBE `.ssa` → `qbe` → `cc` → run. `SymTab.mod` 1623 lines,

+ 1 - 1
docs/plan-separate-compilation.md

@@ -5,7 +5,7 @@
 one-shot mode remains the default for the suite/corpus; this document
 keeps the design record and the deferred phases.
 
-**Baseline now:** suite 309/309, fixpoint OK 3,845,439 bytes, corpus
+**Baseline now:** suite 310/310, fixpoint OK 3,845,439 bytes, corpus
 521/612, 0 crashes.
 
 ---

+ 19 - 3
docs/summary_session-2026-10-24-dynamic-sets.md

@@ -1,6 +1,6 @@
 # Session 2026-10-24 — dynamic SET OF CARDINAL / INTEGER
 
-**Gates:** suite **309/309**, one-shot fixpoint **OK (3,845,439
+**Gates:** suite **310/310**, one-shot fixpoint **OK (3,845,439
 bytes)**, separate-object fixpoint **OK (11 objects)**, corpus
 **521/612 compile-OK, 0 crashes**.
 
@@ -62,6 +62,22 @@ bit-vector representation and the 1,000,000-bit limit.
   `EXCL`, negative integer elements
 - `t_bad_bigconst` — dynamic set constants are rejected for now
 
-## Tag
+## Showcase
 
-`v3-dynamic-sets`
+`compiler/tests/showcase25.mod` demonstrates the last additions:
+
+- dynamic `SET OF CARDINAL` and `SET OF INTEGER`
+- union/intersection/difference, `INCL`/`EXCL`/`IN`
+- a bounded wide `SET OF [0..100000]`
+- `ADDRESS`/pointer identity (`ADR(p^) = p`)
+
+Expected output:
+
+```text
+showcase25 sets=42 addr=ok
+```
+
+## Tags
+
+- `v3-dynamic-sets`
+- `v3-showcase25`

+ 1 - 1
docs/summary_session-2026-10-24-language-robustness.md

@@ -1,6 +1,6 @@
 # Session 2026-10-24 — language/robustness pass
 
-**Gates:** suite **309/309**, one-shot fixpoint **OK (3,845,439
+**Gates:** suite **310/310**, one-shot fixpoint **OK (3,845,439
 bytes)**, separate-object fixpoint **OK (11 objects)**, corpus
 **521/612 compile-OK, 0 crashes**.
 

+ 2 - 2
docs/summary_session-2026-10-24-separate-compilation.md

@@ -4,7 +4,7 @@ V3 now builds per-unit objects.  The one-shot mode remains the default
 for the suite/corpus.
 
 **Branch:** `master`.  **Feature state:** `v3-separate-compilation`.
-**Gates:** suite **309/309**, fixpoint **OK (3,845,439 bytes)**,
+**Gates:** suite **310/310**, fixpoint **OK (3,845,439 bytes)**,
 corpus **521/612 compile-OK, 0 crashes**.
 
 ---
@@ -88,7 +88,7 @@ Manual M2make cross-object class check: `CLib.def/.mod` + `CProg.mod`
   `gen_ssa/<Module>.o`, so definition-only data and class vtables link.
 - Added `CDefProg` (class-only `.def` vtable) and M2make checks for the
   ABI stamp and definition-only object.
-- Suite is now 309/309.
+- Suite is now 310/310.
 
 ## Generic-instance objects (2026-10-24)