Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compiler Tools Pccts > antlr: Can't fi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 68 of 134
Post > Topic >>

antlr: Can't find nondeterminism in simple parser

by olaf_schwarz@[EMAIL PROTECTED] (Olaf Schwarz) Sep 22, 2004 at 06:31 AM

Hi!
Can somebody please help me finding out why antlr complains about this
grammar?

list : key (WHITESPACE)+ value ((WHITESPACE)+ key (WHITESPACE)+
value)* ;

value :  integer  | LEFTBRACKET (WHITESPACE)* list (WHITESPACE)*
RIGHTBRACKET;

key : LETTER (LETTER|DIGIT)*;

integer : (DIGIT)+;

The lexer-specification is straightforward:

WHITESPACE : (' ' | '\t' | '\r' '\n' | '\n');
LETTER : ('a'..'z'|'A'..'Z');
DIGIT : '0'..'9';
LEFTBRACKET  : '[';
RIGHTBRACKET : ']';

And this is the error message:

gml2.g:4: warning:nondeterminism upon
gml2.g:4:     k==1:WHITESPACE
gml2.g:4:     k==2:WHITESPACE
gml2.g:4:     k==3:WHITESPACE,LETTER
gml2.g:4:     k==4:WHITESPACE,LETTER,DIGIT
gml2.g:4:     k==5:WHITESPACE,LEFTBRACKET,RIGHTBRACKET,LETTER,DIGIT
gml2.g:4:     between alt 1 and exit branch of block

It disappears when I delete the second (WHITESPACE)* in the value
rule. But that is not an option because the files which should be
parsed may be formatted with whitespace chars.
I am really stuck with this.

Thank you very much in advance
Olaf
 




 1 Posts in Topic:
antlr: Can't find nondeterminism in simple parser
olaf_schwarz@[EMAIL PROTE  2004-09-22 06:31:07 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 14:28:50 CDT 2008.