remove 'struct pic_macro'. define-syntax spec is changed.
This commit is contained in:
+48
-43
@@ -47,65 +47,70 @@
|
||||
(make-syntactic-closure env '() form))
|
||||
|
||||
(define-syntax capture-syntactic-environment
|
||||
(lambda (form use-env mac-env)
|
||||
(list (cadr form) (list (make-identifier 'quote mac-env) mac-env))))
|
||||
(lambda (mac-env)
|
||||
(lambda (form use-env)
|
||||
(list (cadr form) (list (make-identifier 'quote mac-env) mac-env)))))
|
||||
|
||||
(define (sc-macro-transformer f)
|
||||
(lambda (expr use-env mac-env)
|
||||
(make-syntactic-closure mac-env '() (f expr use-env))))
|
||||
(lambda (mac-env)
|
||||
(lambda (expr use-env)
|
||||
(make-syntactic-closure mac-env '() (f expr use-env)))))
|
||||
|
||||
(define (rsc-macro-transformer f)
|
||||
(lambda (expr use-env mac-env)
|
||||
(make-syntactic-closure use-env '() (f expr mac-env))))
|
||||
(lambda (mac-env)
|
||||
(lambda (expr use-env)
|
||||
(make-syntactic-closure use-env '() (f expr mac-env)))))
|
||||
|
||||
(define (er-macro-transformer f)
|
||||
(lambda (expr use-env mac-env)
|
||||
(lambda (mac-env)
|
||||
(lambda (expr use-env)
|
||||
|
||||
(define rename
|
||||
(memoize
|
||||
(lambda (sym)
|
||||
(make-identifier sym mac-env))))
|
||||
(define rename
|
||||
(memoize
|
||||
(lambda (sym)
|
||||
(make-identifier sym mac-env))))
|
||||
|
||||
(define (compare x y)
|
||||
(if (not (symbol? x))
|
||||
#f
|
||||
(if (not (symbol? y))
|
||||
#f
|
||||
(identifier=? use-env x use-env y))))
|
||||
(define (compare x y)
|
||||
(if (not (symbol? x))
|
||||
#f
|
||||
(if (not (symbol? y))
|
||||
#f
|
||||
(identifier=? use-env x use-env y))))
|
||||
|
||||
(f expr rename compare)))
|
||||
(f expr rename compare))))
|
||||
|
||||
(define (ir-macro-transformer f)
|
||||
(lambda (expr use-env mac-env)
|
||||
(lambda (mac-env)
|
||||
(lambda (expr use-env)
|
||||
|
||||
(define icache* (make-dictionary))
|
||||
(define icache* (make-dictionary))
|
||||
|
||||
(define inject
|
||||
(memoize
|
||||
(lambda (sym)
|
||||
(define id (make-identifier sym use-env))
|
||||
(dictionary-set! icache* id sym)
|
||||
id)))
|
||||
(define inject
|
||||
(memoize
|
||||
(lambda (sym)
|
||||
(define id (make-identifier sym use-env))
|
||||
(dictionary-set! icache* id sym)
|
||||
id)))
|
||||
|
||||
(define rename
|
||||
(memoize
|
||||
(lambda (sym)
|
||||
(make-identifier sym mac-env))))
|
||||
(define rename
|
||||
(memoize
|
||||
(lambda (sym)
|
||||
(make-identifier sym mac-env))))
|
||||
|
||||
(define (compare x y)
|
||||
(if (not (symbol? x))
|
||||
#f
|
||||
(if (not (symbol? y))
|
||||
#f
|
||||
(identifier=? mac-env x mac-env y))))
|
||||
(define (compare x y)
|
||||
(if (not (symbol? x))
|
||||
#f
|
||||
(if (not (symbol? y))
|
||||
#f
|
||||
(identifier=? mac-env x mac-env y))))
|
||||
|
||||
(walk (lambda (sym)
|
||||
(call-with-values (lambda () (dictionary-ref icache* sym))
|
||||
(lambda (value exists)
|
||||
(if exists
|
||||
value
|
||||
(rename sym)))))
|
||||
(f (walk inject expr) inject compare))))
|
||||
(walk (lambda (sym)
|
||||
(call-with-values (lambda () (dictionary-ref icache* sym))
|
||||
(lambda (value exists)
|
||||
(if exists
|
||||
value
|
||||
(rename sym)))))
|
||||
(f (walk inject expr) inject compare)))))
|
||||
|
||||
;; (define (strip-syntax form)
|
||||
;; (walk ungensym form))
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
(lambda (expr r c)
|
||||
(list (r 'define-syntax) (cadr expr)
|
||||
(list (r 'lambda) '_
|
||||
(list (r 'error) "invalid use of auxiliary syntax"))))))
|
||||
(list (r 'lambda) '_
|
||||
(list (r 'error) "invalid use of auxiliary syntax")))))))
|
||||
|
||||
(define-auxiliary-syntax _)
|
||||
(define-auxiliary-syntax ...)
|
||||
|
||||
Reference in New Issue
Block a user