[antlr-interest] simple rules not deterministic

Mark Volkmann r.mark.volkmann at gmail.com
Tue Oct 9 12:11:23 PDT 2007


On 10/9/07, Jim Idle <jimi at temporal-wave.com> wrote:
>
> Mark,
>
> With the full grammar, I can confirm that your issue is what I said. In that
> the rule block has statement+ and this means that your methodCall can see
> the same input in two different ways, being one call to it or two calls to
> it.
>
> You can try to rejig the grammar or use a predicate to get rid of the
> warning, though I bet if you look at the code it is probably doing what you
> 'expect' anyway. Warnings are not good to leave hanging about of course.
>
> Try:
>
> methodCall: t=target ((parameter)=>p+=parameter)* -> ^(CALL $t $p*);

That fixed it! Thanks!

I can't say I understand it yet though. Can you explain what this part means?

((parameter)=>p+=parameter)*

How does that differ from the following?

p+=parameter*

-- 
R. Mark Volkmann
Object Computing, Inc.


More information about the antlr-interest mailing list