replace Scheme read with our tokenizer and parser

Also implement . as field access operator and preserve ;-comments in
generated C
This commit is contained in:
2026-07-17 12:45:01 +03:00
parent 8ae2346e41
commit 1ca77aaf59
9 changed files with 339 additions and 64 deletions

View File

@@ -3,7 +3,8 @@
(chicken base)
(chicken pathname)
(chicken process-context)
srfi-1)
srfi-1
srfi-69)
(define-syntax prog1
(syntax-rules ()
@@ -64,3 +65,18 @@
(eq? new-cdr (cdr old-cons)))
old-cons
(cons new-car new-cdr)))
;;; Source-location map.
;;; Our hand-written reader records the source line of each form here,
;;; keyed by the form's cons cell (eq?). This replaces CHICKEN's
;;; read-with-source-info / get-line-number, which only works when
;;; forms are produced by the built-in `read'. The key survives
;;; semantic processing because `recons' preserves the original cons
;;; cell for forms it does not structurally change.
(define +form-lines+ (make-hash-table eq?))
(define (set-form-line! form line)
(hash-table-set! +form-lines+ form line))
(define (form-line form)
(hash-table-ref/default +form-lines+ form #f))