Eric Streit f9043074ef build: split standard library into dialect folders há 1 dia atrás
..
README.md f9043074ef build: split standard library into dialect folders há 1 dia atrás
corpus.sh f9043074ef build: split standard library into dialect folders há 1 dia atrás

README.md

v3-corpus

Runs the V3 compiler (compiler/M2) over a corpus of standard Modula-2 sources and reports compile coverage — unlike tools/topspeed-grammar, which runs the sidecar grammar.

./corpus.sh [corpus-dir ...]
# default: gm2 testsuite pim/pass + iso/run/pass

Each source is copied into a scratch tree (so its .LST listing never touches the corpus) and compiled on its own. A file with 0 errors is a pass. Failures are split into:

  • CRASH — M2 died (rc ≥ 128): a real compiler bug;
  • LIB — the file imports a module V3 does not ship (gm2's NumberIO/FpuIO are shipped; M2RTS/Builtins/Processes/… are not), so the undeclared identifiers are expected, not a language gap;
  • LANG — otherwise: a genuine parse/semantic gap in V3.

A "pass" is syntactic+semantic cleanup, not a linkable image (many testsuite files are DEFINITION/IMPLEMENTATION modules with no program; V3 reports those as Incorrect source but with 0 errors).

An IMPLEMENTATION file is compiled together with its sibling DEFINITION (same basename, .def/.DEF) when present, and with the DEFINITION of every module it imports, searched in the source directory and in the colon-separated $V3_LIBS directories — so cross-module imports resolve. Without $V3_LIBS, the harness selects the dialect folder from the corpus directory (lib/iso for .../iso/..., lib/pim otherwise) plus lib/common and the optional lib/gm2 compatibility modules; runtime/syslib is shared. A file importing e.g. Strings or IOChan resolves against the real .def; point $V3_LIBS at an installed gm2 library set for a wider net, e.g.:

G=$HOME/bin/Modula2/Gm2/lib/gcc/x86_64-pc-linux-gnu/16.0.1/m2
V3_LIBS="$G/m2pim:$G/m2iso:$G/m2log:$G/m2cor:$G/m2min" ./corpus.sh

Corpora used:

  • gm2 testsuite pim/pass + iso/run/pass;
  • the gm2 standard libraries, e.g. $HOME/bin/Modula2/Gm2/lib/gcc/x86_64-pc-linux-gnu/16.0.1/m2/{m2pim,m2iso,m2log,m2cor,m2min}.

Current baseline: docs/summary_v3-corpus.md.