help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shift/reduce conflict with unary


From: Evan Lavelle
Subject: Re: shift/reduce conflict with unary
Date: Wed, 22 Aug 2007 12:44:21 +0100
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

Actually, it turns out that the conflict is pretty obvious even without the debug output. consider this input:

"5 6 +4"

How do you expect this to be scanned? Does it contain 3 summation_expressions ("5", "6", "+4") or 2 ("5", "6+4")? There's an ambiguity - you haven't defined an expression list in an unambiguuous way.

this is a very common problem - how do you define a list of something complex? Can you define expression lists to require a separator? How about

"5, 6, +4"  -> 3 expressions
"5, 6 +4"   -> 2 expressions



Is
it okay if I disregard the conflict if the grammar works anyway?

I personally think that this is a mistake, but it is commonly done. The problems are that you may not understand why there is a conflict in the first place, and any subsequent maintainers certainly won't understand; I prefer to try to remove the conflict.

Evan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]