mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Cut-over to expand2
This commit is contained in:
parent
9a3d370de4
commit
e177410706
3 changed files with 9 additions and 13 deletions
|
@ -102,7 +102,7 @@
|
|||
;(set! input-program (add-libs input-program))
|
||||
|
||||
;; JAE DEBUG code, remove (or refactor) once working
|
||||
(trace:info "JAE DEBUG - compiled macros")
|
||||
;(trace:info "JAE DEBUG - compiled macros")
|
||||
;(trace:info
|
||||
; (filter
|
||||
; (lambda (v)
|
||||
|
@ -124,8 +124,8 @@
|
|||
*defined-macros*)))
|
||||
(macro:load-env! *defined-macros* (create-environment '() '()))
|
||||
;TODO: try this again, make sure macro is loaded:
|
||||
(trace:info (list 'defined-macros *defined-macros*))
|
||||
(trace:info (list 'macro-env (macro:get-env)))
|
||||
;(trace:info (list 'defined-macros *defined-macros*))
|
||||
;(trace:info (list 'macro-env (macro:get-env)))
|
||||
;; END JAE DEBUG
|
||||
|
||||
(set! input-program (expand input-program (macro:get-env)))
|
||||
|
|
|
@ -87,10 +87,10 @@
|
|||
(define (macro:expand2 exp macro mac-env)
|
||||
(let* ((compiled-macro? (or (macro? (Cyc-get-cvar (cadr macro)))
|
||||
(procedure? (cadr macro)))))
|
||||
(newline)
|
||||
(display "/* ")
|
||||
(display (list 'macro:expand2 exp macro compiled-macro?))
|
||||
(display "*/ ")
|
||||
;(newline)
|
||||
;(display "/* ")
|
||||
;(display (list 'macro:expand2 exp macro compiled-macro?))
|
||||
;(display "*/ ")
|
||||
|
||||
;; Invoke ER macro
|
||||
(cond
|
||||
|
@ -108,10 +108,6 @@
|
|||
(list 'quote exp)
|
||||
(Cyc-er-rename mac-env)
|
||||
Cyc-er-compare?)
|
||||
; TODO: this is broken because mac-env only contains macros, but
|
||||
; we need global-env to handle functions (like null?, caddr, etc).
|
||||
; not sure what the answer is yet... might need to base macro-env
|
||||
; on global-env, and ensure symbol is a macro before expanding
|
||||
mac-env)))))
|
||||
|
||||
; TODO: get macro name, transformer
|
||||
|
|
|
@ -793,8 +793,8 @@
|
|||
(let ((val (env:lookup (car exp) env #f)))
|
||||
(if (tagged-list? 'macro val)
|
||||
(expand ; Could expand into another macro
|
||||
(macro:expand 'val exp env *defined-macros*)
|
||||
;(macro:expand2 exp val env)
|
||||
;(macro:expand 'val exp env *defined-macros*)
|
||||
(macro:expand2 exp val env)
|
||||
env)
|
||||
(map
|
||||
(lambda (expr) (expand expr env))
|
||||
|
|
Loading…
Add table
Reference in a new issue