[antlr-interest] Not More Infinite Recursion

Jason jasonriz at yahoo.com
Mon Feb 2 15:48:50 PST 2004


Hello,

First off, I lied; it is more infinite recursion.  

I've made quite a bit of progress with the converion
of my grammar from YACC to ANTLR.  There are still
pieces of the grammar though in which rules
'cyclically' reference other rules thereby generating
infinite recursions.  I'm having difficulty figuring
out how to rewrite these sections to eliminate the
left recursions.  Here is a slightly pared down
example:

//BEGIN EXAMPLE
dimentia:
	membrane B A
      |
	A C membrane D
      |
	gentle B A
      |
	A C gentle D
	;

gentle:
	G	
      |
	dimentia B E C
      |
	membrane B F C
      |
	F C dimentia H
      |
	F C membrane H
      |
	membrane B E C
      |
	E C dimentia H
      |
	E C membrane H
	;	

membrane:
	I
      |
	J
      |
	gentle B K 
      |
    membrane L K
	;
//END EXAMPLE

I've tried refactoring this every which way but I
can't seem to arrive at a solution.  For what it's
worth BISON consumes it without issuing any
shift/reduce warnings.  I'm not looking so much for a
solution to this particular grammar (though I wouldn't
complain if someone provided one) as I am looking for
a general strategy to solve this kind of problem.  I
apologize for rambling.  Any pointers anyone could
provide would be greatly apprciated.

-jason 

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

 

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/antlr-interest/

To unsubscribe from this group, send an email to:
 antlr-interest-unsubscribe at yahoogroups.com

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




More information about the antlr-interest mailing list