[antlr-interest] weird rule...

John B. Brodie jbb at acm.org
Mon Apr 18 11:01:23 PDT 2005


Sorry to keep bugging everyone.

I think this grammar solves the ambiguity issue...

----------
class testParser extends Parser;

// want to find an unambiguous version of:
// suf : ( x | y )* ( ( x z ) | y ) ;

suf :
	( x ( suf | z ) )
    |   ( y ( suf )? )
;

x : X ;
y : Y ;
z : Z ;
----------

(ran through the Tool okay, haven't tried to execute resultant parser)



More information about the antlr-interest mailing list