Introducing Sex SEMantic ENgine: the semen. Also split reader to other file (it can be replaced in the future). Macro expansion inside Sex code doesn't work yet, and it must be done in semen, not during fmt-c generation as before.
23 lines
523 B
Scheme
23 lines
523 B
Scheme
(declare (unit sex-reader))
|
|
|
|
(include "utils.macros.scm")
|
|
|
|
(import (chicken pathname)
|
|
brev-separate
|
|
fmt)
|
|
|
|
(define (read-forms acc)
|
|
(let ((r (read)))
|
|
(if (eof-object? r) (reverse acc)
|
|
(read-forms (cons r acc)))))
|
|
|
|
(define (read-from-file file)
|
|
(with-directory file
|
|
(with-input-from-file (pathname-strip-directory file)
|
|
(fn (read-forms (list))))))
|
|
|
|
(define (read-raw-forms input-source)
|
|
(if (eq? input-source 'stdin)
|
|
(read-forms (list))
|
|
(read-from-file input-source)))
|