dcsimg
(...)* and (...)+ ambiguity
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Casey_Burns
Posted On:   Friday, April 6, 2001 10:02 AM

How should the following be modified in order to avoid ambiguity:

a
: d ( (b)* | b | (b)+ c b ) d

If there is not good modification of the grammar, how would this be represented in ANTLR?

Thank you.

Re: (...)* and (...)+ ambiguity

Posted By:   Terence_Parr  
Posted On:   Monday, April 9, 2001 04:23 PM

For


a : d ( (b)* | b | (b)+ c b ) d ;


you'll have to tell me what b, c, d are I think.


Most importantly though, you need to left-factor things. ANTLR parsers need to decide from the left-edge what production to match. If everything starts with b, it can't decide. How about factoring (b)* out of the (...) or something.

About | Sitemap | Contact