Chez Phase 1 (increment 3d): clojure.core prelude emit mode + gap catalog

Add a prelude emit mode to host/chez/emit.janet: when emitting clojure.core
itself (not user -e), a non-native clojure.core ref lowers to a runtime
var-deref instead of being rejected as out-of-subset, so core fns chain
through each other. Default (subset) mode is unchanged — the corpus probe
still rejects unimplemented core refs for a clean signal.

core-prelude-probe.janet walks the tiers through the live analyzer->emit
pipeline and catalogs reach + gaps (macros skipped; analyze-time only).
Baseline: 303/355 non-macro core forms emit. Remaining gaps are a tight
punch-list for the next increments: :throw (29), :quote (8), :try (2), Java
host interop (6), letfn (4), declare (2). Probe has a regression floor.

emit-test 83/83 (added prelude-mode lowering assertions); subset probe
619/619 unchanged; full gate green.
This commit is contained in:
Yogthos 2026-06-17 16:29:29 -04:00
parent 45208afff1
commit 8f26433469
4 changed files with 154 additions and 2 deletions

View file

@ -54,6 +54,27 @@ cases pass**, 0 divergences; 2036/2655 out of subset (await clojure.core on Chez
a rest-arg lambda (the Scheme rest list is coerced to a jolt seq, nil when empty),
which is the gating lift for emitting the clojure.core tiers as a prelude.
## Phase 1 — clojure.core prelude emission (inc 3d, jolt-ocvi)
The `-e`-capable jolt-chez path: emit the clojure.core tiers
(`jolt-core/clojure/core/NN-*.clj`) through the same analyzer → emit pipeline as a
Scheme PRELUDE of `def-var!` forms, so user code's `(var-deref "clojure.core" …)`
resolves the fn at runtime. `emit/set-prelude-mode!` flips a switch: in the default
(subset) mode a non-native `clojure.core` ref is rejected ("out of subset"); in
prelude mode it lowers to a runtime `var-deref` so core fns chain through each
other. Host interop (`:host`) and unhandled IR ops still error in both modes —
those are the real gaps that need a hand-written RT shim or new emit support.
`core-prelude-probe.janet` (gated behind `JOLT_CHEZ_PRELUDE=1`) measures reach and
catalogs the gaps; macros are skipped (analyze-time only, not a runtime value):
JOLT_CHEZ_PRELUDE=1 janet test/chez/core-prelude-probe.janet
Baseline: **303/355 non-macro core forms emit** to Scheme. Remaining 52 gaps:
`:throw` (29, the big one — needs an exception model), `:quote` (8, needs RT
symbols/lists), `:try` (2), Java host interop `.write`/`.isDirectory` (6, io tier),
`letfn` (4), `declare`/def-no-init (2), one edge (`parse-uuid`). Each is a clean
next-increment target. The probe has a regression floor (raise it as gaps close).
Prior, inc 3b (seq tier + dynamic IFn, jolt-5pso): 595/595 compiled, 0 divergences,
2060/2655 out of subset. The seq tier brought up a list/lazy-seq type with
first/rest/next/seq/cons/list, map/filter/reduce/into/remove,