goal_step5.md 1.7 KB

Step 5 goal — Hardening + modules (saved, to implement next)

Scope (Phase 4 of the plan)

  • Finish composites: open-array parameters (ARRAY OF T + HIGH), whole array/record copy (copy_block), value composite parameters/returns, composite =/# (string_comp for CHAR arrays, 213 otherwise), VAR actuals with tails (a[i], p^, fields — currently 233), CHAR slot-packing cleanup (currently 8x over-allocated).
  • Checking: opt-in range checks (DA/DB/DC, unchecked stays default), NIL dereference VM trap (currently reads 0).
  • Modules: DEFINITION/IMPLEMENTATION split, IMPORT/EXPORT, qualified identifiers (M.x — currently QualIdent kills the tail), separate compilation to one .MC4 (loader already handles depCount, currently rejected).
  • Explicitly deferred: LONGINT/LONGCARD 64-bit (0C5–CC, 0x40 14–1C), LONGREAL quads (0x12), procedure types/variables, cones.

Design deltas (vs step 4)

  • SymTab: open-array descriptors (isOpen + elem), module scopes/symbols, export tables.
  • MGen: open-array hidden length temps, copy_block for value params/returns + whole assignment, string_comp (0C4) for CHAR-array comparison.
  • Policy to fix at start: one-file vs separate-.MC4 linkage; SYSTEM services vs language I/O (replace the ExitCode convention?).

Acceptance (same bar)

~15 run + ~10 rejection tests, all green, no cascades; full 74-test regression still passing (→ ~99 total).

Suggested first tests

Open-array sum/HIGH (value + VAR); whole-array copy; string =/#; multi-module import (exported procedure + variable); NIL trap; HIGH on a fixed array (must fail cleanly).