mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 05:39:17 +02:00
Experimenting with using macro:expand
This commit is contained in:
parent
acde9d9b30
commit
cfe4c90b5c
1 changed files with 14 additions and 11 deletions
|
@ -573,10 +573,12 @@
|
|||
(if (Cyc-macro? macro-op)
|
||||
;; Compiled macro, call directly
|
||||
(let ((expanded
|
||||
(apply macro-op
|
||||
(list (cons (car exp) (operands exp))
|
||||
(Cyc-er-rename rename-env a-env '())
|
||||
(Cyc-er-compare? rename-env a-env)))))
|
||||
(macro:expand exp (list 'macro macro-op) a-env rename-env '())
|
||||
;(apply macro-op
|
||||
; (list (cons (car exp) (operands exp))
|
||||
; (Cyc-er-rename rename-env a-env '())
|
||||
; (Cyc-er-compare? rename-env a-env)))
|
||||
))
|
||||
(display "/* ")
|
||||
(write `(DEBUG expand ,exp ))
|
||||
(newline)
|
||||
|
@ -587,13 +589,14 @@
|
|||
a-env
|
||||
rename-env))
|
||||
;; Interpreted macro, build expression and eval
|
||||
(let* ((expr (cons macro-op
|
||||
(list (cons 'quote
|
||||
(list (cons (car exp)
|
||||
(operands exp))))
|
||||
(Cyc-er-rename rename-env a-env '())
|
||||
(Cyc-er-compare? rename-env a-env))))
|
||||
(expanded (eval expr a-env)) ;; Expand macro
|
||||
(let* (;(expr (cons macro-op
|
||||
; (list (cons 'quote
|
||||
; (list (cons (car exp)
|
||||
; (operands exp))))
|
||||
; (Cyc-er-rename rename-env a-env '())
|
||||
; (Cyc-er-compare? rename-env a-env))))
|
||||
; (expanded (eval expr a-env)) ;; Expand macro
|
||||
(expanded (macro:expand exp (list 'macro macro-op) a-env rename-env '()))
|
||||
)
|
||||
(display "/* ")
|
||||
(write `(DEBUG expand ,exp))
|
||||
|
|
Loading…
Add table
Reference in a new issue