Просмотр исходного кода

docs: step-7 harness notes plus goal_step8 roadmap (opaque types, proctypes, quads)

Eric Streit 3 недель назад
Родитель
Сommit
223d3ec4df
2 измененных файлов с 77 добавлено и 0 удалено
  1. 65 0
      docs/goal_step8.md
  2. 12 0
      docs/summary_m2comp_step7.md

+ 65 - 0
docs/goal_step8.md

@@ -0,0 +1,65 @@
+# Goals — steps 8+ (saved, to implement next)
+
+Roadmap after step 7 (backend listing). Order is priority order;
+each step keeps the full suite green with no cascades.
+
+## Step 8 — opaque types (recommended next)
+
+Scope (finishes the step-5 library story: information hiding):
+- `TYPE T;` (opaque declaration) in `DEFINITION`; the full
+  declaration in `IMPLEMENTATION` (`TYPE T = RECORD ... END;`).
+- Outside the implementation, opaque `T` is usable only behind
+  `POINTER TO T`, as a `VAR` formal type, and for assignment
+  between same-opaques. No client `VAR` of type `T`, no field
+  access, no construction, no value parameters or function
+  results of opaque type (all static 230s/201s).
+
+Design deltas (vs step 7):
+- SymTab: opaque descriptor form (or alias-with-hidden-target +
+  flag); export table carries opaque-ness; completion in the
+  implementation reuses one descriptor index so both sides agree;
+  compatibility: same-opaque assigns, nothing else crosses.
+- Grammar: `TYPE` ident `;` alternative in definitions (mid-rule:
+  `TYPE T = ...` stays); implementation `TYPE` accepts the
+  completion (name/type match, else 221-ish/230).
+- MGen: expected unchanged (clients can never size an opaque —
+  pointers are 1 slot; the implementation walks the completed
+  descriptor normally).
+
+Acceptance (same bar):
+- ~4 run tests (counter/stack ADT: New/Free/Use/Count ExitCodes)
+  + ~5 rejection tests (client VAR, field access, value param,
+  opaque result, completion mismatch); 65-test regression green.
+
+Suggested first tests:
+- `DCounter`-style ADT (`New` returns pointer, `Inc`/`Get`),
+  completion mismatch (different base → reject), client
+  `VAR x : T` → reject, `p^.field` from client → reject.
+
+## Step 9 — procedure types + indirect calls
+
+Scope: `TYPE H = PROCEDURE (INTEGER): INTEGER;` variables,
+procedure constants as values, calls through variables, handlers
+as actuals. Requires a VM design spike first: no direct indirect-
+call opcode exists (`CE jump_stack` = bare computed jump; return
+linkage/frames must be designed, possibly a new opcode or a
+linkage convention in MGen). Do NOT start emitting before the
+spike lands in `mc64-spec.md`.
+
+## Step 10 — LONGINT / LONGREAL
+
+Scope: 64-bit `LONGINT`/`LONGCARD` (`0C5–CC`), `LONGREAL` quads
+(`0x12`), literals, conversions, full operator lowering, print
+helper extension. Large but mechanical: lexer, descriptors, every
+operator family, mixed-type rules. (Predefs currently alias to
+32-bit/64-bit-float as placeholders.)
+
+## Later (explicitly deferred)
+
+- Multi-`.MC4` emission with `depCount` loading (loader path is
+  proven by `STAK`/`DEP`; the emitter side is the work).
+- Source-line mapping for `DumpImage` (needs positions on AST
+  nodes: grammar + AST + backend change).
+- `WITH`-field / `CHAR` tails as `VAR` actuals, open-to-open
+  array passing, circular imports (v1 hardening list, unchecked
+  here so far).

+ 12 - 0
docs/summary_m2comp_step7.md

@@ -29,6 +29,18 @@ A full sweep over all test sources shows zero unknowns. Suite
   local table); missing size broke alignment and swallowed a
   label. Same class of latent defect the listing exists to catch.
 
+## Harness findings (multi-file listings)
+
+- Definition and implementation share one `.LST` basename, so the
+  committed listing is whichever unit compiles last; ad-hoc
+  single-file compiles leave stale content behind. Canonical
+  state = one full suite run (each session's last writer wins).
+- The "second program" rejection first compiled `d_basic` twice
+  in one process (duplicate errors, never reaching the driver
+  gate). It now uses a dedicated empty `tests/d_second.mod`, so
+  both programs parse clean and the driver's program-last gate
+  fires with clean listings on both sides.
+
 ## Limits
 
 - No source-line mapping (AST nodes carry no positions — needs