Implement 5.49

This commit is contained in:
2021-05-01 18:30:24 -04:00
parent 363f49d434
commit 2265a4afa5
3 changed files with 38 additions and 8 deletions

View File

@@ -61,6 +61,7 @@
(define (compile-and-run? expression)
(tagged-list? expression 'compile-and-run))
(define (compile-and-run expression)
(display expression) (newline)
(let ((instructions
(assemble (statements
(compile (cadr expression) 'val 'return))
@@ -160,9 +161,10 @@ read-eval-print-loop
(perform (op initialize-stack))
(perform
(op prompt-for-input) (const ";;; EC-Eval input:"))
(assign exp (op read))
(assign env (op get-global-environment))
(assign continue (label print-result))
(assign exp (op read))
; (assign exp (op list) (const compile-and-run) (reg exp)) ;; read-compile-execute - ex-5.49
(goto (label eval-dispatch))
print-result
;;**following instruction optional -- if use it, need monitored stack