From: Chris Hanson Date: Mon, 12 Feb 2018 06:05:52 +0000 (-0800) Subject: Rename classify-body to classify-forms-in-order. X-Git-Tag: mit-scheme-pucked-x11-0.3.1~7^2~251 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=5936f6cff42a8693244a6016e89a522b41d38547;p=mit-scheme.git Rename classify-body to classify-forms-in-order. Also have it return a list of items rather than a seq-item. --- diff --git a/src/runtime/mit-syntax.scm b/src/runtime/mit-syntax.scm index 1f23fa4ac..d0ac27379 100644 --- a/src/runtime/mit-syntax.scm +++ b/src/runtime/mit-syntax.scm @@ -80,14 +80,13 @@ USA. 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) @@ -168,20 +167,21 @@ USA. (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) @@ -192,9 +192,10 @@ USA. (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)) @@ -215,7 +216,10 @@ USA. (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 @@ -223,7 +227,7 @@ USA. ;; 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))) ;;;; MIT-specific syntax diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 52620f412..96870ccc2 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -4416,15 +4416,14 @@ USA. biselector:cdr biselector:cr classifier->keyword - classify-body - classify-body-cddr - classify-body-cdr classify-form classify-form-cadddr classify-form-caddr classify-form-cadr classify-form-car - classify-forms + classify-forms-cdr + classify-forms-in-order-cddr + classify-forms-in-order-cdr compile-body-items compile-expr-item define-item-compiler diff --git a/src/runtime/syntax.scm b/src/runtime/syntax.scm index 8b386b0e0..85d048824 100644 --- a/src/runtime/syntax.scm +++ b/src/runtime/syntax.scm @@ -106,9 +106,7 @@ USA. (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)))) @@ -124,29 +122,29 @@ USA. (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))) ;;;; Compiler