From 72201d5c8d4e3dec75cdab6e954ebda974a27f45 Mon Sep 17 00:00:00 2001 From: mRnea Date: Wed, 14 Aug 2024 00:34:57 +0300 Subject: =?UTF-8?q?minor=20modification=20to=20sim=C3=BClation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simulation.lisp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'simulation.lisp') 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))) -- cgit v1.2.3