[antlr-interest] hard to resolve non-determinism

Anthony Brenelière abreneliere at telys.com
Wed Feb 5 10:25:40 PST 2003


I’m am converting a working LR grammar to a LL grammar, but i still have
some non-determinism problems.

If have the following rules :

--------------------------------
// root of the rules set:

entSetAttList	// (supplier WHERE name="Telys"):client, service
	:	entSetAtt ( COMMA entSetAtt )*
;

entSetAtt
	:	( entity | attribute ) 
               //  <- i have a non-determinism on these rules
;

attribute	// ::supplier:client.address
	:	entity simpleAttribute 
	|	simpleAttribute 
;

entity // (supplier WHERE name="Telys"):client
	:	entityComponent (COLON entity)?  
               // <- i tried ‘entityComponent (COLON entityComponent)*’
too  
;

entityComponent // (supplier WHERE name="Telys")
	:	LPAREN IDENTIFIER clause RPAREN
	|	IDENTIFIER 
;
------------------------------------

C:\CIAO_ANTLR\grammar\_iCIAO.g:34:17: warning:nondeterminism bet
ween alts 1 and 2 of block upon
C:\CIAO_ANTLR\grammar\_iCIAO.g:34:17:     k==1:LPAREN,IDENTIFIER
C:\CIAO_ANTLR\grammar\_iCIAO.g:34:17:     k==2:COLON,IDENTIFIER
C:\CIAO_ANTLR\grammar\_iCIAO.g:34:17:     k==3:LPAREN,IDENTIFIER
,"WHERE"

And the program cannot decide between entity & attribute in the rule
entSetAtt,

Anyone could help me ?

Do you know if a non-determinism must be absolutly resolved ?


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list