[antlr-interest] Re: Problem with existence of the same literal in two rules

ramyasivadas ramyasivadas at yahoo.co.in
Mon May 5 22:48:42 PDT 2003


Hi Vivek,
Thanks for your reply.
But if i change my lookahead from 20 to 1, i'll definitely have other 
problems.
Let me try changing the lookahead.
If anyone else has faced the same problem and have found a solution, 
please do mail me the same.
Thanks in advance.
Regards,
Ramya



--- In antlr-interest at yahoogroups.com, "vivek bhaskar" 
<vivek_bhaskar at h...> wrote:
> Hey ramya,
> for default k(=1), in my lexer i have used following and its 
working fine.
> STRING:	('+'|'-')? (DIGIT)+
> 	|  ('a'..'z' | 'A'..'Z' | '_') ( 'a'..'z' | 'A'..'Z' | '_' | 
DIGIT |'#' | 
> '\\')*
> 	| '"' (~'"'|'%'|'=')* '"'
> 	| '\'' (~'\'')* '\''
> 	;
> 
> protected
> DIGIT:	'0'..'9'
> 	;
> vivek
> 
> 
> 
> 
> 
> 
> >From: "ramyasivadas" <ramyasivadas at y...>
> >Reply-To: antlr-interest at yahoogroups.com
> >To: antlr-interest at yahoogroups.com
> >Subject: [antlr-interest] Re: Problem with existence of the same 
literal in 
> >two rules
> >Date: Tue, 06 May 2003 04:31:42 -0000
> >
> >Hi,
> >Thank you so much for your reply.
> >Thank you for the efforts you have taken to explain the solution in
> >detail.
> >I'm trying out the solution.
> >
> >But when i define the STRING as follows,
> >STRING : ('a'..'z' | 'A'..'Z') ('a'..'z' | 'A'..'Z'|INT)*
> >the grammar doesn't compile at all.I think it gets caught in an
> >infinite loop somewhere. My lookahead is 20. Do i have to change 
that?
> >
> >I also tried defining STRING as
> >STRING : ('a'..'z' | 'A'..'Z') ('a'..'z' | 'A'..'Z'|INT)+
> >Even this gets into an infinite loop.
> >
> >Can you please suggest me a solution for defining the string.
> >
> >Thanks in advance.
> >
> >Regards,
> >Ramya
> >
> >
> >
> >
> >
> >Your use of Yahoo! Groups is subject to 
http://docs.yahoo.com/info/terms/
> >
> >
> 
> 
> _________________________________________________________________
> Find lost friends. Revive old flames. 
http://www.batchmates.com/msn.asp Only 
> on Batchmates.com


 

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




More information about the antlr-interest mailing list