Issue #584: Self-hosting check: C-5h, the rest below the core, C-6 (U-c1 to U-c11) and C-7

Open and answer this issue on GitHub.

selfhosting, compiler, ready · opened 2026-10-12 · updated 2026-10-12 · 1 comment

How it came up

Part of #125 / #558. check/mod.rs is moved to Nikaia through CheckHost and a state baton. The decision to cut the core into sequential units (not one step) and the unit table are in docs/selfhosting-plan.md, section “C-6 in units”; call-graph and oracle scripts in scripts/c6/. Cost and speed: docs/tokenspeed.md.

Today (develop, 0.0.848)

Done: C-1 to C-5g and U-c0 (CheckFacts, ParsedView, CheckFlow, CheckHost, the baton in check/core.rs, pilot functions, check_deep_nesting.rs). check/mod.rs was 16,083 lines at C-5d (from about 23,500).

To build (strictly one unit at a time)

  1. C-5h and the rest below the core (about 75 non-stub functions at C-5g): hands_over, widened_slot (needs a Nikaia CheckWrap first), a_map_key, the Rust adapters of a_view_kept, a_cleanup_that_moved, a_length_that_fits_its_buffer (the cleanup one reads self.newly: a host method), arguments and a_view_kept_where_the_receiver_says_text (if arguments calls the hubs expr/block it belongs to U-c3). Regenerate the list with scripts/c6/cg.py + below2.py.
  2. U-c1 check_core_leaves (field helpers, a_kept_lambda, literal_by_use, holes, lambda, returns, an_assert; adds hole_wraps to CheckHost). U-c2 check_core_comptime. U-c3 check_core_args (arguments_given, locks, list_literal, a_called_field). U-c4 check_core_call. U-c5 check_core_call_on. U-c6 check_core_method (the MethodCall SafeMethod arm, 638 lines). U-c7 check_core_stmt (stmt and block). U-c8 check_core_flow. U-c9 check_core_places. U-c10 check_core_ops. U-c11 check_core_expr (the remaining arms, the value_of dispatcher and expr; delete the host expr/block). Form: free functions check_core_*[H: CheckHost](mut state: CheckState, world, host, ..) (host.expr(self, ..) in a method is NK1102).
  3. C-7 the layer above (13 functions) and the drivers (58); check/mod.rs becomes the adapter plus check/host.rs.

Oracle per unit: lower-std package.rs identical but for the additions; scripts/c6/oracle.py OLD NEW . 0 differences; findings order, read_seq, next_choice, next_binding unchanged; check_deep_nesting passes; clippy, fmt, touched tests + specification, examples, self_hosting after the final rebase. First unit that moves an arm on the call/list/?? paths measures the stack depth per crossing (prototype: 192 bytes with a cold spare; never build a CheckState inside a stub’s frame). Callgrind (Ir + mispredictions) before and after U-c11.

Traps: Checker.s is a baton: self.s.m(.. self.s.n ..) fails E0502 (hoist into a let); a Nikaia method named expect resolves to Option::expect (name them differently); the parser is exponential on nested parentheses (#).

The commit that finishes C-7 says Fixes #<this issue>.

Comments

keywan-ghadami, 2026-10-12

The parser issue named in the traps above is #587. The sibling issue for the emitter is #583.


Generated by Claude Code

Back to Open Issues