p6_pascal.atg describes Wirth's Pascal-P6 (1980) compiler input. It
shares the P4 skeleton (same repair pass: quoted ";" literals,
terminated productions, no "" empties, no ident/token double
definitions, no reserved words as productions, start production
matching COMPILER, left-recursion removal, filled-in undefined
nonterminals, merged duplicate branches, lenient list shapes) plus its
own deltas, all diagnosed against fpc -Miso as oracle:
EnumType ((red, green, blue)) alongside the other types.ParamType (array[expr] of T, expression bounds) merged with
ArrayType into a single Bound form (SimpleType for
array[boolean]-style index types, Expr [".." Expr] for ranges
and computed bounds) — the two array[-led productions generated
duplicate CASE labels and would not compile separately.ProcSection (proc-led procedural-type form) kept reachable via
StructType.Label = pnumber | ident (enum case labels), with statement labels
kept numeric-only — an optional [Label ":"] prefix commits on
ident and then chokes on :=, so i := 1 would break; fpc
rejects ident-statement-labels anyway.preal/CONTEXT("..")/subrange TypeIdent upgrade carried
over (floats, 0..255, N..M, dotted names).The generated parser gets a strict EOF check
(IF sym # 0 THEN SynError(0) after the start symbol in Parse,
patched in by build.sh with a loud assertion): without it, the
Coco/R driver never scans past the program's final ., silently
ignoring trailing garbage — and worse, masking any failure that
leaves a . behind (e.g. unhandled float syntax). This makes the
validator marginally stricter than fpc, which accepts trailing junk
after END. — degenerate input only, documented here.
Two benign LL(1) warning families remain (dangling-ELSE, loop-exit
";" greediness — both resolve correctly).
if/while/for branches take a single Statement (standard Pascal
— plural branches greedily swallow the ; separating case items),
and begin..end compounds are statements in their own right.
./build.sh # -> build/P6 (build/ is git-ignored)
Needs CR (Coco/R), gm2 -fiso, the parser.frm/scanner.frm
frames and FileIO.def/.mod — all resolved from the environment with
sensible defaults (CRFRAMES, M2LIB, CR, GM2).
fpc -Miso)Accept battery (transferred from P4) + tests/deep.pas (enums,
records, subrange-free shapes, nested routines, labels/goto, all
statements): 0 false positives. Broken mutants: 0 missed,
positions close.