mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 13:49:16 +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)
|
(if (Cyc-macro? macro-op)
|
||||||
;; Compiled macro, call directly
|
;; Compiled macro, call directly
|
||||||
(let ((expanded
|
(let ((expanded
|
||||||
(apply macro-op
|
(macro:expand exp (list 'macro macro-op) a-env rename-env '())
|
||||||
(list (cons (car exp) (operands exp))
|
;(apply macro-op
|
||||||
(Cyc-er-rename rename-env a-env '())
|
; (list (cons (car exp) (operands exp))
|
||||||
(Cyc-er-compare? rename-env a-env)))))
|
; (Cyc-er-rename rename-env a-env '())
|
||||||
|
; (Cyc-er-compare? rename-env a-env)))
|
||||||
|
))
|
||||||
(display "/* ")
|
(display "/* ")
|
||||||
(write `(DEBUG expand ,exp ))
|
(write `(DEBUG expand ,exp ))
|
||||||
(newline)
|
(newline)
|
||||||
|
@ -587,13 +589,14 @@
|
||||||
a-env
|
a-env
|
||||||
rename-env))
|
rename-env))
|
||||||
;; Interpreted macro, build expression and eval
|
;; Interpreted macro, build expression and eval
|
||||||
(let* ((expr (cons macro-op
|
(let* (;(expr (cons macro-op
|
||||||
(list (cons 'quote
|
; (list (cons 'quote
|
||||||
(list (cons (car exp)
|
; (list (cons (car exp)
|
||||||
(operands exp))))
|
; (operands exp))))
|
||||||
(Cyc-er-rename rename-env a-env '())
|
; (Cyc-er-rename rename-env a-env '())
|
||||||
(Cyc-er-compare? rename-env a-env))))
|
; (Cyc-er-compare? rename-env a-env))))
|
||||||
(expanded (eval expr a-env)) ;; Expand macro
|
; (expanded (eval expr a-env)) ;; Expand macro
|
||||||
|
(expanded (macro:expand exp (list 'macro macro-op) a-env rename-env '()))
|
||||||
)
|
)
|
||||||
(display "/* ")
|
(display "/* ")
|
||||||
(write `(DEBUG expand ,exp))
|
(write `(DEBUG expand ,exp))
|
||||||
|
|
Loading…
Add table
Reference in a new issue