Grammar-to-Lisp Details
For the bovinator, lexical token matching patterns are inlined. When the grammar-to-lisp converter encounters a lexical token declaration of the form:
bash
%token <type> token-name match-valueIt substitutes every occurrences of token-name in rules, by its expanded form:
bash
type match-valueFor example:
bash
%token <symbol> MOOSE "moose"
find_a_moose: MOOSE
;Will generate this pseudo equivalent-rule:
bash
find_a_moose: symbol "moose" ;; invalid syntax!
;Thus, from the bovinator point of view, the components part of a rule is made up of symbols and strings. A string in the mix means that the previous symbol must have the additional constraint of exactly matching it, as described in How Lexical Tokens Match.
Please Note:
For the bovinator, this task was mixed into the language definition to simplify implementation, though Bison’s technique is more efficient.