Next: GNU Free Documentation License, Previous: Optional Lambda Expressions, Up: Bovine parser development [Contents]
The rule:
any-symbol: symbol ;
is equivalent to
any-symbol: symbol ( $1 ) ;
which, if it matched the string ‘"A"’, would return
( "A" )
If this rule were used like this:
%token <punctuation> EQUAL "=" … assign: any-symbol EQUAL any-symbol ( $1 $3 ) ;
it would match ‘"A=B"’, and return
( ("A") ("B") )
The letters ‘A’ and ‘B’ come back in lists because ‘any-symbol’ is a nonterminal, not an actual lexical element.
To get a better result with nonterminals, use , to splice lists in like this:
%token <punctuation> EQUAL "=" … assign: any-symbol EQUAL any-symbol ( ,$1 ,$3 ) ;
which would return
( "A" "B" )