summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormRnea <akannemre@gmail.com>2024-08-14 00:34:57 +0300
committermRnea <akannemre@gmail.com>2024-08-14 00:34:57 +0300
commit72201d5c8d4e3dec75cdab6e954ebda974a27f45 (patch)
treece77c04b769d1ec880fec743a81eea2310454c63
parent7c5f53ce083bd8030a3eb9bd85d420ea40f2f63c (diff)
minor modification to simülation
-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)))