summaryrefslogtreecommitdiff
path: root/main.lisp
diff options
context:
space:
mode:
authormRnea <[email protected]>2024-07-23 16:15:31 +0300
committermRnea <[email protected]>2024-07-23 16:15:31 +0300
commit1732b9a1a137d8a7e6476e8cdfa254c01638bce3 (patch)
tree9b929ede4e356a1060f0c1cc1b154dbac73487d6 /main.lisp
parent4979a97e022d222f45209e09a8c7197820870097 (diff)
added repl
Diffstat (limited to 'main.lisp')
-rw-r--r--main.lisp13
1 files changed, 11 insertions, 2 deletions
diff --git a/main.lisp b/main.lisp
index 716c76b..578fa01 100644
--- a/main.lisp
+++ b/main.lisp
@@ -14,7 +14,7 @@
;; (generate-program program :compile t)))
(compile-program (second args)))
((string= flag "-i")
- (format t "Interpret program WIP~%"))
+ (interpret-program (make-program (second args))))
(t (format t "~a is not a valid flag~%" flag))))))
;; (defun make-exe ()
@@ -22,7 +22,7 @@
;; :toplevel #'main
;; :executable t))
-(defparameter *example-path* "./test/prog.lorth")
+(defparameter *example-path* (from-root "test/prog.lorth"))
(defun example-lex ()
(lex-file *example-path* t))
@@ -34,6 +34,15 @@
(generate-program (make-program *example-path*) :path "test/output.asm"
:compile t))
+(defun example-interpret ()
+ (interpret-program (make-program *example-path*)))
+
(defun example-run ()
(example-compile)
(run '("test/output")))
+
+(defun start-forth-repl ()
+ (iter (for line = (progn (format t "~&> ") (read-line)))
+ (when (string= line "bye")
+ (finish))
+ (interpret-program (parse-tokens (lex-line line 0)))))