From 86dbe8eb0abe2a2d5f0f687ff190c4e9f547d126 Mon Sep 17 00:00:00 2001 From: mRnea Date: Sun, 18 Aug 2024 17:10:32 +0300 Subject: added a few operations and expanded standard library --- simulation.lisp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'simulation.lisp') 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) -- cgit v1.2.3