Implement 5.23

This commit is contained in:
2021-04-04 11:46:15 -04:00
parent 6cfaff4c07
commit d0d650ad62
3 changed files with 82 additions and 5 deletions

View File

@@ -68,6 +68,11 @@
(list 'extend-environment extend-environment)
(list 'lookup-variable-value lookup-variable-value)
(list 'set-variable-value! set-variable-value!)
;;5.23
(list 'cond? cond?)
(list 'cond->if cond->if)
(list 'let? let?)
(list 'let->combination let->combination)
(list 'define-variable! define-variable!)
(list 'primitive-procedure? primitive-procedure?)
(list 'apply-primitive-procedure apply-primitive-procedure)
@@ -119,6 +124,10 @@ eval-dispatch
(branch (label ev-definition))
(test (op if?) (reg exp))
(branch (label ev-if))
(test (op cond?) (reg exp))
(branch (label ev-cond))
(test (op let?) (reg exp))
(branch (label ev-let))
(test (op lambda?) (reg exp))
(branch (label ev-lambda))
(test (op begin?) (reg exp))
@@ -228,8 +237,16 @@ ev-sequence-last-exp
(restore continue)
(goto (label eval-dispatch))
;;;SECTION 5.4.3
;;; ex-5.23
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))
;;;SECTION 5.4.3
ev-if
(save exp)
(save env)