parser.s runs two passes over the cached source. Pass 1 parses interfaces,
classes (implements lists, fields, method headers), and the one program,
records top-level types in a bank-1 table, tracks method/program/if/while/
for blocks, checks duplicate locals, and reports syntax, ordering, and
duplicate errors with line-level recovery. Pass 2 reports type references
that name no declared type, so forward references are legal.
Verified in x128 against 24 fixtures through the real ERR files: 7/7
accepted, 10/12 rejected grammar fixtures at their sidecar positions
(line_cont and multi_stmt are statement-level, pending E03-S03), and five
parser fixtures matching their complete diagnostic lists. A pass-order
mutation is caught. D121 (proposed): method names may be keywords, as
spec 5.1's `method print()` requires.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
diagcat.inc is the single catalog: one line per diagnostic with a stable
number in a per-category range. Included by errors.inc it gives E_*
constants; included by diagnostics.s it gives the message table.
docs/diagnostics.md is generated from it. The build rejects out-of-range
or duplicate numbers and any grammar .expect symbol missing from it.
diagnostics.s prints a two-line, 40-column-safe screen form and appends
full lines to NAME.ERR. NAME.ERR is scratched at the start and created
only when needed. After 20 errors, E221 replaces the next one and the
caller must stop. diskio.s gains output-file and DOS-command wrappers.
Verified in x128: screen RAM rows, diag.err and limit.err read back from
the D81, stale-file scratching, an unwritable ERR name (DOS 33 -> E201
once), and no open files after any phase. A counting mutation is caught.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>