forked from alex-eg/sex
still mess, probably obsolete anyways
This commit is contained in:
17
sexc.scm
17
sexc.scm
@@ -180,24 +180,35 @@
|
||||
(eval (cons 'import (cdr form))) acc)
|
||||
((import)
|
||||
(append (process-raw-forms
|
||||
|
||||
(import-modules (cdr form)) (list))
|
||||
acc))
|
||||
(else
|
||||
(walk-sex-tree form acc))))
|
||||
|
||||
(define (process-raw-forms raw-forms acc)
|
||||
"First processing pass"
|
||||
(if (null? raw-forms)
|
||||
(reverse acc)
|
||||
(process-raw-forms (cdr raw-forms)
|
||||
(process-form (car raw-forms) acc))))
|
||||
|
||||
;;; Second pass
|
||||
|
||||
(define (process-sex-forms forms)
|
||||
"Second processing pass.
|
||||
|
||||
In this pass we do form-rearranging manipulations, like docstring extraction."
|
||||
forms)
|
||||
|
||||
;;; Aux functions
|
||||
|
||||
(define (read-forms acc)
|
||||
(let ((r (read)))
|
||||
(if (eof-object? r) (reverse acc)
|
||||
(read-forms (cons r acc)))))
|
||||
|
||||
(define (emit-c forms)
|
||||
"Final conversion to C"
|
||||
(for-each (lambda (form)
|
||||
(fmt #t (c-expr form) nl))
|
||||
forms))
|
||||
@@ -338,7 +349,9 @@
|
||||
(if (eq? input 'stdin)
|
||||
(read-forms (list))
|
||||
(read-from-file input)))
|
||||
(sex-forms (process-input input raw-forms)))
|
||||
(sex-forms
|
||||
(process-sex-forms
|
||||
(process-input input raw-forms))))
|
||||
(if (or (get-arg args 'macro-expand #f)
|
||||
(get-arg args 'preprocess #f))
|
||||
;; Preprocess or macroexpand
|
||||
|
||||
Reference in New Issue
Block a user