Chez Phase 1 (increment 3f): quoted literals

Emit a :quote node by reconstructing the raw reader form as RT constructor
calls: symbol -> jolt-symbol, list (array) -> jolt-list, vector (tuple) ->
jolt-vector, map -> jolt-hash-map, set -> jolt-hash-set, scalars via emit-const.
The runtime value of a quote is just that literal data (the interpreter returns
the reader form verbatim).

Quote exposed a latent seq.ss bug: empty map/filter results were jolt-nil, but
Clojure's (map f []) is an empty seq, so (= () (map f [])) must be true. Return
jolt-empty-list (which seqs back to nil, so it's still a valid lazy-tail
terminator) instead — matching jolt-take/drop/rest/list.

Prelude emit reach 334 -> 342/355. Subset probe 632 -> 664/664 compiled, 0
divergences (quote + the seq fix pull 32 corpus cases into the subset). emit-test
110/110 (added 16 quote cases). corpus.edn regenerated (the 3 malformed-catch
spec rows). Full gate green.
This commit is contained in:
Yogthos 2026-06-17 17:43:34 -04:00
parent d35783bf1b
commit 930800f9a6
6 changed files with 81 additions and 19 deletions

View file

@ -48,12 +48,13 @@ compile-time signal) and are counted "out of subset", not as divergences.
JOLT_CHEZ_CORPUS=1 janet test/chez/run-corpus-chez.janet
Baseline after inc 3e (throw/try + ex-info): **632/632 compiled cases pass**, 0
divergences; 2023/2655 out of subset (await clojure.core on Chez). Inc 3c
(multi-arity + variadic fns) brought this to 619/619 — `emit-fn` lowers
multi-arity fns to a Scheme `case-lambda` and variadic fns to a rest-arg lambda
(the Scheme rest list is coerced to a jolt seq, nil when empty); inc 3e's
throw/try/ex-info support pulled 13 more corpus cases into the subset.
Baseline after inc 3f (quoted literals): **664/664 compiled cases pass**, 0
divergences; 1994/2658 out of subset (await clojure.core on Chez). Inc 3e
(throw/try + ex-info) was 632/632; inc 3f's quote support + a seq.ss fix (empty
`map`/`filter` results are `()` not nil, matching Clojure) pulled 32 more corpus
cases into the subset. `emit-fn` lowers multi-arity fns to a Scheme `case-lambda`
and variadic fns to a rest-arg lambda (rest list coerced to a jolt seq, nil when
empty).
## Phase 1 — clojure.core prelude emission (inc 3d, jolt-ocvi)
The `-e`-capable jolt-chez path: emit the clojure.core tiers
@ -70,15 +71,16 @@ 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 after inc 3e (throw/try + ex-info): **334/355 non-macro core forms emit**
to Scheme (was 303 at inc 3d). `:throw` lowers to `jolt-throw` (Scheme `raise` of
the raw jolt value, like the Janet compiled back end); `:try` lowers to `guard`
(catch, class dropped → catch-all) + `dynamic-wind` (finally); `ex-info` is a
native-op building the tagged jolt map, so the ex-data/ex-message/ex-cause tier
fns read it over `get` for free. Remaining 21 gaps: `:quote` (8, needs RT
symbols/lists), 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).
Baseline after inc 3f (quoted literals): **342/355 non-macro core forms emit** to
Scheme (was 334 at inc 3e, 303 at inc 3d). A `:quote` node reconstructs the raw
reader form as RT constructor calls — symbol → `jolt-symbol`, list → `jolt-list`,
vector → `jolt-vector`, map/set → `jolt-hash-map`/`jolt-hash-set`, scalars via
`emit-const`. Prior: `:throw``jolt-throw` (Scheme `raise` of the raw jolt
value); `:try``guard` (catch, class dropped → catch-all) + `dynamic-wind`
(finally); `ex-info` native-op building the tagged jolt map, so the tier
ex-data/ex-message/ex-cause read it over `get` for free. Remaining 13 gaps: Java
host interop `.write`/`.isDirectory` (6, io tier), `letfn` (4), `declare`/
def-no-init (2), one edge (`parse-uuid`). The probe has a regression floor.
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