#| -*-Scheme-*-
-$Id: runtime.pkg,v 14.401 2001/12/21 18:37:35 cph Exp $
+$Id: runtime.pkg,v 14.402 2001/12/22 03:19:19 cph Exp $
Copyright (c) 1988-2001 Massachusetts Institute of Technology
unmap-reference-trap
unmapped-macro-reference-trap?
unmapped-unassigned-reference-trap?
- unmapped-unbound-reference-trap?))
+ unmapped-unbound-reference-trap?)
+ (export (runtime syntaxer)
+ make-macro-reference-trap-expression)
+ (export (runtime unsyntaxer)
+ macro-reference-trap-expression-transformer
+ macro-reference-trap-expression?))
(define-package (runtime rep)
(files "rep")
syntax-table/define)
(export (runtime syntaxer)
guarantee-syntax-table
+ make-syntax-table
syntax-table/environment
syntax-table/extend
syntax-table/ref))
#| -*-Scheme-*-
-$Id: syntax.scm,v 14.48 2001/12/21 18:22:41 cph Exp $
+$Id: syntax.scm,v 14.49 2001/12/22 03:17:19 cph Exp $
Copyright (c) 1988-2001 Massachusetts Institute of Technology
(define (syntax-top-level name syntaxer expression table)
(let ((scode
(fluid-let ((*syntax-table*
- (if (eq? table 'DEFAULT)
- (if (unassigned? *syntax-table*)
- (nearest-repl/environment)
- *syntax-table*)
- (guarantee-syntax-table table name)))
+ (make-syntax-table
+ (if (eq? table 'DEFAULT)
+ (if (unassigned? *syntax-table*)
+ (nearest-repl/environment)
+ *syntax-table*)
+ (guarantee-syntax-table table name))))
(*current-keyword* #f))
(syntaxer #t expression))))
(if *disallow-illegal-definitions?*
(let ((value (syntax-subexpression value)))
(syntax-table/define *syntax-table* name (syntax-eval value))
(if top-level?
- (make-definition name (make-macro-reference-trap value))
+ (make-definition name (make-macro-reference-trap-expression value))
name)))
(define (syntax-eval scode)
#| -*-Scheme-*-
-$Id: unsyn.scm,v 14.25 2001/12/21 18:22:53 cph Exp $
+$Id: unsyn.scm,v 14.26 2001/12/22 03:17:22 cph Exp $
Copyright (c) 1988-2001 Massachusetts Institute of Technology
`(SET! ,name ,@(unexpand-binding-value value)))))
(define (unexpand-definition name value)
- (cond ((macro-reference-trap? value)
+ (cond ((macro-reference-trap-expression? value)
`(DEFINE-SYNTAX ,name
- ,(macro-reference-trap-transformer value)))
+ ,(macro-reference-trap-expression-transformer value)))
((and (eq? #t unsyntaxer:macroize?)
(lambda? value)
(not (has-substitution? value)))
#| -*-Scheme-*-
-$Id: urtrap.scm,v 14.9 2001/12/21 18:22:57 cph Exp $
+$Id: urtrap.scm,v 14.10 2001/12/22 03:17:25 cph Exp $
Copyright (c) 1988-1999, 2001 Massachusetts Institute of Technology
(if (cached-reference-trap? value)
(cached-reference-trap-value value)
value)))
-
+\f
(define (make-macro-reference-trap transformer)
(make-reference-trap 15 transformer))
(and (primitive-object-type? (ucode-type reference-trap) (getter))
(let ((index (object-datum (getter))))
(and (> index trap-max-immediate)
- (fix:= 15 (primitive-object-ref (getter) 0))))))
\ No newline at end of file
+ (fix:= 15 (primitive-object-ref (getter) 0))))))
+
+(define (make-macro-reference-trap-expression transformer)
+ (make-combination primitive-object-set-type
+ (list (ucode-type reference-trap)
+ (make-combination cons (list 15 transformer)))))
+
+(define (macro-reference-trap-expression? expression)
+ (and (combination? expression)
+ (eq? (combination-operator expression) primitive-object-set-type)
+ (let ((operands (combination-operands expression)))
+ (and (pair? operands)
+ (eqv? (car operands) (ucode-type reference-trap))
+ (pair? (cdr operands))
+ (let ((expression (cadr operands)))
+ (and (combination? expression)
+ (eq? (combination-operator expression) cons)
+ (let ((operands (combination-operands expression)))
+ (and (pair? operands)
+ (eqv? (car operands) 15)
+ (pair? (cdr operands))
+ (null? (cddr operands))))))
+ (null? (cddr operands))))))
+
+(define (macro-reference-trap-expression-transformer expression)
+ (cadr (combination-operands (cadr (combination-operands expression)))))
\ No newline at end of file