[antlr-interest] Nondeterminism in parser rules

Bussolaro Luigi luigi.bussolaro at telecomitalia.it
Fri Jun 4 02:41:05 PDT 2004


I have a "Nondeterminism warning" cause the use of KOPENBRA in 2
connected rules (expr, relationalExpression).
I need to use brackets to make precedence in logical expression and math
expression.

Does anybody knows a way to define this kind of rules differently?

Here my parser rules:

expr:      (prodExpr ((PLUS^|MINUS^) prodExpr)*)
         | (KOPENBRA^ conditional KCLOSEBRA!);
prodExpr:  powExpr ((MUL^|DIV^|MOD^) powExpr)* ;
atom:      INT | NUMBER | variable | (KOPENBRA^ expr KCLOSEBRA!) ;

conditional:            KLEFTBRACE^ conditionalExpression KRIGHTBRACE!
expr ;
conditionalExpression:	logicalOrExpression 
logicalOrExpression:	logicalAndExpression (KOR^
logicalAndExpression)* ;
logicalAndExpression:	relationalExpression (KAND^
relationalExpression)* ;
relationalExpression:	atom ((KEQ^|KNE^|KLT^|KGT^|KLE^|KGE^) atom)  |
(KOPENBRA^ conditionalExpression CLOSEBRA!) ;

variable: (LVAR^ var RVAR!)
intergers: INT ;
reals: REAL ;
...

And my Lexer rule:
KOPENBRA: '(';
KLEFTBRACE: '{';
...

Thanks in advance 
Luigi
--------------------------------------------------------------------

CONFIDENTIALITY NOTICE

This message and its attachments are addressed solely to the persons above and may contain confidential information. If you have received the message in error, be informed that any use of the content hereof is prohibited. Please return it immediately to the sender and delete the message. Should you have any questions, please contact us by replying to webmaster at telecomitalia.it.

        Thank you

                                        www.telecomitalia.it

--------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20040604/1c2f5cfa/attachment.html


More information about the antlr-interest mailing list