README.md 2.0 KB

Pasta80 Pascal-S validator pilot

pasta80.atg describes Pascal-S as implemented by Arzu/Terry's Coco/R-Turbo-Pascal compiler (1996-97). The reference files (Grammars/Pasta80/pasta80.atg, identical to Pascual/pascual.atg modulo its tags line) are written for a newer Coco/R generation: attributed rules (<params>, (.. actions ..), SYNC), so the pilot is a mechanical port — actions/attributes stripped by script, <> restored where the stripper ate the operator — plus hand fixes, all diagnosed against psc (the Turbo batch interpreter built with fpc -Mtp) as oracle:

  1. | empty literal from the eaten <> (in RelOp).
  2. Strict Statement { ";" Statement } lists (block body, CompStat, parameter tails) made tolerant.
  3. Duplicate preal in RealConst merged.
  4. WriteArg string-vs-expression conflict merged into Expression [ ":" ... ] (after proving psc accepts string comparisons, so StrConst belongs in Factor).
  5. Mandatory ";" after every record field relaxed to the tolerant list shape.
  6. Missing CASE statement added whole (CASE/OF/|/END, labels are pnumber/ident/pstring, no ranges, no ELSE — each shape probed).
  7. REPEAT with "," separators corrected to ";" (probed: psc takes semicolons, rejects commas).
  8. Bare READ/WRITE calls: parens made optional (probed).

One benign LL(1) warning family remains (dangling-ELSE).

Build

./build.sh        # -> build/Pasta80 (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).

Differential results (Pasta80 vs psc)

The PascalS accept battery (22 cases) + tests/deep.pas (nested routines with var params, records, all statements, reals): 0 false positives. Broken mutants (12): 0 missed, positions close. (i := 1 without ; and unterminated comments are accepted by psc too — separator/recovery leniency, correctly skipped.)