Changed call signature of cyc-er-rename

This commit is contained in:
Justin Ethier 2015-08-27 22:26:53 -04:00
parent d445b4c85f
commit 8a31c2ed0f
3 changed files with 17 additions and 8 deletions

View file

@ -39,7 +39,7 @@
(compiled-macro?
((Cyc-get-cvar (cdr macro))
exp
Cyc-er-rename
(Cyc-er-rename 'todo-mac-env)
Cyc-er-compare?))
(else
;; Assume evaluated macro
@ -53,7 +53,7 @@
(list
(cdr macro)
(list 'quote exp)
Cyc-er-rename
(Cyc-er-rename 'todo-mac-env)
Cyc-er-compare?)
env))))))

View file

@ -221,8 +221,9 @@
;;; Explicit renaming macros
;; ER macro rename function, based on code from Chibi scheme
(define Cyc-er-rename
(define (Cyc-er-rename mac-env)
(lambda (sym) sym)) ; TODO: temporary placeholder, see below
;(define (Cyc-er-rename mac-env)
; Notes:
;
; need to figure out what to return from this function so that renaming
@ -245,8 +246,6 @@
; - interpreter can use a-env and global-env??????
; there are open questions about extending a-env, but without eval being
; able to define-syntax (yet), I think we can defer that until later.
; - environment code needs to be added to a common place, away from eval.sld
done, need to change eval to use new functions from this module
;
; can pass mac-env, useenv in to this guy (and compare as well), and possibly add renamed bindings to it.
;
@ -269,7 +268,17 @@ done, need to change eval to use new functions from this module
; ((lambda (name)
; (set! renames (cons (cons identifier name) renames))
; name)
; (gensym identifier)
;
; (let ((val (env:lookup identifier mac-env 'not-defined)))
; (cond
; ((eq? val 'not-defined)
; identifier)
; (else
; (let ((renamed (gensym identifier)))
; (env:define-variable! renamed val mac-env)
; renamed))))
; ;
; ;(gensym identifier)
; ; gensym not good enough, need to also preserve ref trans.
; ; also note that an identifier can be an object, it does not
; ; just have to be a symbol. although, of course, the rest

View file

@ -381,7 +381,7 @@
;; Compiled macro, call directly
(analyze (apply macro-op
(list (cons (car exp) (operands exp))
Cyc-er-rename
(Cyc-er-rename a-env)
Cyc-er-compare?))
a-env)
;; Interpreted macro, build expression and eval
@ -389,7 +389,7 @@
(list (cons 'quote
(list (cons (car exp)
(operands exp))))
Cyc-er-rename
(Cyc-er-rename a-env)
Cyc-er-compare?))))
(analyze
(eval expr a-env) ;; Expand macro