Re: java parsing problem

"Joachim Durchholz" <>
22 Oct 2000 01:24:30 -0400

          From comp.compilers

Related articles
java parsing problem (2000-10-19)
Re: java parsing problem (2000-10-22)
Re: java parsing problem (Joachim Durchholz) (2000-10-22)
Re: java parsing problem (Ivan Naumov) (2000-10-22)
| List of all articles for this month |

From: "Joachim Durchholz" <>
Newsgroups: comp.compilers
Date: 22 Oct 2000 01:24:30 -0400
Organization: Compilers Central
References: 00-10-146
Keywords: Java, parse

<> wrote:
> Is this left-recursion?

Yes. ("left-recursion" means there's a recursion in the productions that
threads through the leftmost symbol in each production.)

You'll have to rewrite the grammar to make it LL.
A simple-minded rewrite would be to expand productions until you get
something like

        ... -- Other productions 1
        Primary . Identifier
        ... -- Other productions 2
and to rewrite this as
        Simple_Primary . Primary_Sequence
        ... -- Other productions 1
        ... -- Other productions 2

which is LL.
More intelligent rewrite techniques might exist; the above is textbook

I'm not 100% sure, but I dimly remember that not all LR languages are LL
(and vice versa). If that's the case, I suspect that there's no general
algorithm for transforming an LR grammar into an LL one; grammar
transformations tend to run into undecidability issues pretty quickly.


Post a followup to this message

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