dcsimg
nondeterminism -- conflict between Additive and Unary Expression
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Manivannan_E
Posted On:   Friday, April 16, 2004 02:08 AM

hi, I am getting nondeterminism conflict bettween additive and unary expression. I try to fix it using syntactic predicate, which worked but the additive expression is right associative. Grammer which gave error:- Addexpr : Mulexpr ((PLUS | MINUS) Mulexpr)* ; Mulexpr : UnaryExpr ((STAR | DIV) UnaryExpr)* ; Unaryexpr : (PLUS | MINUS)* Powerexpr; // I also used Unaryexpr : (PLUS | MINUS) Unaryexpr | Powerexpr; Grammer using Syntactic predicate:- Addexpr : (Mulexpr (PLUS | MINUS))=> Mulexpr (PLUS | MINUS) Mulexpr | Mulexpr ; Mulexpr : UnaryExpr ((STAR | D   More>>

hi,

I am getting nondeterminism conflict bettween additive and unary expression. I try to fix it using syntactic predicate, which worked but the additive expression is right associative.

Grammer which gave error:-



Addexpr : Mulexpr ((PLUS | MINUS) Mulexpr)* ;


Mulexpr : UnaryExpr ((STAR | DIV) UnaryExpr)* ;


Unaryexpr : (PLUS | MINUS)* Powerexpr;


// I also used Unaryexpr : (PLUS | MINUS) Unaryexpr

| Powerexpr;



Grammer using Syntactic predicate:-



Addexpr : (Mulexpr (PLUS | MINUS))=>

Mulexpr (PLUS | MINUS) Mulexpr

| Mulexpr ;



Mulexpr : UnaryExpr ((STAR | DIV) UnaryExpr)* ;


Unaryexpr : (PLUS | MINUS) Unaryexpr

| Powerexpr;




I need suggestion to change the syntactic predicate with left associativity or new solution to the above problem.


-- mani

   <<Less

Re: nondeterminism -- conflict between Additive and Unary Expression

Posted By:   Eugene_Gorbachev  
Posted On:   Friday, April 16, 2004 05:23 AM

there is no conflicts, antlr eats it with no error. it's parser rules, isn't it?
About | Sitemap | Contact