~kingcons/rascal

a37617b1772b0f432571d69878f1567ff4d8e39b — Brit Butler 1 year, 1 month ago 76d68e0
Wire up the basic shell command with clingon.
5 files changed, 60 insertions(+), 8 deletions(-)

M rascal.asd
A src/debug.lisp
M src/docs.lisp
M src/rascal.lisp
A src/shell.lisp
M rascal.asd => rascal.asd +11 -4
@@ 6,17 6,24 @@
  :version "0.1"
  :author "Brit Butler"
  :license "MIT"
  :description "Describe rascal here"
  :description "Readable and Simple Compiler for a Lisp"
  :source-control (:git "https://git.sr.ht/~kingcons/rascal")
  :depends-on (#:alexandria #:serapeum #:mgl-pax)
  :depends-on (#:alexandria
               #:serapeum
               #:mgl-pax
               #:clingon
               #:iterate
               #:trivia)
  :build-operation "program-op"
  :build-pathname "bin/rascal"
  :entry-point "rascal:main"
  :components ((:module "src"
                :serial t
                :components
                ((:file "rascal")
                 (:file "docs"))))
                ((:file "debug")
                 (:file "shell")
                 (:file "docs")
                 (:file "rascal"))))
  :in-order-to ((test-op (test-op rascal/test))))

#+sb-core-compression

A src/debug.lisp => src/debug.lisp +10 -0
@@ 0,0 1,10 @@
(mgl-pax:define-package :rascal.debug
  (:use :cl :alexandria :mgl-pax))

(in-package :rascal.debug)

(defsection @debug (:title "Debugging Tools")
  "Debugging a compiler is tricky work. Ways to inspect and graph the various
 states of the AST, IR, and other internal structures will prove very useful
 for both compiler developers and end users attempting to gain better intuition
 for the way their code is understood and translated.")

M src/docs.lisp => src/docs.lisp +2 -1
@@ 7,7 7,8 @@

(defsection @rascal (:title "rascal")
  (@links section)
  (@overview section))
  (@overview section)
  (rascal.shell:@command section))

(defsection @links (:title "Links")
  "[repo]: https://git.sr.ht/~kingcons/rascal

M src/rascal.lisp => src/rascal.lisp +3 -3
@@ 1,5 1,5 @@
(mgl-pax:define-package :rascal
  (:use :cl :alexandria :mgl-pax)
(defpackage :rascal
  (:use :cl)
  (:export #:main))

(in-package :rascal)


@@ 7,4 7,4 @@
;;; Lisp isn't a language, it's a building material.

(defun main ()
  (format t "Hello, world!~%"))
  (clingon:run (rascal.shell:command)))

A src/shell.lisp => src/shell.lisp +34 -0
@@ 0,0 1,34 @@
(mgl-pax:define-package :rascal.shell
  (:use :cl :alexandria :mgl-pax)
  (:import-from :clingon
                #:getopt
                #:make-option
                #:make-command
                #:print-usage))

(in-package :rascal.shell)

(defsection @command (:title "The rascal CLI")
  "[clingon]: https://github.com/dnaeon/clingon

Here we document the usage and options the rascal shell command supports.
Rascal is powered under the hood by [clingon][clingon]."
  (command function))

(defun options ()
  "Generates the list of options for the `rascal` command."
  (list))

(defun handler (command)
  "A handler that ignores the command options and prints usage."
  (print-usage command t))

(defun command ()
  "The entry point for the `rascal` command."
  (make-command :name "rascal"
                :description "Radically Simple Compiler for a Lisp"
                :version (asdf:system-version (asdf:find-system :rascal))
                :authors '("Brit Butler")
                :license "MIT"
                :options (options)
                :handler #'handler))