bvl)))
(lambda-item name
bvl
- (lambda () (classify-body-cddr form senv hist))))))
-
-(define (compile-body-item item)
- (output/body (compile-body-items (item->list item))))
+ (lambda ()
+ (body-item
+ (classify-forms-in-order-cddr form senv hist)))))))
(define (classifier:begin form senv hist)
(syntax-check '(_ * form) form)
- (classify-body-cdr form senv hist))
+ (seq-item (classify-forms-in-order-cdr form senv hist)))
(define (classifier:if form senv hist)
(syntax-check '(_ expression expression ? expression) form)
(define keyword:let
(classifier->keyword
(lambda (form senv hist)
- (let* ((binding-senv (make-internal-senv senv))
+ (let* ((body-senv (make-internal-senv senv))
(bindings
(map (lambda (binding hist)
(variable-binder cons
- binding-senv
+ body-senv
(car binding)
(classify-form-cadr binding senv hist)))
(cadr form)
(subform-hists (cadr form) (hist-cadr hist)))))
(let-item (map car bindings)
(map cdr bindings)
- (classify-body-cddr form
- (make-internal-senv binding-senv)
- hist))))))
+ (body-item
+ (classify-forms-in-order-cddr form
+ (make-internal-senv body-senv)
+ hist)))))))
(define (classifier:let-syntax form senv hist)
(syntax-check '(_ (* (identifier expression)) + form) form)
(classify-form-cadr binding senv hist)))
(cadr form)
(subform-hists (cadr form) (hist-cadr hist)))
- (classify-body-cddr form
- (make-internal-senv binding-senv)
- hist)))
+ (seq-item
+ (classify-forms-in-order-cddr form
+ (make-internal-senv binding-senv)
+ hist))))
(define keyword:let-syntax
(classifier->keyword classifier:let-syntax))
(classify-form-cadr binding binding-senv hist))
bindings
(subform-hists bindings (hist-cadr hist)))))
- (classify-body-cddr form (make-internal-senv binding-senv) hist)))
+ (seq-item
+ (classify-forms-in-order-cddr form
+ (make-internal-senv binding-senv)
+ hist))))
;; TODO: this is a classifier rather than a macro because it uses the
;; special OUTPUT/DISJUNCTION. Unfortunately something downstream in
;; hack.
(define (classifier:or form senv hist)
(syntax-check '(_ * expression) form)
- (or-item (classify-forms (cdr form) senv (hist-cdr hist))))
+ (or-item (classify-forms-cdr form senv hist)))
\f
;;;; MIT-specific syntax
(if (not (list? (cdr form)))
(syntax-error "Combination must be a proper list:" form))
(combination-item item
- (classify-forms (cdr form)
- senv
- (hist-cdr hist)))))))
+ (classify-forms-cdr form senv hist))))))
(else
(constant-item form))))
(define (classify-form-cadddr form senv hist)
(classify-form (cadddr form) senv (hist-cadddr hist)))
+(define (reclassify form env hist)
+ (classify-form form env (hist-reduce form hist)))
+
(define (classify-forms forms senv hist)
(map (lambda (expr hist)
(classify-form expr senv hist))
forms
(subform-hists forms hist)))
-(define (reclassify form env hist)
- (classify-form form env (hist-reduce form hist)))
+(define (classify-forms-cdr form senv hist)
+ (classify-forms (cdr form) senv (hist-cdr hist)))
-(define (classify-body forms senv hist)
- ;; Syntactic definitions affect all forms that appear after them, so classify
- ;; FORMS in order.
- (seq-item
- (map-in-order (lambda (form hist)
- (classify-form form senv hist))
- forms
- (subform-hists forms hist))))
+(define (classify-forms-in-order forms senv hist)
+ (map-in-order (lambda (form hist)
+ (classify-form form senv hist))
+ forms
+ (subform-hists forms hist)))
-(define (classify-body-cdr form senv hist)
- (classify-body (cdr form) senv (hist-cdr hist)))
+(define (classify-forms-in-order-cdr form senv hist)
+ (classify-forms-in-order (cdr form) senv (hist-cdr hist)))
-(define (classify-body-cddr form senv hist)
- (classify-body (cddr form) senv (hist-cddr hist)))
+(define (classify-forms-in-order-cddr form senv hist)
+ (classify-forms-in-order (cddr form) senv (hist-cddr hist)))
\f
;;;; Compiler