Re: eliminate left recursion

"Robert Wyatt" <jrwyatt@nortelnetworks.com>
6 Feb 2002 23:23:20 -0500

          From comp.compilers

Related articles
eliminate left recursion gurukiller@gmx.de (2002-01-28)
Re: eliminate left recursion dr_feriozi@prodigy.net (SLK Parsing) (2002-01-30)
Re: eliminate left recursion jrwyatt@nortelnetworks.com (Robert Wyatt) (2002-02-06)
| List of all articles for this month |
From: "Robert Wyatt" <jrwyatt@nortelnetworks.com>
Newsgroups: comp.compilers
Date: 6 Feb 2002 23:23:20 -0500
Organization: Nortel
References: 02-01-155
Keywords: parse
Posted-Date: 06 Feb 2002 23:23:20 EST

How about ....


A -> S A'.
A' -> S A'.
A' -> .


S -> "(" R ")" S'.
S -> "x" S'.
S' -> "*" S'
S' -> .


Robert


Herbert Fröhlich wrote:
>
> The following grammar G1 is left recursive:
>
> A -> A S.
> A -> S.
> S -> S "*".
> S -> "(" R ")".
> S -> "x".
>
> The usual way to eliminate recursions is:
>
> A -> A a.
> A -> b.
>
> |
> v
>
> A -> b A'.
> A'-> a A'.
> A'-> .
>
> How does it work with G1? There must be solution.
>
> Thanks for every help


Post a followup to this message

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