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

Re: (no subject)



On Wed, 10 Mar 2004 VolChris@aol.com wrote:

> I get the shift-reduce with
> (stack) r ! E
> M -> r E s
> E -> E (.) [ E ] |
>        ! E (.)          // => followed by [
>
> I cannot simply inline because the recursion leads me right back to the
> error. I shouldn't have to remove left recursion because this is an LALR
> parser. Can you please clarify?

I think that your grammar is right-recursive with respect to !E.  Do you
want to allow !!E?  If not, then I think you can say:

E -> E [ E ] | ! E_no_not
E_no_not -> E [ E ]

which is properly left-recursive.

pat