parse_statement parses every spec 7 form (assignment, call, if/else,
while, for/to/step, return, print, delete) and requires the line to end
after it. Expressions use precedence climbing over spec 8's levels: binary
operators left associative, unary not and - nesting rightwards, postfix
member access, calls, and indexing tightest. A syntax error is reported in
pass 1, unwinds to the statement, and skips the line; E03-S02's name,
member, and access checks now run from the parser in pass 2, replacing the
token scan. Expression nesting is bounded at 16 levels (E225).
Verified in x128: 31 fixtures, including the two statement fixtures that
were pending since E03-S01, a postfix trace golden for precedence and
associativity (both mutations caught), every statement form, and 15
independent syntax errors with recovery. Lowest stack pointer $A7. New
diagnostics E038-E042 and E225. The demo passes; its Vim typing is slowed
to 200 ms per key after one doubled keystroke.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pass 1 now records every field and method signature (access, type,
parameter types) in bank-1 member and parameter tables, rejects duplicate
fields or methods per type, invalid init/destroy shapes (E151/E152, D122),
and `var` after a method statement or inside a block. Each signature and the
program open a typed local scope. Pass 2 scans statement lines: unqualified
names must be locals, parameters, or fields of the enclosing class (D123),
and member chains through locals, fields, self, new, calls, and indexing
report unknown members (E061) and private access (E120) at the member.
The parser test PRG grew past $4000 and crashed: mmu_init copies the COMMON
load image in the system mapping, where BASIC ROM hides $4000+. COMMON now
loads right after STARTUP and mmu.s asserts both stay below $4000.
Verified in x128: 28 fixtures, member tables against a source-derived
oracle, privacy and scope mutations caught; map, source, lexer, names, and
diagnostics suites pass on the new layout.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>