On Fri, 2011-10-07 at 16:22 -0700, mglyons wrote: > Thanks again! I did what you said and also figured out how to do some > left-factoring. I had to fix 3 left-factoring issues and resolved two of > them. This one I cannot seem to figure out: > > *expr : var '=' expr | simple_expr;* > > I do not think you need any more info to solve or understand that one. I > need some guidance or a push in the right direction for this one.
actually without seeing the rest of the grammar i am not really sure. but it looks like you can recast the above expr rule as this: expr : ( var '=' )* simple_expr ; however this will introduce an ambiguity if var is a complex structure that can match an infinite sentential form, which is probably the case in your c-like language... > > My long list of errors is getting smaller and smaller and it feels good. > After I finish this last left-factor problem, I will move on to the other > issues. > sometimes, i find, that when trying to convert an existing grammar into the LL(*) form used by ANTLR that it can be easier to start with a very small unambiguous "core" portion of the original language and then add language features slowly in small steps resolving any issues that arise at each small step. build up a suite of short sentential forms that exercise the grammar at each step and that can be used to regression test the next step in order to ensure no language feature got broken as the grammar evolves. List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" 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/il-antlr-interest?hl=en.
