minor modification to simülation
This commit is contained in:
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user