Debian Codegraph @

documentation/manual/directives/expect.yo

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