docs: spec §2 (reader) — grammar, reader-macro catalog, syntax-quote contract

The lexical-syntax chapter, granularity modeled on jank's 62-file
per-construct reader corpus: token grammar (whitespace/comments, collections
with read-time duplicate checks, numbers incl. the N/M tower question,
symbols/keywords incl. ::auto-resolution, strings/chars), the quote-family
sugars, the full #-dispatch catalog with normative entries (anonymous fn
%-derivation, discard composition, reader conditionals, symbolic floats,
tagged literals), and the syntax-quote contract (core/alias/current-ns
qualification, template-stable gensyms, ~' idiom, distribution through
collections).

Adapting the corpus surfaced and filed three findings, recorded as labeled
divergences/UNVERIFIED in the chapter: nested syntax-quote doesn't collapse
(S25, (= "meow" ```"meow") is false), #inst reads as a bare string (identity
data reader, no instant type), and jolt satisfies :clj in reader
conditionals (feature-key policy under review).

reader-forms-spec gains 11 chapter-cited rows (discard stacking, ##Inf/
##-Inf/##NaN, :default conditionals, qualified var-quote identity, gensym
stability within vs across templates) — all passing.
This commit is contained in:
Yogthos 2026-06-10 11:23:38 -04:00
parent 4d4402b75a
commit 2224e40afc
3 changed files with 206 additions and 1 deletions

View file

@ -48,3 +48,18 @@
# jolt-edb (fixed): ~/~@ inside set literals.
["splice in set" "#{0 1 2 3}" "(let [b [0] a [1 2 3] e []] `#{~@e ~@a ~@b})"]
["unquote in set" "#{5 9}" "(let [x 5] `#{~x 9})"])
# Spec 02-reader S17/S19/S18/S13a/S22: discard, symbolic values, conditionals,
# var-quote identity, gensym stability (jank corpus derived).
(defspec "reader / discard, symbolic values, conditionals (spec 2.3)"
["discard simple" "2" "(do #_1 2)"]
["discard in vector" "[1 3]" "[1 #_2 3]"]
["discard stacks" "3" "(do #_ #_ 1 2 3)"]
["##Inf" "true" "(= ##Inf (/ 1.0 0.0))"]
["##-Inf" "true" "(= ##-Inf (/ -1.0 0.0))"]
["##NaN not self-equal" "false" "(= ##NaN ##NaN)"]
["##NaN is NaN?" "true" "(NaN? ##NaN)"]
["conditional :default reachable" "2" "#?(:no-such-dialect 1 :default 2)"]
["var-quote qualified" "true" "(= (var clojure.core/str) #'clojure.core/str)"]
["gensym stable in template" "true" "(let [syms `[meow# meow#]] (= (first syms) (second syms)))"]
["gensym fresh across templates" "false" "(= `meow# `meow#)"])