mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Working letrec-syntax
Need to understand a bit more why this works, though...
This commit is contained in:
parent
b397e00522
commit
c404a6b588
1 changed files with 25 additions and 25 deletions
|
@ -471,24 +471,24 @@
|
|||
(define (analyze-letrec-syntax exp a-env)
|
||||
(let* ((rename-env (env:extend-environment '() '() '()))
|
||||
|
||||
; (vars (foldl (lambda (lis acc) (append acc (car lis))) '() a-env))
|
||||
; (vals (foldl (lambda (lis acc) (append acc (cdr lis))) '() a-env))
|
||||
; (zipped (apply map list vars (list vals)))
|
||||
; (defined-macros
|
||||
; (filter
|
||||
; (lambda (v)
|
||||
; (Cyc-macro? (Cyc-get-cvar (cadr v))))
|
||||
; zipped))
|
||||
; (macro-env
|
||||
; (env:extend-environment
|
||||
; (map car defined-macros)
|
||||
; (map (lambda (v)
|
||||
; (list 'macro (cadr v)))
|
||||
; defined-macros)
|
||||
; '())) ;; base-env
|
||||
(vars (foldl (lambda (lis acc) (append acc (car lis))) '() a-env))
|
||||
(vals (foldl (lambda (lis acc) (append acc (cdr lis))) '() a-env))
|
||||
(zipped (apply map list vars (list vals)))
|
||||
(defined-macros
|
||||
(filter
|
||||
(lambda (v)
|
||||
(Cyc-macro? (Cyc-get-cvar (cadr v))))
|
||||
zipped))
|
||||
(macro-env
|
||||
(env:extend-environment
|
||||
(map car defined-macros)
|
||||
(map (lambda (v)
|
||||
(list 'macro (cadr v)))
|
||||
defined-macros)
|
||||
(create-environment '() '())))
|
||||
|
||||
;(expanded (expand exp macro-env rename-env))
|
||||
(expanded (expand exp a-env rename-env))
|
||||
(expanded (expand exp macro-env rename-env))
|
||||
;(expanded (expand exp a-env rename-env))
|
||||
(cleaned (macro:cleanup expanded rename-env))
|
||||
)
|
||||
(analyze cleaned a-env)))
|
||||
|
@ -876,10 +876,10 @@
|
|||
(current-error-port))
|
||||
(newline (current-error-port)))
|
||||
;(log exp)
|
||||
(display "/* ")
|
||||
(write `(expand ,exp))
|
||||
(display "*/ ")
|
||||
(newline)
|
||||
;;(display "/* ")
|
||||
;;(write `(expand ,exp))
|
||||
;;(display "*/ ")
|
||||
;;(newline)
|
||||
(cond
|
||||
((const? exp) exp)
|
||||
((prim? exp) exp)
|
||||
|
@ -1006,10 +1006,10 @@
|
|||
#;(if v
|
||||
v
|
||||
(env:lookup (car exp) rename-env #f)))))))
|
||||
(display "/* ")
|
||||
(write `(app DEBUG ,(car exp) ,val ,env ,local-env ,rename-env ,(env:lookup (car exp) env #f)))
|
||||
(display "*/ ")
|
||||
(newline)
|
||||
;;(display "/* ")
|
||||
;;(write `(app DEBUG ,(car exp) ,val ,env ,local-env ,rename-env ,(env:lookup (car exp) env #f)))
|
||||
;;(display "*/ ")
|
||||
;;(newline)
|
||||
(cond
|
||||
((tagged-list? 'macro val)
|
||||
(_expand ; Could expand into another macro
|
||||
|
|
Loading…
Add table
Reference in a new issue