diff options
Diffstat (limited to 'cbasic.lisp')
-rw-r--r-- | cbasic.lisp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/cbasic.lisp b/cbasic.lisp index a999223..0f2d63c 100644 --- a/cbasic.lisp +++ b/cbasic.lisp @@ -1,11 +1,31 @@ ;;; I'm trying to write an interpreter for a BBC BASIC subset ;;; initially following the design of ;;; https://caml.inria.fr/pub/docs/oreilly-book/html/book-ora058.html -;;; and later I can Frankenstein it with -;;; https://github.com/Henry/BuddKaminInterpreters +;;; then later I can optimise following +;;; https://github.com/Henry/BuddKaminInterpreters and *maybe* +;;; https://oleksandrmanzyuk.wordpress.com/2014/06/18/from-object-algebras-to-finally-tagless-interpreters-2/ +;;; +;;; A BASIC interpreter already exists at +;;; https://gitlab.com/com-informatimago/com-informatimago/-/tree/master/small-cl-pgms/basic +;;; but it is idiomatic CL, +;;; whereas I'm experimenting with a subset like ISLisp. +;; Because this is the main package, +;; 1) ql:quickload QuickLisp dependencies and +(ql:quickload "closer-mop") +;; 2) load local dependencies here. (load "cutil.lisp") +(load "cabs-syn.lisp") +(load "clex.lisp") (load "cparse.lisp") +;; +;; Use require & defpackage in each package from then on. +;; NB: must have no circular dependencies, and topologically sort the loads. +;; +;; TODO: is it easier to just get started with ASDF? +;; ( https://lisp-lang.org/learn/writing-libraries ) +;; Although this is beyond OpenLisp. + (require "cparse") (defpackage #:cbasic (:use #:common-lisp) @@ -17,7 +37,7 @@ ;;; but try to keep the number of top-level functions the same as in OCaml. (defun one-command (st) - (format (standard-output) "> ") + (format *standard-output* "> ") (with-handler #'error-handler (let ((l (parse (read-line)))) (case (car l) @@ -32,8 +52,8 @@ (defun main () (catch 'end (lambda () - (format (standard-output) "BASIC version 0.1~%~%") + (format *standard-output* "BASIC version 0.1~%~%") (for ((st (create (class <state>)))) (catch 'error (one-command st))))) - (format (standard-output) "See you later...~%")) + (format *standard-output* "See you later...~%")) (provide "cbasic") |