(transform-instance-variables
(class-instance-transforms
(name->class (identifier->symbol class-name)))
- (compile-expr self environment)
+ (compile-expr-item (classify-form self environment))
free-names
- (compile-expr
- `(,(close-syntax 'begin
- (runtime-environment->syntactic
- system-global-environment))
- ,@body)
- environment)))))))
+ (compile-expr-item
+ (classify-form
+ `(,(close-syntax 'begin
+ (runtime-environment->syntactic
+ system-global-environment))
+ ,@body)
+ environment))))))))
(define-syntax ==>
(syntax-rules ()
(let ((env (->environment '(runtime syntax))))
(provide-rename env 'make-compiler-item 'compiler-item)
- (provide-rename env 'compile/expression 'compile-expr))
+ (provide-rename env 'compile-item/expression 'compile-expr-item)
+ (if (unbound? env 'classify-form)
+ (eval '(define (classify-form form env)
+ (classify/form form env env))
+ env)))
(let ((env (->environment '(package))))
(if (eval '(not (link-description? '#(name1 (package name) name2 #f)))
(define (transformer-keyword procedure-name transformer->expander)
(lambda (form senv)
(syntax-check '(KEYWORD EXPRESSION) form)
- (let ((transformer (compile-expr (cadr form) senv)))
+ (let ((transformer (compile-expr-item (classify-form (cadr form) senv))))
(transformer->expander (transformer-eval transformer senv)
senv
(expr-item
(define (compiler:if form environment)
(syntax-check '(KEYWORD EXPRESSION EXPRESSION ? EXPRESSION) form)
(output/conditional
- (compile-expr (cadr form) environment)
- (compile-expr (caddr form) environment)
+ (compile-expr-item (classify-form (cadr form) environment))
+ (compile-expr-item (classify-form (caddr form) environment))
(if (pair? (cdddr form))
- (compile-expr (cadddr form) environment)
+ (compile-expr-item (classify-form (cadddr form) environment))
(output/unspecific))))
(define (compiler:quote form environment)
(classify/location (cadr form) environment)
(let ((value
(if (pair? (cddr form))
- (compile-expr (caddr form) environment)
+ (compile-expr-item (classify-form (caddr form) environment))
(output/unassigned))))
(if environment-item
(output/access-assignment
(define (compiler:delay form environment)
(syntax-check '(KEYWORD EXPRESSION) form)
- (output/delay (compile-expr (cadr form) environment)))
+ (output/delay (compile-expr-item (classify-form (cadr form) environment))))
\f
;;;; Definitions
(syntax-check '(KEYWORD * EXPRESSION) form)
(if (pair? (cdr form))
(let loop ((expressions (cdr form)))
- (let ((compiled (compile-expr (car expressions) environment)))
+ (let ((compiled (compile-expr-item (classify-form (car expressions) environment))))
(if (pair? (cdr expressions))
(output/disjunction compiled (loop (cdr expressions)))
compiled)))
(compile-top-level-body (classify-body forms senv))
(output/sequence
(map (lambda (expr)
- (compile-expr expr senv))
+ (compile-expr-item (classify-form expr senv)))
forms)))))))
-
-(define (compile-expr expr senv)
- (compile-expr-item (classify-form expr senv)))
\f
;;;; Classifier