still mess, probably obsolete anyways

This commit is contained in:
2025-09-20 12:15:59 +03:00
parent 8e4cc98522
commit fe69fce67b
9 changed files with 80 additions and 5 deletions

View File

@@ -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