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)))))))) (error `(Unhandled expansion ,expanded))))))))
(trace:info "---------------- after macro expansion:") (trace:info "---------------- after macro expansion:")
(trace:info input-program) ;pretty-print (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 ;; Separate global definitions from the rest of the top-level code
(set! input-program (set! input-program

View file

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

View file

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