Rename classify-body to classify-forms-in-order.
authorChris Hanson <org/chris-hanson/cph>
Mon, 12 Feb 2018 06:05:52 +0000 (22:05 -0800)
committerChris Hanson <org/chris-hanson/cph>
Mon, 12 Feb 2018 06:05:52 +0000 (22:05 -0800)
Also have it return a list of items rather than a seq-item.

src/runtime/mit-syntax.scm
src/runtime/runtime.pkg
src/runtime/syntax.scm

index 1f23fa4ac9e36786b1c248e7114d8927bb61eef4..d0ac2737954d69fbba82fd1628991311083fb080 100644 (file)
@@ -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)))
 \f
 ;;;; MIT-specific syntax
 
index 52620f412c6f382fd36132834d362ecefed258bf..96870ccc29840470a16578399fc7ca39044702d2 100644 (file)
@@ -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
index 8b386b0e07dc5ce3a18d5bd2a795796ddf74d1cf..85d048824d1eb67a15de87950c3acd4e54ca89af 100644 (file)
@@ -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)))
 \f
 ;;;; Compiler