comptime-API: strip the byte-weld; pivot to a flat-memory comptime VM

The byte-weld (sx structs whose layout was validated to mirror the
compiler's Zig records) plus the serialization/marshaling bridge was the
wrong direction: it bolted a parallel layout regime and hand-built
byte-copies onto a comptime value model that fundamentally isn't bytes.

Strip the struct-weld machinery:
- compiler_lib.zig loses the type registry (weldStruct / bound_types /
  BoundType / FieldLayout / findType / SxField / LayoutMismatch /
  validateStructLayout); it is now just the intern/text_of function
  host-call bridge (kept as the Phase-3 compiler-call seed).
- nominal.zig loses validateWeldedStruct / weldedFieldOrderStr + the
  sd.abi == .zig validation call.
- Remove the struct-weld unit tests and examples 0625/0627 (welded
  structs) + 1183/1186 (weld-layout diagnostics).
- The #library / abi / extern syntax stays.

Record the new direction: a bytecode VM over flat, byte-addressable
memory so comptime values are native bytes (no weld/validation/marshal),
target-aware (preserves cross-compilation) and sandboxed. See
current/PLAN-COMPILER-VM.md (Phase 0 strip -> Phase 1 flat-memory value
model -> Phase 2 bytecode -> Phase 3 compiler-API on flat memory).
design/comptime-compiler-api.md gets a SUPERSEDED banner. Also drop the
"~500 lines / split the step" rule from CLAUDE.md.
This commit is contained in:
agra
2026-06-17 19:29:36 +03:00
parent 40d075ca98
commit 18af8eb845
23 changed files with 505 additions and 498 deletions

View File

@@ -340,10 +340,10 @@ overhaul, mem.sx + protocol expansion), **LANG** (user-facing language
features — diagnostics renderer, heterogeneous variadic packs), and
**ERR** (error handling: separate-channel `!` errors, `try` / `catch` /
`or` / `onfail`, return traces), and **COMPILER-API** (the comptime `compiler`
library `#library "compiler"` + `abi(.zig) extern compiler`; welded compiler
types/functions that supersede the metatype `declare`/`define` `#builtin`s and
the `#compiler` attribute). They touch mostly disjoint files; any can be
advanced independently.
library that supersedes the metatype `declare`/`define` `#builtin`s and the
`#compiler` attribute — **pivoted 2026-06-17** off the byte-weld to a **flat-memory
bytecode comptime VM** as its foundation; see `current/PLAN-COMPILER-VM.md`). They
touch mostly disjoint files; any can be advanced independently.
1. Read all checkpoints to see where each stream is paused:
- `current/CHECKPOINT.md` — IR progress tracker.
@@ -352,14 +352,17 @@ advanced independently.
- `current/CHECKPOINT-LANG.md` — LANG progress tracker.
- `current/CHECKPOINT-ERR.md` — ERR progress tracker.
- `current/CHECKPOINT-COMPILER-API.md` — COMPILER-API progress tracker
(has a `## ⏯ Resume` block; currently mid-Phase 2 on branch `reify`).
(has a `## ⏯ Resume` block; **pivoted to the flat-memory VM** — Phase 0 strip
pending, branch `reify`).
2. Read the plan that corresponds to the stream the user wants to advance:
- `current/PLAN.md` — IR implementation plan.
- `current/PLAN-FFI.md` — FFI ceremony reduction plan.
- `~/.claude/plans/tidy-doodling-cray.md` — MEM (mem.sx) implementation plan.
- `current/PLAN-LANG.md` — LANG implementation plan.
- `current/PLAN-ERR.md` — ERR implementation plan.
- `design/comptime-compiler-api.md` — COMPILER-API design-of-record + build order.
- `current/PLAN-COMPILER-VM.md`**COMPILER-API active plan** (flat-memory bytecode
comptime VM, then re-home the compiler-API on it). `design/comptime-compiler-api.md`
is the SUPERSEDED weld design, kept only for history + to scope the Phase 0 strip.
3. Read `specs.md` if you need to understand language behavior.
4. Pick up from the next incomplete step in the relevant `CHECKPOINT*.md`.
If the user hasn't said which stream to work on, ask before picking.
@@ -397,7 +400,6 @@ advanced independently.
- **Never modify `src/codegen.zig` in Phases 01.** It is the safety net.
- In Phase 3, only read specific sections of codegen.zig (grep for the relevant handler).
- No step should require reading more than ~1,000 lines of existing code. If it does, split it.
- No step should produce more than ~500 lines of new code. If it does, split it.
- If Claude gets confused mid-step, stop, update `current/CHECKPOINT.md` with partial progress, and tell the user to start a new session.
## Context management