kernel: reader macros + 8 tests (Phase 1 closure) [consumes-lex]
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 44s

Parser now reads 'expr, \`expr, ,expr, ,@expr as the four standard
shorthands. Quote uses existing $quote operative; quasiquote /
unquote / unquote-splicing recognised but not yet expanded at runtime
(left for first consumer to drive). 218 tests total across six suites.
This commit is contained in:
2026-05-11 21:01:01 +00:00
parent d896685555
commit c21eb9d5ad
3 changed files with 40 additions and 2 deletions

View File

@@ -37,7 +37,10 @@
(= c "(")
(= c ")")
(= c "\"")
(= c ";"))))
(= c ";")
(= c "'")
(= c "`")
(= c ","))))
;; Numeric grammar: [+-]? (digit+ ('.' digit+)? | '.' digit+) ([eE][+-]?digit+)?
(define
@@ -199,6 +202,16 @@
((= (at) "(") (do (adv) (read-list (list))))
((= (at) "\"")
(do (adv) (kernel-string-make (read-string-body ""))))
((= (at) "'")
(do (adv) (list "$quote" (read-form))))
((= (at) "`")
(do (adv) (list "$quasiquote" (read-form))))
((= (at) ",")
(do (adv)
(cond
((= (at) "@")
(do (adv) (list "$unquote-splicing" (read-form))))
(:else (list "$unquote" (read-form))))))
(:else (classify-atom (read-atom-body ""))))))
(define
read-list