This commit is contained in:
Justin Ethier 2016-09-16 19:19:25 -04:00
parent f51a680eef
commit d2019bb284
3 changed files with 13 additions and 4 deletions

View file

@ -147,6 +147,10 @@
(error `(Unhandled expansion ,expanded))))))))
(trace:info "---------------- after macro expansion:")
(trace:info input-program) ;pretty-print
; TODO:
;(set! input-program (macro:cleanup input-program))
;(trace:info "---------------- after macro expansion cleanup:")
;(trace:info input-program) ;pretty-print
;; Separate global definitions from the rest of the top-level code
(set! input-program

View file

@ -101,6 +101,11 @@
(define (macro:cleanup expr)
(define (clean expr bv) ;; Bound variables
(newline)
(display "/* macro:cleanup->clean\n ")
(write expr)
(newline)
(display "*/ ")
(cond
((const? expr) expr)
;((prim? expr) expr)
@ -141,8 +146,8 @@
(map (lambda (e) (clean e bv))
expr))
(else
(error "macro cleanup unexpected expression: " expr)))
(clean expr '())))
(error "macro cleanup unexpected expression: " expr))))
(clean expr '()))
; TODO: get macro name, transformer
; TODO: let-syntax forms

View file

@ -605,8 +605,8 @@
(let ((renamed (gensym identifier)))
(env:define-variable! renamed identifier use-env)
;(env:define-variable! renamed val mac-env)
(Cyc-write `(ER rename ,identifier to ,renamed) (current-output-port))
(Cyc-display "\n" (current-output-port))
;(Cyc-write `(ER rename ,identifier to ,renamed) (current-output-port))
;(Cyc-display "\n" (current-output-port))
renamed)
;identifier ;; TESTING!
)