mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-14 00:07:36 +02:00
Changed call signature of cyc-er-rename
This commit is contained in:
parent
d445b4c85f
commit
8a31c2ed0f
3 changed files with 17 additions and 8 deletions
|
@ -39,7 +39,7 @@
|
||||||
(compiled-macro?
|
(compiled-macro?
|
||||||
((Cyc-get-cvar (cdr macro))
|
((Cyc-get-cvar (cdr macro))
|
||||||
exp
|
exp
|
||||||
Cyc-er-rename
|
(Cyc-er-rename 'todo-mac-env)
|
||||||
Cyc-er-compare?))
|
Cyc-er-compare?))
|
||||||
(else
|
(else
|
||||||
;; Assume evaluated macro
|
;; Assume evaluated macro
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
(list
|
(list
|
||||||
(cdr macro)
|
(cdr macro)
|
||||||
(list 'quote exp)
|
(list 'quote exp)
|
||||||
Cyc-er-rename
|
(Cyc-er-rename 'todo-mac-env)
|
||||||
Cyc-er-compare?)
|
Cyc-er-compare?)
|
||||||
env))))))
|
env))))))
|
||||||
|
|
||||||
|
|
|
@ -221,8 +221,9 @@
|
||||||
;;; Explicit renaming macros
|
;;; Explicit renaming macros
|
||||||
|
|
||||||
;; ER macro rename function, based on code from Chibi scheme
|
;; 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
|
(lambda (sym) sym)) ; TODO: temporary placeholder, see below
|
||||||
|
;(define (Cyc-er-rename mac-env)
|
||||||
; Notes:
|
; Notes:
|
||||||
;
|
;
|
||||||
; need to figure out what to return from this function so that renaming
|
; 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??????
|
; - interpreter can use a-env and global-env??????
|
||||||
; there are open questions about extending a-env, but without eval being
|
; 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.
|
; 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.
|
; 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)
|
; ((lambda (name)
|
||||||
; (set! renames (cons (cons identifier name) renames))
|
; (set! renames (cons (cons identifier name) renames))
|
||||||
; name)
|
; 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.
|
; ; gensym not good enough, need to also preserve ref trans.
|
||||||
; ; also note that an identifier can be an object, it does not
|
; ; also note that an identifier can be an object, it does not
|
||||||
; ; just have to be a symbol. although, of course, the rest
|
; ; just have to be a symbol. although, of course, the rest
|
||||||
|
|
|
@ -381,7 +381,7 @@
|
||||||
;; Compiled macro, call directly
|
;; Compiled macro, call directly
|
||||||
(analyze (apply macro-op
|
(analyze (apply macro-op
|
||||||
(list (cons (car exp) (operands exp))
|
(list (cons (car exp) (operands exp))
|
||||||
Cyc-er-rename
|
(Cyc-er-rename a-env)
|
||||||
Cyc-er-compare?))
|
Cyc-er-compare?))
|
||||||
a-env)
|
a-env)
|
||||||
;; Interpreted macro, build expression and eval
|
;; Interpreted macro, build expression and eval
|
||||||
|
@ -389,7 +389,7 @@
|
||||||
(list (cons 'quote
|
(list (cons 'quote
|
||||||
(list (cons (car exp)
|
(list (cons (car exp)
|
||||||
(operands exp))))
|
(operands exp))))
|
||||||
Cyc-er-rename
|
(Cyc-er-rename a-env)
|
||||||
Cyc-er-compare?))))
|
Cyc-er-compare?))))
|
||||||
(analyze
|
(analyze
|
||||||
(eval expr a-env) ;; Expand macro
|
(eval expr a-env) ;; Expand macro
|
||||||
|
|
Loading…
Add table
Reference in a new issue