\f
;;;; Core primitives
-(define (compiler:lambda form senv hist)
+(define (classifier:lambda form senv hist)
(syntax-check '(_ mit-bvl + form) form)
(compile-lambda scode-lambda-name:unnamed
(cadr form)
form senv hist))
-(define (compiler:named-lambda form senv hist)
+(define (classifier:named-lambda form senv hist)
(syntax-check '(_ (identifier . mit-bvl) + form) form)
(compile-lambda (identifier->symbol (caadr form))
(cdadr form)
(map-mit-lambda-list (lambda (identifier)
(bind-variable identifier senv))
bvl)))
- (output/lambda name
- bvl
- (compile-body-item (classify-body-cddr form senv hist))))))
+ (lambda-item name
+ bvl
+ (lambda () (classify-body-cddr form senv hist))))))
(define (compile-body-item item)
(output/body (compile-body-items (item->list item))))
(else
(syntax-error "Variable required in this context:" (cadr form))))))
-(define (compiler:delay form senv hist)
+(define (classifier:delay form senv hist)
(syntax-check '(_ expression) form)
- (output/delay (compile-expr-item (classify-form-cadr form senv hist))))
+ (delay-item (lambda () (classify-form-cadr form senv hist))))
\f
;;;; Definitions
classifier:begin
classifier:declare
classifier:define-syntax
+ classifier:delay
classifier:er-macro-transformer
classifier:if
+ classifier:lambda
classifier:let-syntax
classifier:letrec-syntax
+ classifier:named-lambda
classifier:or
classifier:quote
classifier:quote-identifier
classifier:rsc-macro-transformer
classifier:sc-macro-transformer
classifier:set!
- classifier:the-environment
- compiler:delay
- compiler:lambda
- compiler:named-lambda)
+ classifier:the-environment)
(export (runtime mit-macros)
keyword:access
keyword:define
(add-boot-init!
(lambda ()
- (define (def name item)
- (environment-define-macro system-global-environment name item))
-
(define (define-classifier name classifier)
- (def name (classifier-item classifier)))
+ (environment-define-macro system-global-environment
+ name
+ (classifier-item classifier)))
(define-classifier 'begin classifier:begin)
(define-classifier 'declare classifier:declare)
(define-classifier 'sc-macro-transformer classifier:sc-macro-transformer)
(define-classifier 'set! classifier:set!)
(define-classifier 'the-environment classifier:the-environment)
-
- (define (define-compiler name compiler)
- (def name (compiler-item compiler)))
-
- (define-compiler 'delay compiler:delay)
- (define-compiler 'lambda compiler:lambda)
- (define-compiler 'named-lambda compiler:named-lambda)))
\ No newline at end of file
+ (define-classifier 'delay classifier:delay)
+ (define-classifier 'lambda classifier:lambda)
+ (define-classifier 'named-lambda classifier:named-lambda)))
\ No newline at end of file
(lambda ()
(output/constant datum))))
-(define (lambda-item name bvl body-item)
+(define (lambda-item name bvl classify-body)
(expr-item
(lambda ()
- (output/lambda name bvl (compile-expr-item body-item)))))
+ (output/lambda name bvl (compile-expr-item (classify-body))))))
(define (let-item names value-items body-item)
(expr-item
(compile-expr-item env-item)
(compile-expr-item rhs-item)))))
-(define (delay-item item)
+(define (delay-item classify)
(expr-item
(lambda ()
- (output/delay (compile-expr-item item)))))
+ (output/delay (compile-expr-item (classify))))))
(define (or-item items)
(expr-item