diff options
author | Darren Bane <darren.bane@emdalo.com> | 2020-06-01 21:21:10 +0100 |
---|---|---|
committer | Darren Bane <darren.bane@emdalo.com> | 2020-06-01 21:21:10 +0100 |
commit | f0467d992324a56ee5fdf8c94ee2608db0a61ac3 (patch) | |
tree | ac1223a4fe439b362809275b5af1034fb0770c36 /comal.lsp | |
parent | 98097b4c73f274f95bf1360a2b2f99b555917cd5 (diff) | |
download | lsp-f0467d992324a56ee5fdf8c94ee2608db0a61ac3.tar.gz |
Making changes
Diffstat (limited to 'comal.lsp')
-rw-r--r-- | comal.lsp | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/comal.lsp b/comal.lsp index 12f8d0a..571d4a6 100644 --- a/comal.lsp +++ b/comal.lsp @@ -1,22 +1,14 @@ -#!/Users/dbane/openlisp-10.9.0/uxlisp -shell -(defun error-handler (condition) - (cond - ((eq (class-of condition) (class <lexer-error>)) ))) +#!/home/snuc/openlisp-10.9.0/uxlisp -shell -(defun one-command-h (st) - (let ((l parse (read-line))) - (case (car l) - ((line) (insert (cadr c))) - ((p-end) (throw 'end nil)))) ; ok? No condition stuff? +;;; Not sure yet if it's a good idea or not, +;;; but I'm trying to keep the number of top-level functions the same as in OCaml. (defun one-command (st) (with-handler #'error-handler - (one-command-h st))) - -;; Should this be in (for or something since it's called -loop? -(defun main-loop (st) - (format (standard-output) "> ") - (catch 'error (one-command st))) + (let ((l parse (read-line))) + (case (car l) + ((line) (insert (cadr c))) + ((p-end) (throw 'end nil)))))) ; throw and conditions are orthogonal (defclass <state> () ((prog :accessor prog) (env :accessor env))) @@ -24,14 +16,11 @@ (setf (prog self) nil) (setf (env self) nil)) -(defun main-h () - (format (standard-output) "OpenCOMAL version 0.4~%~%") - (for ((st (create (class <state>)))) - (main-loop st))) - -(defun bye () - (format (standard-output) "See you later...~%")) - (defun main () - (catch 'end (main-h)) - (bye)) + (catch 'end (lambda () + (format (standard-output) "OpenCOMAL version 0.4~%~%") + (for ((st (create (class <state>)))) + (()) + (format (standard-output) "> ") + (catch 'error (one-command st))))) + (format (standard-output) "See you later...~%")) |