3070 |
@findex %expect |
@findex %expect |
3071 |
|
|
3072 |
Bison normally warns if there are any conflicts in the grammar |
Bison normally warns if there are any conflicts in the grammar |
3073 |
(@pxref{Shift/Reduce, ,Shift/Reduce Conflicts}), but most real grammars have harmless shift/reduce |
(@pxref{Shift/Reduce, ,Shift/Reduce Conflicts}), but most real grammars |
3074 |
conflicts which are resolved in a predictable way and would be difficult to |
have harmless shift/reduce conflicts which are resolved in a predictable |
3075 |
eliminate. It is desirable to suppress the warning about these conflicts |
way and would be difficult to eliminate. It is desirable to suppress |
3076 |
unless the number of conflicts changes. You can do this with the |
the warning about these conflicts unless the number of conflicts |
3077 |
@code{%expect} declaration. |
changes. You can do this with the @code{%expect} declaration. |
3078 |
|
|
3079 |
The declaration looks like this: |
The declaration looks like this: |
3080 |
|
|
3082 |
%expect @var{n} |
%expect @var{n} |
3083 |
@end example |
@end example |
3084 |
|
|
3085 |
Here @var{n} is a decimal integer. The declaration says there should be no |
Here @var{n} is a decimal integer. The declaration says there should be |
3086 |
warning if there are @var{n} shift/reduce conflicts and no reduce/reduce |
no warning if there are @var{n} shift/reduce conflicts and no |
3087 |
conflicts. The usual warning is given if there are either more or fewer |
reduce/reduce conflicts. An error, instead of the usual warning, is |
3088 |
conflicts, or if there are any reduce/reduce conflicts. |
given if there are either more or fewer conflicts, or if there are any |
3089 |
|
reduce/reduce conflicts. |
3090 |
|
|
3091 |
In general, using @code{%expect} involves these steps: |
In general, using @code{%expect} involves these steps: |
3092 |
|
|