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: cwcaceres
Subject: Re: shift/reduce conflict with unary
Date: Wed, 22 Aug 2007 05:11:06 -0700 (PDT)

But I'm not trying to list. I'm trying to do the add operation. So the
expression "5 6 +4" wouldn't be valid. An example of a valid operation would
be "+5 + -6 - -2" which should have an output of 1. My grammar file
currently outputs the correct result.

I agree with trying to remove the conflict but I'm putting that on hold for
now since I can't think of how to remove it.

Thanks for trying to help.

Camille


Evan Lavelle-2 wrote:
> 
> 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
> 
> 
> _______________________________________________
> address@hidden http://lists.gnu.org/mailman/listinfo/help-bison
> 
> 

-- 
View this message in context: 
http://www.nabble.com/shift-reduce-conflict-with-unary-tf4303942.html#a12273299
Sent from the Gnu - Bison - Help mailing list archive at Nabble.com.





reply via email to

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