How to get rid of the following multiple alternatives warnings in my ANTLR3 grammar?

Posted by Jarrod Roberson on Stack Overflow See other posts from Stack Overflow or by Jarrod Roberson
Published on 2011-11-14T16:57:59Z Indexed on 2011/11/14 17:51 UTC
Read the original article Hit count: 393

Filed under:
|
|
[11:45:19] warning(200): mygrammar.g:14:57: Decision can match input such as "','" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
[11:45:19] warning(200): C:\Users\Jarrod Roberson\mygrammar.g:14:57: Decision can match input such as "','" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input

I want to be able to nest functions inside other functions.

myfunction(x) ->
  sqr(a) -> a * a,
  y = sqr(x).

here is the line it is complaining about

function : ID '(' args ')' '->' statement (',' statement)* ;

and here is what it is considering the alternative

statement : ATOM
          | expression
          | assignment
          | function
          ;

Here is what the synatx diagram looks like in ANTLRWorks

syntax diagram

I really like things to compile/work without any warnings. How do I resolve this warning condition?

© Stack Overflow or respective owner

Related posts about antlr

Related posts about antlr3