# Step: V3 compiler corpus run (gm2 testsuite) Tag `v3-corpus-run`. V3 suite **151/151**, fixpoint OK (unchanged — this only adds a harness and a doc). ## Why The TopSpeed corpus validated the *sidecar grammar*, not V3 the compiler (the sidecar is a separate `TSM2` binary built from `TopSpeed-V3-M2.atg`; it reuses V3's `SymTab`/`QbeGen`/`FileIO` sources but never runs `compiler/M2`). So this step runs **V3 itself** over a real standard-Modula-2 corpus: the gm2 testsuite `testsuite/gm2/pim/pass` and `testsuite/gm2/iso/run/pass`. Harness: `tools/v3-corpus/corpus.sh` (copies each file to a scratch tree, compiles alone, splits failures into CRASH / LIB / LANG — see its README). ## Baseline | | files | | --- | --- | | total | **612** | | **compile-OK** (0 errors) | **219** | | CRASH (M2 died, rc ≥ 128) | **7** | | LIB (imports a gm2 library V3 lacks) | **182** | | LANG (real V3 gap) | **204** | So ~182 of the 393 failures are simply **missing gm2 libraries** (`StrIO`, `NumberIO`, `STextIO`, `SWholeIO`, `FpuIO`, `WholeStr`, `StdIO`, `M2RTS`, `DynamicStrings`, `Processes`, …) — expected, not language gaps. The signal is the **204 LANG** files. ## Top LANG gaps (from the corpus) - **7 crashes** — all set-related: `largeset`, `program2`, `set9`, `sets3`, `smallset4/5/6`. Real bugs (segfaults), highest priority. - **48 `not supported yet`** — deliberate V3 `230`s; the corpus shows which constructs matter, e.g. **array constructors** (`array {'h','e','l','l','o'}` in `arrayconst1`). - **79 `undeclared identifier`** — mostly **`SYSTEM` facilities** V3 does not expose (`FROM SYSTEM IMPORT BYTE;` → `BYTE`), plus small library holes. - **Anchored subranges** `INTEGER [-1 .. 24]` (`array2`, `array3`) — PIM form V3's `Subrange` does not parse (`';' expected` at `[`). - **Unnamed parameters in procedure types** (`PROCEDURE (VAR ARRAY OF REAL)` in `another.mod`) — PIM allows them; V3 requires a name (`ident expected`). - Assorted: `incompatible assignment`/`comparison` on char arrays, `invalid ArrayType`, `invalid call`, `FOR … BY`, etc. ## Reproduce ```sh cd tools/v3-corpus ./corpus.sh # -> 219 compile-OK / 7 CRASH / 182 LIB / 204 LANG ``` ## Suggested next steps 1. **Fix the 7 set crashes** (a correctness bug — a compiler must not segfault on valid input). 2. **`SYSTEM` facilities**: expose at least `BYTE` / `WORD` / `SHORTADDR` etc. so `FROM SYSTEM IMPORT …` works. 3. **Anchored subranges** `T[lo..hi]` (small grammar addition). 4. **Unnamed proc-type parameters** (small grammar addition). 5. **Array constructors** `array{…}` (bigger: codegen). ## Files `tools/v3-corpus/{corpus.sh,README.md}`, this doc.