commit 28029c7ba17daf02e1e05584217b785db1728824 Spenser Truex <spensertruexonline@gmail.com> 2019-07-02 23:27:50 -0700 Make BNF terminate.
README.org | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/README.org b/README.org index 75efb33..abfb068 100644 --- a/README.org +++ b/README.org @@ -6,16 +6,15 @@ SL is a Domain Specific Language (ie. simple programming language) for dealing with ambiguous dependency situations. It is more expressive than the standard method in Common Lisp: the use of reader macros. * Examples - The only external macro is =defsl=. There is BNF below, though some examples are in order: -** Simple example + The only external macro is =defsl=. There is BNF below, though some examples are in order. +** Simple This defines =sl::operator-arglist= as =slynk:operator-arglist=, unless =slynk= is unavailable, in which case =swank:operator-arglist= is used. #+BEGIN_SRC lisp (defsl operator-arglist :fn :eq slynk swank) #+END_SRC The =:fn= shows that a FUNCTION is being defined, as opposed to a =:sym= symbol; -To define another namespace a list is required: =(accessor-fn boundp-fn)=. =:eq= -denotes that the packages have the same name for this function; to define different names for each package, they must be "qualified". - +to define another namespace a list is required: =(accessor-fn boundp-fn)=. =:eq= +denotes that the packages have the same name for this function. For this simplest of examples, consider the reader macro alternative. #+BEGIN_SRC lisp #+(and slynk swank) (setf (symbol-function 'operator-arglist) @@ -38,6 +37,9 @@ To break this down: predicate. - If the =utils= package does not exist, then =sl::gensymmer= is defined as =alexanrdia:with-gensyms=. +- to define different names for each package, they must be "qualified" with the + package name. + * Install Use ASDF to install. Usually this should work: #+BEGIN_SRC sh @@ -48,25 +50,24 @@ CL-USER> (asdf:load-system :sl) * BNF #+BEGIN_EXAMPLE -(defsl <sl-name> <fnsym> {<eq> | <packages>} -<eq> ::= :eq <preflist> +(defsl <sl-name> <fnsym> <package spec>) +<package spec> ::= <eq> + | <packages> +<eq> ::= :eq <preferences> <fnsym> ::= :fn | :sym | <fnpair> -<fnpair> ::= (<setfable place> <bound predicate>) -<setfable place> ::= a setf function like symbol-function, symbol-name, etc. -<bound predicate> ::= a function that returns NIL or otherwise like fboundp, boundp, etc. +<fnpair> ::= (setfable-place bound-predicate>) <packages> ::= <package> <fn name> <more packages> <package> ::= symbol <fn name> ::= symbol -<preflist> ::= <package> <more packages> +<preferences> ::= <package> <more packages> <more packages> ::= ε | <package> | <package> <more packages> #+END_EXAMPLE * Issues: - This is a new thing. -- =defsl= is quite possibly the world's most unhygenic macro: -don't expect anything about evaluation order or number of evaluations to be -true. +- =defsl= is quite possibly the world's most unhygenic macro: don't expect + anything about evaluation order or number of evaluations to be true.