summaryrefslogtreecommitdiff
path: root/simulation.lisp
diff options
context:
space:
mode:
authormRnea <akannemre@gmail.com>2024-08-18 17:10:32 +0300
committermRnea <akannemre@gmail.com>2024-08-18 17:10:32 +0300
commit86dbe8eb0abe2a2d5f0f687ff190c4e9f547d126 (patch)
tree734e1ef7a4a2fe480a6c6b19e8b75b6f25e8fe1c /simulation.lisp
parent30e2c565fbe48747760b3d32515b756b5bb2a2d7 (diff)
added a few operations and expanded standard library
Diffstat (limited to 'simulation.lisp')
-rw-r--r--simulation.lisp7
1 files changed, 7 insertions, 0 deletions
diff --git a/simulation.lisp b/simulation.lisp
index b0e317c..f35abc6 100644
--- a/simulation.lisp
+++ b/simulation.lisp
@@ -20,10 +20,15 @@
;; (print op)
;; (print *stack*)
(case (car op)
+ (:divmod (let ((top (pop*)))
+ (multiple-value-bind (div mod) (truncate (pop*) top)
+ (push* div)
+ (push* mod))))
(:push-int (push* (cadr op)))
(:+ (push* (+ (pop*) (pop*))))
(:- (let ((top (pop*)))
(push* (- (pop*) top))))
+ (:* (push* (* (pop*) (pop*))))
(:dump (format t "~a~%" (pop*)))
(:= (push* (if (= (pop*) (pop*)) 1 0)))
(:eş (let ((top (pop*)))
@@ -36,6 +41,8 @@
(setf i (third op))))
(:< (let ((top (pop*)))
(push* (if (< (pop*) top) 1 0))))
+ (:> (let ((top (pop*)))
+ (push* (if (> (pop*) top) 1 0))))
(:iken (when (= 0 (pop*))
(setf i (cadr op))))
(:döngü nil)