* Rename syntax-transforms to syntax-low.
* Move expander-item to syntax-low.
* Don't load syntax-items early in cold load.
* Move compile-expr-item to syntax-items.
("syntax-declaration" (runtime syntax declaration))
("syntax-environment" (runtime syntax environment))
("syntax-items" (runtime syntax items))
+ ("syntax-low" (runtime syntax low))
("syntax-output" (runtime syntax output))
("syntax-rules" (runtime syntax syntax-rules))
- ("syntax-transforms" (runtime syntax transforms))
("sysclk" (runtime system-clock))
("sysmac" (runtime system-macros))
("system" (runtime system))
("record" . (RUNTIME RECORD))
("bundle" . (runtime bundle))))
(files2
- '(("syntax-items" . (RUNTIME SYNTAX ITEMS))
- ("syntax-transforms" . (RUNTIME SYNTAX TRANSFORMS))
+ '(("syntax-low" . (runtime syntax low))
("thread" . (RUNTIME THREAD))
("wind" . (RUNTIME STATE-SPACE))
("prop1d" . (RUNTIME 1D-PROPERTY))
(RUNTIME UNSYNTAXER)
(RUNTIME PRETTY-PRINTER)
(RUNTIME EXTENDED-SCODE-EVAL)
- (runtime syntax top-level)
+ (runtime syntax items)
(runtime syntax rename)
;; REP Loops
(RUNTIME INTERRUPT-HANDLER)
classify-forms-cdr
classify-forms-in-order-cddr
classify-forms-in-order-cdr
- compile-expr-item
- define-item-compiler
hist-caddr
hist-cadr
hist-car
classifier-item-impl
classifier-item?
combination-item
+ compile-expr-item
constant-item
decl-item
decl-item-text
decl-item?
+ define-item-compiler
defn-item
defn-item-id
defn-item-syntax?
defn-item-value
defn-item?
delay-item
- expander-item
- expander-item-expr
- expander-item-impl
- expander-item?
expr-item
expr-item-compiler
expr-item?
var-item-id
var-item?))
+(define-package (runtime syntax low)
+ (files "syntax-low")
+ (parent (runtime syntax))
+ (export ()
+ er-macro-transformer->expander
+ rsc-macro-transformer->expander
+ sc-macro-transformer->expander
+ syntactic-keyword->item)
+ (export (runtime syntax)
+ expander-item
+ expander-item-expr
+ expander-item-impl
+ expander-item?))
+
(define-package (runtime syntax environment)
(files "syntax-environment")
(parent (runtime syntax))
(export (runtime syntax)
map-decl-ids))
-(define-package (runtime syntax transforms)
- (files "syntax-transforms")
- (parent (runtime syntax))
- (export ()
- er-macro-transformer->expander
- rsc-macro-transformer->expander
- sc-macro-transformer->expander
- syntactic-keyword->item))
-
(define-package (runtime syntax mit)
(files "mit-syntax")
(parent (runtime syntax))
|#
-;;;; Syntax Items
+;;;; Syntax items and compiler
(declare (usual-integrations))
\f
classifier-item?
(impl classifier-item-impl))
-(define-record-type <expander-item>
- (expander-item impl expr)
- expander-item?
- (impl expander-item-impl)
- (expr expander-item-expr))
-
(define (keyword-item? object)
(or (classifier-item? object)
(expander-item? object)))
(expr-item output/unspecific))
(define (unassigned-item)
- (expr-item output/unassigned))
\ No newline at end of file
+ (expr-item output/unassigned))
+\f
+;;;; Compiler
+
+(define compile-expr-item)
+(add-boot-init!
+ (lambda ()
+ (set! compile-expr-item
+ (standard-predicate-dispatcher 'compile-expr-item 1))
+ (run-deferred-boot-actions 'define-item-compiler)))
+
+(define (define-item-compiler predicate compiler)
+ (defer-boot-action 'define-item-compiler
+ (lambda ()
+ (define-predicate-dispatch-handler compile-expr-item
+ (list predicate)
+ compiler))))
+
+(define-item-compiler var-item?
+ (lambda (item)
+ (output/variable (var-item-id item))))
+
+(define-item-compiler expr-item?
+ (lambda (item)
+ ((expr-item-compiler item))))
+
+(define-item-compiler seq-item?
+ (lambda (item)
+ (output/sequence (map compile-expr-item (seq-item-elements item)))))
+
+(define-item-compiler decl-item?
+ (lambda (item)
+ (output/declaration (decl-item-text item))))
+
+(define-item-compiler defn-item?
+ (lambda (item)
+ (if (defn-item? item)
+ (let ((name (defn-item-id item))
+ (value (compile-expr-item (defn-item-value item))))
+ (if (defn-item-syntax? item)
+ (output/syntax-definition name value)
+ (output/definition name value)))
+ (compile-expr-item item))))
+
+(define (illegal-expression-compiler description)
+ (let ((message (string description " may not be used as an expression:")))
+ (lambda (item)
+ (syntax-error message item))))
+
+(define-item-compiler reserved-name-item?
+ (illegal-expression-compiler "Reserved name"))
+
+(define-item-compiler keyword-item?
+ (illegal-expression-compiler "Syntactic keyword"))
\ No newline at end of file
|#
-;;;; MIT/GNU Scheme syntax
+;;;; Syntax -- cold-load support
;;; Procedures to convert transformers to internal form. Required
;;; during cold load, so must be loaded very early in the sequence.
use-senv))
expr))
+(define-record-type <expander-item>
+ (expander-item impl expr)
+ expander-item?
+ (impl expander-item-impl)
+ (expr expander-item-expr))
+
(define (->senv env)
(if (syntactic-environment? env)
env
(define (classify-forms-in-order-cddr form senv hist)
(classify-forms-in-order (cddr form) senv (hist-cddr hist)))
\f
-;;;; Compiler
-
-(define compile-expr-item)
-(add-boot-init!
- (lambda ()
- (set! compile-expr-item
- (standard-predicate-dispatcher 'compile-expr-item 1))
- (run-deferred-boot-actions 'define-item-compiler)))
-
-(define (define-item-compiler predicate compiler)
- (defer-boot-action 'define-item-compiler
- (lambda ()
- (define-predicate-dispatch-handler compile-expr-item
- (list predicate)
- compiler))))
-
-(define-item-compiler var-item?
- (lambda (item)
- (output/variable (var-item-id item))))
-
-(define-item-compiler expr-item?
- (lambda (item)
- ((expr-item-compiler item))))
-
-(define-item-compiler seq-item?
- (lambda (item)
- (output/sequence (map compile-expr-item (seq-item-elements item)))))
-
-(define-item-compiler decl-item?
- (lambda (item)
- (output/declaration (decl-item-text item))))
-
-(define-item-compiler defn-item?
- (lambda (item)
- (if (defn-item? item)
- (let ((name (defn-item-id item))
- (value (compile-expr-item (defn-item-value item))))
- (if (defn-item-syntax? item)
- (output/syntax-definition name value)
- (output/definition name value)))
- (compile-expr-item item))))
-
-(define (illegal-expression-compiler description)
- (let ((message (string description " may not be used as an expression:")))
- (lambda (item)
- (syntax-error message item))))
-
-(define-item-compiler reserved-name-item?
- (illegal-expression-compiler "Reserved name"))
-
-(define-item-compiler keyword-item?
- (illegal-expression-compiler "Syntactic keyword"))
-\f
;;;; Syntactic closures
(define (close-syntax form senv)