Analyzing Evaluator

left top right

(define (eval exp env)
  ;; First call ANALYZE to build a bag of code
  ;; from the original EXPression, then call the
  ;; bag of code with the ENVironment.
  ((analyze exp) env))

(define (analyze exp)
  ;; Convert the EXPression into a bag of code
  (cond ((self-evaluating? exp) 
         (analyze-self-evaluating exp))
        ...
        ((variable? exp) (analyze-variable exp))
        ((if? exp) (analyze-if exp))
        ((lambda? exp) (analyze-lambda exp))
        ((application? exp) (analyze-application exp))
        (else ...)))

Jim Miller W3C