mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 04:25:06 +02:00
WIP
This commit is contained in:
parent
d549722cc4
commit
6c456ff10d
2 changed files with 21 additions and 5 deletions
|
@ -894,14 +894,30 @@
|
||||||
;; TODO: also need to figure out how to deep-copy rename-env and associate it with
|
;; TODO: also need to figure out how to deep-copy rename-env and associate it with
|
||||||
;; any defined macro. would need to pull that out when macro is expanded later
|
;; any defined macro. would need to pull that out when macro is expanded later
|
||||||
((lambda? exp)
|
((lambda? exp)
|
||||||
(let* ((args (lambda-formals->list exp))
|
(let* ((use-env (env:extend-environment '() '() '()))
|
||||||
|
(args (lambda-formals->list exp))
|
||||||
(ltype (lambda-formals-type exp))
|
(ltype (lambda-formals-type exp))
|
||||||
(a-lookup (map (lambda (a) (cons a (gensym a))) args))
|
;(a-lookup (map (lambda (a) (cons a (gensym a))) args))
|
||||||
|
;; Experimenting with ER renaming. still think there may be a problem with
|
||||||
|
;; this, though. because when a nested lambda comes around with the same
|
||||||
|
;; identifier as an enclosing lambda, its vars would not be given unique renames
|
||||||
|
(a-lookup
|
||||||
|
(map
|
||||||
|
(lambda (a)
|
||||||
|
(let ((a/r (cons a (Cyc-er-rename use-env env))))
|
||||||
|
(env:define-variable! (cdr a/r) (car a/r) rename-env)
|
||||||
|
a/r))
|
||||||
|
args))
|
||||||
(new-formals
|
(new-formals
|
||||||
(list->lambda-formals
|
(list->lambda-formals
|
||||||
(map cdr a-lookup)
|
(map cdr a-lookup)
|
||||||
ltype))
|
ltype))
|
||||||
)
|
)
|
||||||
|
(newline)
|
||||||
|
(display "/* ")
|
||||||
|
(display (list 'expand a-lookup))
|
||||||
|
(newline)
|
||||||
|
(display "*/ ")
|
||||||
`(lambda ,new-formals ;,(lambda->formals exp)
|
`(lambda ,new-formals ;,(lambda->formals exp)
|
||||||
,@(_expand-body
|
,@(_expand-body
|
||||||
'()
|
'()
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
(write
|
(write
|
||||||
(let ((x 'outer))
|
(let ((x 'outer))
|
||||||
;(let-syntax ((m (syntax-rules () ((m) x))))
|
(let-syntax ((m (syntax-rules () ((m) x))))
|
||||||
(let ((x 'inner))
|
(let ((x 'inner))
|
||||||
(x)))) ;; Should be outer
|
(m)))) ;; Should be outer
|
||||||
; )
|
)
|
||||||
;;;; Just testing, may want to remove this one once the recursive macro expansion works
|
;;;; Just testing, may want to remove this one once the recursive macro expansion works
|
||||||
;;; (define-syntax my-or2 (syntax-rules ()
|
;;; (define-syntax my-or2 (syntax-rules ()
|
||||||
;;; ((my-or2) #f)
|
;;; ((my-or2) #f)
|
||||||
|
|
Loading…
Add table
Reference in a new issue