mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
WIP
This commit is contained in:
parent
a01086e904
commit
117ddab3f4
1 changed files with 41 additions and 39 deletions
|
@ -222,7 +222,7 @@
|
|||
|
||||
;; ER macro rename function, based on code from Chibi scheme
|
||||
(define (Cyc-er-rename mac-env)
|
||||
(lambda (sym) sym)) ; TODO: temporary placeholder, see below
|
||||
; (lambda (sym) sym)) ; TODO: temporary placeholder, see below
|
||||
|
||||
;TODO: I think we're ready to cut back over to this now?
|
||||
|
||||
|
@ -263,44 +263,46 @@
|
|||
; a new lambda scope is introduced?
|
||||
; - need to keep track of it for compiled macro expansion
|
||||
;
|
||||
; ((lambda (renames)
|
||||
; (lambda (identifier)
|
||||
; ((lambda (cell)
|
||||
; (if cell
|
||||
; (cdr cell)
|
||||
; ((lambda (name)
|
||||
; (set! renames (cons (cons identifier name) renames))
|
||||
; name)
|
||||
;
|
||||
; (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
|
||||
; ; of the code needs to be able to handle identifiers in
|
||||
; ; forms other than symbols, if that is done.
|
||||
; ;
|
||||
; ;(make-syntactic-closure mac-env '() identifier)
|
||||
; )))
|
||||
; (assq identifier renames))))
|
||||
; ;; TODO: For now, do not allow renaming of special form symbols to
|
||||
; ;; prevent issues within the compiler
|
||||
; '(
|
||||
; (define . define)
|
||||
; (define-syntax . define-syntax)
|
||||
; (if . if)
|
||||
; (lambda . lambda)
|
||||
; (quote . quote)
|
||||
; (set! . set!)
|
||||
; )))
|
||||
((lambda (renames)
|
||||
(lambda (identifier)
|
||||
((lambda (cell)
|
||||
; (if cell
|
||||
; (cdr cell)
|
||||
; ((lambda (name)
|
||||
; (set! renames (cons (cons identifier name) renames))
|
||||
; name)
|
||||
|
||||
; (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
|
||||
; ; of the code needs to be able to handle identifiers in
|
||||
; ; forms other than symbols, if that is done.
|
||||
; ;
|
||||
; ;(make-syntactic-closure mac-env '() identifier)
|
||||
; )))
|
||||
identifier)
|
||||
(assq identifier renames))
|
||||
))
|
||||
;; TODO: For now, do not allow renaming of special form symbols to
|
||||
;; prevent issues within the compiler
|
||||
'(
|
||||
(define . define)
|
||||
(define-syntax . define-syntax)
|
||||
(if . if)
|
||||
(lambda . lambda)
|
||||
(quote . quote)
|
||||
(set! . set!)
|
||||
)))
|
||||
|
||||
(define (Cyc-er-compare? a b)
|
||||
;; TODO: this is not good enough, need to determine if these symbols
|
||||
|
|
Loading…
Add table
Reference in a new issue