File: specifying.yo

package info (click to toggle)
bisonc%2B%2B 4.09.02-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,412 kB
  • ctags: 2,871
  • sloc: cpp: 9,459; ansic: 1,434; makefile: 1,091; sh: 286; yacc: 84; lex: 60
file content (15 lines) | stat: -rw-r--r-- 921 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
B() allows you to specify these choices with the operator precedence
directives tt(%left) and tt(%right). Each such directive contains a list of
tokens, which are operators whose precedence and associativity is being
declared. The tt(%left) directive makes all those operators left-associative
and the tt(%right) directive makes them right-associative. A third alternative
is tt(%nonassoc), which declares that it is a syntax error to find the same
operator twice `in a row'. Actually, tt(%nonassoc) is not currently (0.98.004)
punished that way by b(). Instead, tt(%nonassoc) and tt(%left) are
handled identically.

The relative precedence of different operators is controlled by the order in
which they are declared. The first tt(%left) or tt(%right) directive in the
file declares the operators whose precedence is lowest, the next such
directive declares the operators whose precedence is a little higher, and so
on.