Re: Bison Parser negate production rules



On 23 Mar 2007 22:16:22 -0400, royzlife@xxxxxxxxx wrote:

Can any one help in explaining how to negate a production rule in
Bison parser?
e.g A:B
B: C
|D
|E
(here i want to write a block of statements or rules which will be
executed if B doesnt match to C/D/E.)

[Basically, you can't other than by enumerating all of the other
possibilities. What do you really want to do here? -John]

There is no way to specify the complement of a rule because it isn't a
terribly useful thing to do. Context free languages are drawn from an
infinite set of strings, the complement of any particular subset of a
language is also an infinite set of strings. Not very practical to
match.

If you can tell us more about what you are trying to do, we might be
able to suggest some alternatives.

George
.