Exercise 5.23. Extend the evaluator to handle derived expressions such as cond, let, and so on (section 4.1.2). You may cheat and assume that the syntax transformers such as cond->if are available as machine operations.
我们有了 cond->if 和 let-combination ,就可以直接添加到 dispatch 里面
首先在 eval-dispatch 里面增加判断
;; add cond
(test (op cond?) (reg exp))
(branch (label ev-cond))
;; add let
(test (op let?) (reg exp))
(branch (label ev-let))
然后只需要调用相应的 machine operation 就可以。
ev-cond
(assign exp (op cond->if) (reg exp))
(goto (label eval-dispatch))
ev-let
(assign exp (op let->combination) (reg exp))
(goto (label eval-dispatch))