eliminating left-recursion

"aegis" <aegis@mad.scientist.com>
7 Jan 2006 22:13:59 -0500

          From comp.compilers

Related articles
eliminating left-recursion aegis@mad.scientist.com (aegis) (2006-01-07)
Re: eliminating left-recursion rjshaw@netspace.net.au (Russell Shaw) (2006-01-08)
Re: eliminating left-recursion cdodd@acm.org (Chris Dodd) (2006-01-08)
Re: eliminating left-recursion DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-01-09)
Re: eliminating left-recursion lojiancn@hotmail.com (jackycn) (2006-01-09)
| List of all articles for this month |

From: "aegis" <aegis@mad.scientist.com>
Newsgroups: comp.compilers
Date: 7 Jan 2006 22:13:59 -0500
Organization: http://groups.google.com
Keywords: syntax, question
Posted-Date: 07 Jan 2006 22:13:59 EST

Given the following production:

d-declarator: ID | d-declarator '[' constant ']' | '(' d-declarator ')'

How can I eliminate left-recursion here? The method sketched
out in 'Compilers, Principles, Techniques and Tools' only
presents a very simple case where the non-terminal
that introduces left-recursion in the production, isn't restricted
to being on the left-hand side of the rule. In the above production,
the second rule allows me to construct an array of arrays ... ad
infinitum. i.e., foo[10][10][10][10][10][10][10]; etc

Is it even possible to express the second rule of the above production
without relying on left-recursion?

Any help greatly appreciated!


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.