[antlr-interest] a grammar problem

Terence Parr parrt at cs.usfca.edu
Fri May 18 12:37:41 PDT 2007


On May 18, 2007, at 12:04 PM, Fõrat K†‚†K wrote:

>
> inParens
>    :   LEFT_PARENTHESIS expression RIGHT_PARENTHESIS
>    |   literal
>    ;
>
>
> literal
>    :   NUMBER
>    |   STRING
>    // SHOULD BE ARRAY
>    |   LEFT_PARENTHESIS expressionList? RIGHT_PARENTHESIS
>    ;
>

> the problem is inParens rule and Array literals.
>
> how can i fix this problem without using syntactic predicate?

THose rules are completely ambiguous.  you don't need inParens  
anyway.  Just call literal. same thing.
Ter



More information about the antlr-interest mailing list