623 |
|
|
624 |
Bison normally warns if there are any conflicts in the grammar |
Bison normally warns if there are any conflicts in the grammar |
625 |
(*note Shift/Reduce Conflicts: Shift/Reduce.), but most real grammars |
(*note Shift/Reduce Conflicts: Shift/Reduce.), but most real grammars |
626 |
have harmless shift/reduce conflicts which are resolved in a |
have harmless shift/reduce conflicts which are resolved in a predictable |
627 |
predictable way and would be difficult to eliminate. It is desirable |
way and would be difficult to eliminate. It is desirable to suppress |
628 |
to suppress the warning about these conflicts unless the number of |
the warning about these conflicts unless the number of conflicts |
629 |
conflicts changes. You can do this with the `%expect' declaration. |
changes. You can do this with the `%expect' declaration. |
630 |
|
|
631 |
The declaration looks like this: |
The declaration looks like this: |
632 |
|
|
633 |
%expect N |
%expect N |
634 |
|
|
635 |
Here N is a decimal integer. The declaration says there should be no |
Here N is a decimal integer. The declaration says there should be |
636 |
warning if there are N shift/reduce conflicts and no reduce/reduce |
no warning if there are N shift/reduce conflicts and no reduce/reduce |
637 |
conflicts. The usual warning is given if there are either more or fewer |
conflicts. An error, instead of the usual warning, is given if there |
638 |
conflicts, or if there are any reduce/reduce conflicts. |
are either more or fewer conflicts, or if there are any reduce/reduce |
639 |
|
conflicts. |
640 |
|
|
641 |
In general, using `%expect' involves these steps: |
In general, using `%expect' involves these steps: |
642 |
|
|