On Thu, Mar 25, 2010 at 9:56 AM, foxterri foxterri <[email protected]>wrote:
>
> The complete grammer is attached, it is not completely done, but should
> give a good overview of it.
>
> debugging it in eclipse gives the following error:
>
> error(210): The following sets of rules are mutually left-recursive
> [primaryNoNewArray, arrayAccess, methodInvocation, primary, fieldAccess]
>
That grammar still contains errors, but after commenting them out, I can
spot the left recursive rules.
I presume you know what left recursive rules are? If not, here's one in your
grammar: an 'arrayAccess' first part can be a 'primaryNoNewArray' whose
first part can be a 'methodInvocation' whose first part can be a 'primary'
whose first part can be a 'primaryNoNewArray'. The 'primaryNoNewArray' makes
it left recursive. Note that by "first part", I mean the left-most part of a
rule.
arrayAccess
primaryNoNewArray <-----------------------+
methodInvocation |
primary | left recursive
primaryNoNewArray <--------------------+
Checkout ANTLR's wiki about this in more detail and how to remove them:
http://www.antlr.org/wiki/display/ANTLR3/Left-Recursion+Removal
Regards,
Bart.
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.