[antlr-interest] Need help with nondeterminism warning

Bogdanov, Serge serge.bogdanov at intel.com
Thu Apr 14 15:22:00 PDT 2005


By this small change you actually changed a lot and now antlr is not
sure when to enter/exit the 'rules' rule. If you want to keep it this
way, you need to add something like the following:

rules:
	(rule)=> (rule)+
	|
	;

Or maybe k = 3 would help.

>> Sergey Bogdanov
intel massachusetts
M/S HD2-246
77 Reed Road, 
Hudson, MA  01749
Tel: (978)553-2724

>-----Original Message-----
>From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
>bounces at antlr.org] On Behalf Of Prashant Deva
>Sent: Thursday, April 14, 2005 6:12 PM
>To: antlr-interest at antlr.org
>Subject: [antlr-interest] Need help with nondeterminism warning
>
>Here is the warning-
>nondeterminism between alts 1 and 2 of block upon k==1:ACTION
>k==2:EOF,"lexclass","class","public","protected","private",DOC_COMMENT,
ACTI
>ON,TOKEN_REF,RULE_REF
>
>I got this warning after i modified the antlr grammar just a little.
>I am pretty bad with parser generation stuff, so could someone pls
>tell me what exactly does this warning mean, and is it a possible
>sequence at all or not? so do i need to worry about it?
>
>Here is part of the original grammar and a description of the change i
made
>-
>
>
>classDef : (ACTION)? (DOC_COMMENT)? grammarSpec rules;
>
>grammarSpec :
>            ("lexclass" id |
>            "class" id "extends" ("Lexer"|"Parser"|"TreeParser")
>(superClass)?) SEMI
>            (optionsSpec)?
>            (tokensSpec)?
>            ( ACTION )?
>	;
>
>rules : (rule)+;
>
>
>I just changed the 'rules' to accept 0 or more rules, thus-
>
>rules : (rule)*;
>
>
>So i do need to worry about this non determinism warning ?
>
>PRASHANT


More information about the antlr-interest mailing list