dcsimg
Can anyone tell me what i'm doing wrong?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Sunday, March 13, 2011 09:59 PM

i'm trying to find why my gramar generates error currently my grammar looks like that: grammar myGrammar; options { language = Java; output = AST; } number : ('0'..'9')+; and i get: warning(200): /myGrammar/myGrammar.g:16:19: Decision can match input such as "EOF" using multiple alternatives: 1, 2 As a result, alternative(s) 2 were disabled for that input |---> number : ('0'..'9')+; error(201): /myGrammar/myGrammar.g:16:19: The following alternatives can never be matched: 2 |---> number : ('0'..'9')+; to be hon   More>>

i'm trying to find why my gramar generates error
currently my grammar looks like that:

			



grammar myGrammar;



options {

language = Java;

output = AST;

}



number : ('0'..'9')+;



and i get:

warning(200): /myGrammar/myGrammar.g:16:19: Decision can match input such as "EOF" using multiple alternatives: 1, 2

As a result, alternative(s) 2 were disabled for that input
|---> number : ('0'..'9')+;


error(201): /myGrammar/myGrammar.g:16:19: The following alternatives can never be matched: 2
|---> number : ('0'..'9')+;





to be honest i don't have any idea what i'm doing wrong

regards    <<Less

Re: Can anyone tell me what i'm doing wrong?

Posted By:   Anonymous  
Posted On:   Friday, March 18, 2011 01:48 PM

Aren't lexer rule names supposed to start with a capital letter?

i.e.:

NUMBER : ('0'..'9')+;
About | Sitemap | Contact