1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
Syntax: bf(%expect) tt(number)
B() normally warns if there are any conflicts in the grammar (see section
ref(SHIFTREDUCE)), but many real grammars have harmless em(shift/reduce
conflicts) which are resolved in a predictable way and which would be
difficult to eliminate. It is desirable to suppress the warning about these
conflicts unless the number of conflicts changes. You can do this with the
tt(%expect) declaration.
The argument tt(number) is a decimal integer. The declaration says there
should be no warning if there are tt(number) shift/reduce conflicts and no
em(reduce/reduce conflicts). The usual warning is given if there are either
em(more) or em(fewer) conflicts, em(or) if there are em(any) reduce/reduce
conflicts.
In general, using tt(%expect) involves these steps:
itemization(
it() Compile your grammar without tt(%expect). Use the `tt(-V)' option to
get a verbose list of where the conflicts occur. B() will also print the
number of conflicts.
it() Check each of the conflicts to make sure that b()'s default
resolution is what you really want. If not, rewrite the grammar and go back to
the beginning.
it() Add an tt(%expect) declaration, copying the number of (shift-reduce)
conflict printed by b().
)
Now b() will stop annoying you about the conflicts you have checked, but
it will warn you again if changes in the grammar result in a different number
or type of conflicts.
|