Le 28 juin 2012 à 14:51, Timothy Madden a écrit :

> On 06/28/2012 10:09 AM, Akim Demaille wrote:
>>> >  On the other hand, I could not get GLR with C++ yet…
>> I have it working, but it's based on horrible hacks.  And
>> I really mean horrible.  If PHP in itself does not need it,
>> I would avoid it.
>> 
> 
> That is what I was afraid of.

So why don't you give a try to what I proposed?

> I see the real php parser (from php source code) does not have a %glr 
> directive, but it does have %expect 3, and I know php has the dangling 
> elseif/else problem. Can a language with this issue be written in a LALR(1) 
> grammar ?

Yes, it can, which is obviously the case of php.  I
suspect your question is rather "can this conflict be
explicitly solved instead of relying on the shift
precedence in s/r conflicts".  Yes again, give a higher
precedence to the else token than the if-then rule.
Or declare "%right if else".


_______________________________________________
help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to