Pedro Lopes wrote:
> [...] I'm left with a bunch of S/R and R/R conflicts (the above being
> only one
> of the sources of that).  Does that mean my grammar is horribly
> broken?
>   
Not necessarily.  But you should definitely verify in the parser.out 
file that each conflict is handled properly.
> The docs give the impression that conflicts are Bad and should always
> be
> fixed.
>   
They make the grammar difficult to maintain.  If you should change 
something in the future, you'll have to re-check each of the conflicts 
and this stuff won't be fresh in your mind any more.  I generally try to 
eliminate conflicts, but if not then I document them so that I will know 
which conflicts are OK in the future (and notice if new ones appear, 
which may be problems).

I seem to recall one of the old compiler books saying that any grammar 
with conflicts can be re-written to not have conflicts (and express the 
same language), but that it may require more rules.  So it should be 
possible to produce a conflict free grammar, though there are some 
situations where the number of rules explodes.

You should be able to remove each conflict, one at a time.  If you 
encounter one that causes the number of rules to grow too much, then you 
may decide to skip that one.  But I'd still recommend removing as many 
conflicts as you can.  (It's good practice with grammars too!  :-) )


-bruce

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ply-hack" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/ply-hack?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to