I found number of questions related to 'multiple alternatives'in stackoverflow but nothing was much helpful. Here is a part of my g file in antlr3.
statement:
selection_stmt
| expression_stmt
| compound_stmt
| iteration_stmt
| return_stmt
;
selection_stmt:
IF OPENB expression CLOSB statement (ELSE statement)?
;
expression:
(var ASSIGN expression) => assignment
| simple_expression
;
The problem I'm facing is I get following warning for the phrase ELSE statement
above.
(200): Decision can match input such as "ELSE" using multiple alternatives: 1, 2 As a result, alternative(s) 2 were disabled for that input
Can someone explain me what happens here? Thank you.
P.S.
When I use a syntactic predicate as ((ELSE)=>ELSE statement)?
, warning disappears. I don't get the reason for this too.