Compute every class's instance size and every field's byte offset after pass 1, when forward type references have a kind at last, and report E096 when an instance would exceed 65535 bytes. Instances begin with the two-byte class descriptor pointer and keep fields in declaration order with no padding. Add the size and offset columns to the bank-1 type and member tables, and make the parser harness emit a deterministic layout record so a fixture can list each class's size and its fields’ offsets in declaration order.
src/common/parser.inc, src/compiler/parser.ssrc/common/diagcat.inc, docs/diagnostics.md (E096)tests/parser/parser-test.s, scripts/build-parser-test.ps1,
scripts/verify-parser-test.ps1tests/semantic/layout.n8, layout.expect, too_big.n8, too_big.expectdocs/architecture.md, docs/memory-map.mdplanning/claims/E03-S05.mdbuild/layout.n8 declares one field of every ABI size and two
arrays; layout.expect records box size 35 with offsets 2, 3, 4, 5, 7, 9,
15, 17, 21, 23, and 31 in declaration order, and empty size 2. The
verifier compares the whole $FA layout list; all 39 parser fixtures pass.too_big.n8
(word[40000] = 80,000 bytes) is rejected with E096 at 1:1, matching
too_big.expect; the size columns saturate at $FFFF rather than wrapping.layout.n8 uses bare fields and one bare public method;
the independent source oracle in verify-parser-test.ps1 derives every
member's access (fields private, methods public) and compares it against the
parser's 13 member rows for the fixture. The same check covers all accepted
fixtures.layout.n8/layout.expect is that listing. The harness's $FA record is
the deterministic layout listing the future NAME.MAP writer will consume;
the MAP writer itself belongs to E05-S02 (output.s), so no NAME.MAP file
exists to compare yet. This is recorded under remaining risks.parser.inc: added C_TYPE_SIZE_LO/HI (22/23) and
C_MEM_OFFSET_LO/HI (24/25); TABLE_COLUMNS is now 26. docs/memory-map.md
records the parser tables as 6,656 bytes.parser.s: parse_file calls layout_classes after pass 1. Helpers
field_size_mem, field_size, and elem_size compute a member's size from
its recorded type, and store_field_offset writes the current offset into
the member row. A class starts at 2; methods are skipped; overflow sets the
size to $FFFF, records the failure, and reports E096 once at the class's
declaration line and column 1. The pass loops over name IDs and member rows,
so classes and fields are laid out in declaration order.parser-test.s: dump_layout emits $FA, then per class its name, size
lo/hi, field count, and each field's name and offset lo/hi. count_fields
counts non-method member rows owned by the class. FIXTURE_COUNT is 39.verify-parser-test.ps1: decodes $FA until $FD/$FB and compares the
layout lines against layout.expect; the member loop now also stops at
$FA, because dump_layout always emits its marker before $FD.diagcat.inc: appended TYP_INSTANCE_TOO_LARGE, 96; the catalog now has 68
entries and docs/diagnostics.md was regenerated.layout_classes and
three in dump_layout; they are now short branches to nearby jmp
trampolines. The verifier edit had also joined $p += 5 and while on one
line; fixed.scripts/build-parser-test.ps1,
scripts/verify-parser-test.ps1 -Port 6530,
scripts/build-lexer-test.ps1, scripts/verify-lexer-test.ps1,
scripts/build-diag-test.ps1 -UpdateDocs,
scripts/verify-diag-test.ps1, scripts/demo-write-check.ps1.$A7);
layout.n8 matches 13 layout lines and too_big.n8 reports E096 at 1:1.
The lexer matches 10 fixtures / 6,733 dump bytes; the 68-entry diagnostic
catalog and its screen/ERR expectations match with docs in sync; the demo
saves good.n8 and bad.n8 byte-for-byte, good.n8 reports no errors, and
bad.n8 reports E151, E152, E120, and E061. vim/work.d81 was not touched.NAME.MAP text writer is E05-S02, so the declaration
order and layout listing are verified through the harness record rather than
a real .map file. E096 reports the instance's saturated $FFFF size in the
table; consumers must treat that as “too large”. Any future padding or
alignment rule would change layout.expect and the offsets.Powered by TurnKey Linux.