| 1 |
In our example, we would want the following declarations: |
| 2 |
verb( |
| 3 |
%left '<' |
| 4 |
%left '-' |
| 5 |
%left '*' |
| 6 |
) |
| 7 |
In a more complete example, which supports other operators as well, we |
| 8 |
would declare them in groups of equal precedence. For example, 'tt(+)' is |
| 9 |
declared with 'tt(-)': |
| 10 |
verb( |
| 11 |
%left '<' '>' '=' NE LE GE |
| 12 |
%left '+' '-' |
| 13 |
%left '*' '/' |
| 14 |
) |
| 15 |
(Here tt(NE) and so on stand for the operators for `not equal' and so |
| 16 |
on. We assume that these tokens are more than one character long and therefore |
| 17 |
are represented by names, not character literals.) |