From 555d530c6ac18f49f83eaee1ea15f770af952a02 Mon Sep 17 00:00:00 2001 From: mariari Date: Thu, 13 Jul 2023 01:19:17 +0800 Subject: [PATCH 1/3] Add a version command This has the breaking change that -p is now the vampir flag --- src/entry/entry.lisp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/entry/entry.lisp b/src/entry/entry.lisp index ca2cf42ee..78e2ae949 100644 --- a/src/entry/entry.lisp +++ b/src/entry/entry.lisp @@ -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"))) @@ -21,11 +23,13 @@ #'argument-handlers :name "geb")) -(defun argument-handlers (&key help stlc output input entry-point vampir) +(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)))) (t (load input) (compile-down :vampir vampir From 67d6d31ca1d9281bfb4b454d1d8d5d3e54ab14ae Mon Sep 17 00:00:00 2001 From: mariari Date: Thu, 13 Jul 2023 01:24:17 +0800 Subject: [PATCH 2/3] Update the entry docs with the breaking change --- src/entry/package.lisp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/entry/package.lisp b/src/entry/package.lisp index 80f3edf6a..bee2af8c5 100644 --- a/src/entry/package.lisp +++ b/src/entry/package.lisp @@ -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 From 3cb87560aedaaf422bf53921d55267d77bc61c4a Mon Sep 17 00:00:00 2001 From: mariari Date: Thu, 13 Jul 2023 01:30:05 +0800 Subject: [PATCH 3/3] Fixup calling the binary with no input commands Before it would error on input type of input, now it asks to give a -i or a -h --- src/entry/entry.lisp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/entry/entry.lisp b/src/entry/entry.lisp index ca2cf42ee..274cd8aa9 100644 --- a/src/entry/entry.lisp +++ b/src/entry/entry.lisp @@ -21,11 +21,16 @@ #'argument-handlers :name "geb")) +(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) (flet ((run (stream) (cond (help (command-line-arguments:show-option-help +command-line-spec+ :sort-names t)) + ((null input) + (format stream *no-input-text*)) (t (load input) (compile-down :vampir vampir