SICP metacircular interpreter question
1
Name:
Anonymous
2011-09-27 7:59
How does it handle sequences in input? If it's in a define or lambda or begin or whatever then it follows those respective paths in the eval branch, all of which lead to eval-sequence. But if it's just
(define a 1) (define b 2)
how's it interpret that?
5
Name:
Anonymous
2011-09-27 8:35
Then goes on to (define b 2) if (define a 1) completed successfully
That's what I'm wondering about. For reference, here's the relevant code.
(define (eval exp env)
((analyze exp) env))
(define (analyze exp)
(cond ((self-evaluating? exp)
(analyze-self-evaluating exp))
((quoted? exp) (analyze-quoted exp))
((variable? exp) (analyze-variable exp))
((assignment? exp) (analyze-assignment exp))
((definition? exp) (analyze-definition exp))
((if? exp) (analyze-if exp))
((lambda? exp) (analyze-lambda exp))
((begin? exp) (analyze-sequence (begin-actions exp)))
((cond? exp) (analyze (cond->if exp)))
((application? exp) (analyze-application exp))
(else
(error "Unknown expression type -- ANALYZE" exp))))
Newer Posts