X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/4aae7df085804dfce0e0f0c5fe82a9568fccfc1a..180bfa7ca8efeb1297a0bc3f0ff55b02b4e40f9b:/src/frontend.lisp diff --git a/src/frontend.lisp b/src/frontend.lisp index 8138a5a..26afbfc 100644 --- a/src/frontend.lisp +++ b/src/frontend.lisp @@ -23,7 +23,17 @@ ;;; along with SOD; if not, write to the Free Software Foundation, ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -(cl:in-package #:sod) +(cl:defpackage #:sod-frontend + (:use #:common-lisp #:optparse #:sod #:sod-parser) + (:shadowing-import-from #:optparse "INT")) + +(cl:in-package #:sod-frontend) + +;;;-------------------------------------------------------------------------- +;;; Preparation for dumping. + +(make-builtin-module) +(exercise) ;;;-------------------------------------------------------------------------- ;;; The main program. @@ -77,11 +87,11 @@ ;; Option definitions. (define-program :help "Process SOD input files to produce (e.g.) C output." - :version "0.1.0" + :version *sod-version* :usage "SOURCES..." :options (options (help-options :short-version #\V) - "Crazy options" + "Translator options" (#\I "include" (:arg "DIR") ("Search DIR for module imports.") (list *module-dirs* 'string)) @@ -106,9 +116,6 @@ (or builtinsp args)) (die-usage)) - ;; Prepare the builtins. - (make-builtin-module) - ;; Do the main parsing job. (multiple-value-bind (hunoz nerror nwarn) (count-and-report-errors () @@ -165,12 +172,10 @@ ;; If we're writing the builtin module then now seems like a ;; good time to do that. (when builtinsp - (clear-the-decks) (hack-module *builtin-module*)) ;; Parse and write out the remaining modules. (dolist (arg args) - (clear-the-decks) (hack-module (read-module arg)))))) ;; Report on how well everything worked.