[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
5.3.2 Specifying Operator Precedence
Bison allows you to specify these choices with the operator precedence
declarations %left
and %right
. Each such declaration
contains a list of tokens, which are operators whose precedence and
associativity is being declared. The %left
declaration makes all
those operators left-associative and the %right
declaration makes
them right-associative. A third alternative is %nonassoc
, which
declares that it is a syntax error to find the same operator twice “in a
row”.
The relative precedence of different operators is controlled by the
order in which they are declared. The first %left
or
%right
declaration in the file declares the operators whose
precedence is lowest, the next such declaration declares the operators
whose precedence is a little higher, and so on.