Node:Precedence Decl, Next:Union Decl, Previous:Token Decl, Up:Declarations
Use the %left, %right or %nonassoc declaration to
declare a token and specify its precedence and associativity, all at
once. These are called precedence declarations.
See Operator Precedence, for general information on operator precedence.
The syntax of a precedence declaration is the same as that of
%token: either
%left symbols...
or
%left <type> symbols...
And indeed any of these declarations serves the purposes of %token.
But in addition, they specify the associativity and relative precedence for
all the symbols:
x op y op
z is parsed by grouping x with y first or by
grouping y with z first. %left specifies
left-associativity (grouping x with y first) and
%right specifies right-associativity (grouping y with
z first). %nonassoc specifies no associativity, which
means that x op y op z is
considered a syntax error.