Skip to content

Commit

Permalink
Merge remote-tracking branches 'origin/mariari/version' and 'origin/m…
Browse files Browse the repository at this point in the history
…ariari/binary-fixup-no-argument-behavior'
  • Loading branch information
mariari committed Jul 12, 2023
3 parents 412f905 + 67d6d31 + 3cb8756 commit 6039a36
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
13 changes: 11 additions & 2 deletions src/entry/entry.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
:type boolean :optional t :documentation "Use the simply typed lambda calculus frontend")
(("output" #\o)
:type string :optional t :documentation "Save the output to a file rather than printing")
(("vampir" #\v)
(("version" #\v)
:type boolean :optional t :documentation "Prints the current version of the compiler")
(("vampir" #\p)
:type string :optional t :documentation "Return a vamp-ir expression")
(("help" #\h #\?)
:type boolean :optional t :documentation "The current help message")))
Expand All @@ -21,11 +23,18 @@
#'argument-handlers
:name "geb"))

(defun argument-handlers (&key help stlc output input entry-point vampir)
(defparameter *no-input-text*
"Please provide an input file with -p or see the help command with -h")

(defun argument-handlers (&key help stlc output input entry-point vampir version)
(flet ((run (stream)
(cond (help
(command-line-arguments:show-option-help +command-line-spec+
:sort-names t))
(version
(format stream (asdf:system-version (asdf:find-system :geb))))
((null input)
(format stream *no-input-text*))
(t
(load input)
(compile-down :vampir vampir
Expand Down
14 changes: 8 additions & 6 deletions src/entry/package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,28 @@ to use
An example use of this binary is as follows
```bash
mariari@Gensokyo % ./geb.image -i \"foo.lisp\" -e \"geb.lambda.main::*entry*\" -l -v -o \"foo.pir\"
mariari@Gensokyo % ./geb.image -i \"foo.lisp\" -e \"geb.lambda.main::*entry*\" -l -p -o \"foo.pir\"
mariari@Gensokyo % cat foo.pir
def entry x1 = {
(x1)
};%
mariari@Gensokyo % ./geb.image -i \"foo.lisp\" -e \"geb.lambda.main::*entry*\" -l -v
mariari@Gensokyo % ./geb.image -i \"foo.lisp\" -e \"geb.lambda.main::*entry*\" -l -p
def *entry* x {
0
}
./geb.image -h
mariari@Gensokyo % ./geb.image -h
-i --input string Input geb file location
-e --entry-point string The function to run, should be fully qualified I.E.
geb::my-main
-e --entry-point string The function to run, should be fully qualified I.E. geb::my-main
-l --stlc boolean Use the simply typed lambda calculus frontend
-o --output string Save the output to a file rather than printing
-v --vampir string Return a vamp-ir expression
-v --version boolean Prints the current version of the compiler
-p --vampir string Return a vamp-ir expression
-h -? --help boolean The current help message
mariari@Gensokyo % ./geb.image -v
0.3.2
```
starting from a file *foo.lisp* that has
Expand Down

0 comments on commit 6039a36

Please sign in to comment.