Extend src/compiler/parser.s so pass 1 records every interface and class
member (fields and method signatures, with access, type, and parameter
types) in bank-1 tables, enforces unique field and method names per type and
the init/destroy shapes, and keeps locals leading in method bodies. Each
method and the program get their own local scope with recorded local types.
Pass 2 scans statement lines for name references: bare names must resolve to
a local/parameter or (inside a method) a field of the enclosing class, and
expr.member chains through locals, fields, self, new, calls, and
indexing to report unknown and private members at the member's position.
E03-S03 replaces the scan with the real expression parser and reuses the
lookups.
src/compiler/parser.s, src/common/parser.incsrc/compiler/names.s (adds lookup-only name_find)src/common/diagcat.inc (appended entries), docs/diagnostics.mdtests/parser/scripts/build-parser-test.ps1, scripts/verify-parser-test.ps1docs/architecture.md, docs/memory-map.md, docs/decisions.mdplanning/claims/E03-S02.mdbuild/members/lifecycle/scopes/private (51 member
rows, default field-private/method-public included). scopes.n8 rejects
var after a method statement (22:5) and inside a block (40:5); the
program may still interleave var at its top level (35).init/destroy shapes:
members.n8 rejects a second method area in an interface (3:10) and a
class (17:18) and a second field size (9:15), while one field and one
method may share a name. lifecycle.n8 rejects init/destroy in an
interface (E030), init ... as word (E151, D122), a second init
(E060), and destroy with parameters (E152, first one) and a result
(E151); class Fine shows parameterized init and private destroy pass.scopes.n8 reports one()'s local and parameter in two(), class A's
field in class B, three()'s parameter and local in four(), method
locals and fields in the program, self in the program, and an unknown
new Ghost() (8 pass-2 diagnostics, exact positions). Mutation: removing
the per-signature scope reset fails 5 fixtures.private.n8 reports 6 E120s at the member's column, through a parameter,
local, call result (v.make().hidden, p.look().secret), and index
(list[0].secret), with Thief resolving Vault's members before Vault is
declared; access from Vault's own methods (through self, a bare field,
or another Vault) passes; unknown members are E061. Mutation: disabling
the privacy test drops the 6 E120s and fails the fixture.scripts/verify-parser-test.ps1 passes 24 fixtures before any
change.name_find (lookup without interning) so pass 2 never grows the
name table: a name first seen in a statement was never declared.SEM_LIFECYCLE_RETURN, E152 SEM_LIFECYCLE_PARAMS, E223
RES_TOO_MANY_MEMBERS, E224 RES_TOO_MANY_PARAMS; docs regenerated.$4000, and mmu_init copies the COMMON load image
(then placed after DATA) in the system mapping, where BASIC ROM covers
$4000-$7FFF. Fix: cfg/compiler.cfg loads COMMON directly after
STARTUP, and mmu.s asserts at link time that mmu_init and the COMMON
image stay at or below $4000. Region addresses (D117) are unchanged.
Map skeleton, source, lexer, names, and diagnostics suites were rerun on
the new layout.scripts/verify-parser-test.ps1 (final run, plus the two
mutations above); scripts/build-diag-test.ps1 catalog check; because
cfg/compiler.cfg changed, verify-map-skeleton.ps1 (including its
overflow variants), verify-source-test.ps1, verify-lexer-test.ps1,
verify-names-test.ps1, and verify-diag-test.ps1.src/compiler/parser.s, src/common/parser.inc,
src/compiler/names.s, src/compiler/mmu.s, cfg/compiler.cfg,
src/common/diagcat.inc, docs/diagnostics.md, docs/decisions.md
(D122, D123 proposed), docs/architecture.md, docs/memory-map.md,
tests/parser/ (4 fixtures + expectations, harness dump),
scripts/build-parser-test.ps1, scripts/verify-parser-test.ps1, this
claim.x.f(...) reports “not declared” rather than a type error; E03-S03/S04
should replace it. Access to init from new outside the class is not
checked (spec silent). The type descriptor (base, name, 16-bit length) is
provisional until E03-S04. Member and parameter capacities (255 each) are
untested at the limit. CODE/DATA may now exceed $4000; only mmu_init
and code run before mmu_bank0 must stay below it (asserted for
mmu_init and COMMON; test STARTUP code is first in MAIN).Powered by TurnKey Linux.