Add src/compiler/interfaces.s, which runs once after the declaration pass.
It numbers each interface method in source order in a new C_MEM_SLOT member
column, then checks every class against every interface in its implements
list. A satisfying method is public and has the same parameter count,
parameter types, and return type; one method may satisfy identical
requirements from several interfaces. Missing and private methods report
E130, signature mismatches E131, a class method that matches a same-named
requirement of another implemented interface E132, and an implements entry
that names a class or program E133. All are reported at the class declaration
line, column 1. The parser harness emits an $F9 slot record so a fixture can
verify source order.
src/compiler/interfaces.s (new), src/compiler/parser.ssrc/common/parser.inc, src/common/diagcat.inc, docs/diagnostics.mdtests/parser/parser-test.s, scripts/build-parser-test.ps1,
scripts/verify-parser-test.ps1, scripts/demo-write-check.ps1tests/semantic/interfaces.n8, interfaces.expect, iface_bad.n8,
iface_bad.expect, tests/parser/unknown.expectdocs/architecture.md, docs/memory-map.mdplanning/claims/E03-S06.mdbuild/interfaces.n8 declares Shape (area, scale, name), Named (label,
show), and Display (show, declared after the class); the harness's
$F9 record and interfaces.expect list them as shape 0/1/2, named 0/1,
display 0. assign_slots writes that order into C_MEM_SLOT.interfaces.n8 is accepted with no ERR file in the parser run.show() satisfies both Named.show() and
Display.show(); no duplicate or conflict diagnostic is produced.iface_bad.n8 has
Left (show()) and Right (show(x as byte)) implemented by one class whose
show() matches Left; Right reports E132 at 49:1,
SHOW HAS CONFLICTING SIGNATURES.iface_bad.n8 expects E130 at 28:1 (AREA),
E130 at 31:1 (LABEL, private), E131 at 37:1 (SCALE, word vs byte), and
E131 at 43:1 (OK, word vs boolean). E133 at 54:1 covers a class used as an
interface. All six exact diagnostics match their messages.42a26c9).tests/parser/unknown.n8 (Worker
implements Printable without print); its exact expectation gained that
first pass-1 line and still passes with six diagnostics.interfaces.s: assign_slots numbers interface methods by declaration;
check_interfaces walks classes and implements lists in source order and
reports at the class line. find_method ignores fields; a private method is
treated as not implemented. same_sig compares result type, parameter count,
and all parameter types. conflicting decides E132 by looking for a
same-named requirement in another implemented interface whose signature the
class method does satisfy. iface_err spells the argument from name_out
and reports through diag_report, returning carry when the error limit
stops compilation.parser.s exports tb_set, calls assign_slots then check_interfaces
after layout_classes, and returns at once if the diagnostic limit is hit.parser.inc: C_MEM_SLOT = 26, TABLE_COLUMNS = 27; the parser tables are
now 6,912 bytes in docs/memory-map.md.parser-test.s: dump_ifaces emits $F9, each interface name, member
count, and each slot/name pair. Fixtures 40-41 added; FIXTURE_COUNT = 41.verify-parser-test.ps1: decodes $F9 before $FA, stops the type and
member loops at it, treats the new iface group like an accepted fixture
for diagnostics/member checks, and compares slot lines to
interfaces.expect.diagcat.inc: E132 % HAS CONFLICTING SIGNATURES, E133
% IS NOT AN INTERFACE; catalog is 70 entries and docs are regenerated.bcs @stop/beq @inext branches in the
6502 code; each became a short branch plus jmp trampoline.scripts/build-parser-test.ps1,
scripts/verify-parser-test.ps1 -Port 6530,
scripts/build-diag-test.ps1 -UpdateDocs,
scripts/verify-diag-test.ps1 -Port 6530,
scripts/verify-lexer-test.ps1 -Port 6530,
scripts/demo-write-check.ps1 (good.n8 and bad.n8),
scripts/demo-write-check.ps1 -Programs bad.n8.$A7);
interfaces.n8 reports 6 interface slots and 11 members that match the
source oracle, and ifacebad.n8 matches all six exact diagnostics. The
diagnostics catalog has 70 entries and its screen/ERR expectations and docs
are in sync. The lexer still matches 10 fixtures / 6,733 bytes. The demo
rebuilt and linked interfaces.s; good.n8 completed its Vim save and C128
check in the full run, and the bad.n8 rerun saved 258 PETSCII bytes
identically and reported E151, E152, E120, and E061.-Port 6530. Interface dispatch tables and their MAP output
remain E04/E05 work; C_MEM_SLOT is the stable input for them.Powered by TurnKey Linux.