about summary refs log blame commit diff stats
path: root/basic.lsp
blob: 571d4a67e9ba073258256b7cdcdc1b47b6859ec9 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
                                          
 

                                                                                  
 

                                



                                                                                     





                                                             
 
              






                                                                        
#!/home/snuc/openlisp-10.9.0/uxlisp -shell

;;; 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
      (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)))
(defmethod initialize-object :after ((self <state>) initargs)
   (setf (prog self) nil)
   (setf (env self) nil))

(defun main ()
   (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...~%"))