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:
parent
d35783bf1b
commit
930800f9a6
6 changed files with 81 additions and 19 deletions
|
|
@ -236,6 +236,29 @@
|
|||
(ok "throw: uncaught exits non-zero" (not= code 0)
|
||||
(string "code=" code " out=" out)))
|
||||
|
||||
# 3j) quoted literals (inc 3f): a :quote node reconstructs the reader form as RT
|
||||
# values — symbols, lists, vectors, maps, sets, nested. Value parity vs the CLI.
|
||||
(each src ["'foo"
|
||||
"'foo/bar"
|
||||
"':kw"
|
||||
"'(1 2 3)"
|
||||
"'[1 2 3]"
|
||||
"'(a b c)"
|
||||
"'{:a 1}"
|
||||
"'(1 (2 3) 4)"
|
||||
"(first '(10 20 30))"
|
||||
"(count '[1 2 3])"
|
||||
"(rest '(1 2 3))"
|
||||
"(= 'foo 'foo)"
|
||||
"(= 'a 'b)"
|
||||
"(map inc '(1 2 3))"
|
||||
"(conj '[1 2] 3)"
|
||||
"(get '{:a 7} :a)"]
|
||||
(let [[code out err] (d/run-on-chez ctx src)
|
||||
want (cli-oracle src)]
|
||||
(ok (string "quote: " src) (and (= code 0) (= out want))
|
||||
(string "chez=" out " janet=" want " | " err))))
|
||||
|
||||
# 3h) prelude mode (inc 3d): emitting clojure.core ITSELF, a core->core ref must
|
||||
# lower to a runtime var-deref instead of being rejected as "out of subset".
|
||||
# `frequencies` is a core fn but not a native-op, so it exercises the switch.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue