Coverage report: /home/runner/work/geb/geb/src/entry/entry.lisp
Kind | Covered | All | % |
expression | 27 | 89 | 30.3 |
branch | 2 | 4 | 50.0 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
(in-package :geb.entry)
3
(defparameter +command-line-spec+
5
:type string :documentation "Input geb file location")
7
:type string :documentation "The function to run, should be fully qualified I.E. geb::my-main")
9
:type boolean :optional t :documentation "Use the simply typed lambda calculus frontend")
11
:type string :optional t :documentation "Save the output to a file rather than printing")
13
:type boolean :optional t :documentation "Prints the current version of the compiler")
15
:type string :optional t :documentation "Return a vamp-ir expression")
17
:type boolean :optional t :documentation "The current help message")))
20
(setf uiop:*command-line-arguments* (uiop:command-line-arguments))
21
(command-line-arguments:handle-command-line
26
(defparameter *no-input-text*
27
"Please provide an input file with -p or see the help command with -h")
29
(defun argument-handlers (&key help stlc output input entry-point vampir version)
32
(command-line-arguments:show-option-help +command-line-spec+
35
(format stream (asdf:component-version (asdf:find-system :geb))))
37
(format stream *no-input-text*))
40
(compile-down :vampir vampir
45
(with-open-file (file output :direction :output
47
:if-does-not-exist :create)
49
(run *standard-output*))))
51
;; this code is very bad please abstract out many of the components
52
(defun compile-down (&key vampir stlc entry (stream *standard-output*))
53
(let* ((name (read-from-string entry))
55
(vampir-name (renaming-scheme (intern (symbol-name name) 'keyword))))
56
(cond ((and vampir stlc)
57
(geb.vampir:extract (to-circuit eval vampir-name) stream))
59
(format stream "~A" (to-cat nil eval)))
61
(geb.vampir:extract (to-circuit eval vampir-name) stream))
63
(format stream eval)))))
65
;; Very bad of me, copying alucard code, please move elsewhere as
68
(-> renaming-scheme (symbol) keyword)
69
(defun renaming-scheme (symb)
70
"Renames certain names to be valid for vampir"
71
;; the n here mutates a once only list, so no mutation at all!
72
;; at least after the first substitute
78
(nsubstitute #\V #\%))