bovine: Optional Lambda Expression

 
 3 Optional Lambda Expressions
 *****************************
 
 The OLE (“Optional Lambda Expression”) is converted into a bovine
 lambda.  This lambda has special short-cuts to simplify reading the
 semantic action definition.  An OLE like this:
 
      ( $1 )
 
    results in a lambda return which consists entirely of the string or
 object found by matching the first (zeroth) element of match.  An OLE
 like this:
 
      ( ,(foo $1) )
 
    executes ‘foo’ on the first argument, and then splices its return
 into the return list whereas:
 
      ( (foo $1) )
 
    executes ‘foo’, and that is placed in the return list.
 
    Here are other things that can appear inline:
 
 ‘$1’
      The first object matched.
 
 ‘,$1’
      The first object spliced into the list (assuming it is a list from
      a non-terminal).
 
 ‘'$1’
      The first object matched, placed in a list.  I.e., ‘( $1 )’.
 
 ‘foo’
      The symbol ‘foo’ (exactly as displayed).
 
 ‘(foo)’
      A function call to foo which is stuck into the return list.
 
 ‘,(foo)’
      A function call to foo which is spliced into the return list.
 
 ‘'(foo)’
      A function call to foo which is stuck into the return list in a
      list.
 
 ‘(EXPAND $1 NONTERMINAL DEPTH)’
      A list starting with ‘EXPAND’ performs a recursive parse on the
      token passed to it (represented by ‘$1’ above.)  The “semantic
      list” is a common token to expand, as there are often interesting
      things in the list.  The NONTERMINAL is a symbol in your table
      which the bovinator will start with when parsing.  NONTERMINAL’s
      definition is the same as any other nonterminal.  DEPTH should be
      at least ‘1’ when descending into a semantic list.
 
 ‘(EXPANDFULL $1 NONTERMINAL DEPTH)’
      Is like ‘EXPAND’, except that the parser will iterate over
      NONTERMINAL until there are no more matches.  (The same way the
      parser iterates over the starting rule (SeeStarting Rules).
      This lets you have much simpler rules in this specific case, and
      also lets you have positional information in the returned tokens,
      and error skipping.
 
 ‘(ASSOC SYMBOL1 VALUE1 SYMBOL2 VALUE2 ...)’
      This is used for creating an association list.  Each SYMBOL is
      included in the list if the associated VALUE is non-‘nil’.  While
      the items are all listed explicitly, the created structure is an
      association list of the form:
 
           ((SYMBOL1 . VALUE1) (SYMBOL2 . VALUE2) ...)
 
 ‘(TAG NAME CLASS [ATTRIBUTES])’
      This creates one tag in the current buffer.
 
      NAME
           Is a string that represents the tag in the language.
 
      CLASS
           Is the kind of tag being create, such as ‘function’, or
           ‘variable’, though any symbol will work.
 
      ATTRIBUTES
           Is an optional set of labeled values such as ‘:constant-flag t
           :parent "parenttype"’.
 
 ‘(TAG-VARIABLE NAME TYPE DEFAULT-VALUE [ATTRIBUTES])’
 ‘(TAG-FUNCTION NAME TYPE ARG-LIST [ATTRIBUTES])’
 ‘(TAG-TYPE NAME TYPE MEMBERS PARENTS [ATTRIBUTES])’
 ‘(TAG-INCLUDE NAME SYSTEM-FLAG [ATTRIBUTES])’
 ‘(TAG-PACKAGE NAME DETAIL [ATTRIBUTES])’
 ‘(TAG-CODE NAME DETAIL [ATTRIBUTES])’
      Create a tag with NAME of respectively the class ‘variable’,
      (semantic-appdev)Creating Tags:: for the lisp functions these
      translate into.
 
    If the symbol ‘%quotemode backquote’ is specified, then use ‘,@’ to
 splice a list in, and ‘,’ to evaluate the expression.  This lets you
 send ‘$1’ as a symbol into a list instead of having it expanded inline.