summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--simulation.lisp7
1 files changed, 6 insertions, 1 deletions
diff --git a/simulation.lisp b/simulation.lisp
index e10d721..2699dc9 100644
--- a/simulation.lisp
+++ b/simulation.lisp
@@ -22,6 +22,8 @@
(case (car op)
(:push-int (push* (cadr op)))
(:+ (push* (+ (pop*) (pop*))))
+ (:- (let ((top (pop*)))
+ (push* (- (pop*) top))))
(:dump (format t "~a~%" (pop*)))
(:= (push* (if (= (pop*) (pop*)) 1 0)))
(:eş (let ((top (pop*)))
@@ -36,6 +38,7 @@
(push* (if (< (pop*) top) 1 0))))
(:iken (when (= 0 (pop*))
(setf i (cadr op))))
+ (:döngü nil)
(:bel (push* 0))
(:oku (push* (aref *bel* (pop*))))
(:yaz (let ((top (pop*)))
@@ -75,7 +78,9 @@
(top2 (pop*)))
(push* top2)
(push* top1)
- (push* top2)))))))
+ (push* top2)))
+ (otherwise (format t "Unknown keyword: ~a~%" (car op))
+ (finish))))))
(defun str->prog (str)
(parse-tokens (lex-string str)))