+Shell, +A LOT
[lineal.git] / src / shell / main.lisp
blob1c75f29e2c189ba1d8196ad2ae9aea8ad6f0f6af
2 (defpackage :lineal.shell
3 (:use :cl :lineal :lineal.overload))
4 (in-package :lineal.shell)
6 (defun greeting (infixp)
7 (format t "~&Welcome to Lineal, ")
8 (format t "using ~:[prefix~;infix~] notation." infixp)
9 (format t "~%To leave, use exit or quit.")
10 (format t "~%> "))
12 ;;; Main loop for shell.
13 (defun shell-repl ()
14 (let ((infixp (symbol-value
15 'lineal.devvars::use-infix-p)))
16 (greeting infixp)
17 (handler-case
18 (do ((str (read-line) (read-line)))
19 ((or (string= "quit" str)
20 (string= "exit" str)))
21 (over-format
22 (process-input-from-string
23 str infixp)
24 *standard-output*)
25 (format t "~&> "))
26 (end-of-file (condit)
27 (declare (ignore condit))))))