converting this grammar to LL1

"Te-Cheng Shen" <te-cheng_shen@agilent.com>
20 Oct 2002 22:55:18 -0400

          From comp.compilers

Related articles
converting this grammar to LL1 te-cheng_shen@agilent.com (Te-Cheng Shen) (2002-10-20)
Re: converting this grammar to LL1 chungyc@pobox.com (Yoo Chung) (2002-10-24)
Re: converting this grammar to LL1 joachim_d@gmx.de (Joachim Durchholz) (2002-10-24)
Re: converting this grammar to LL1 patrick.volteau@st.com (Patrick Volteau) (2002-10-25)
Re: converting this grammar to LL1 andreas.gieriet@externsoft.ch (Andreas Gieriet) (2002-10-25)
Re: converting this grammar to LL1 te-cheng_shen@agilent.com (Te-Cheng Shen) (2002-11-06)
Re: converting this grammar to LL1 joachim_d@gmx.de (Joachim Durchholz) (2002-11-07)
[1 later articles]
| List of all articles for this month |

From: "Te-Cheng Shen" <te-cheng_shen@agilent.com>
Newsgroups: comp.compilers
Date: 20 Oct 2002 22:55:18 -0400
Organization: Agilent Technologies
Keywords: parse, LL(1)
Posted-Date: 20 Oct 2002 22:55:18 EDT

Hello:
    This is supposed to be really simple but I have worked on it for hours
but all generated grammar are ambiguous and I am not sure why.


    This is the grammar


    E->id | &id | (E) | E[int] | E=E


    First of all, can this grammar make LL1? I am not sure.




    What I am doing is:
    Make this production


    E-> E = E


    to


    E -> F = E
    E -> F


    according to algorithms mentioned in textbook.


    Then the resulting grammar is


    E-> F = E
    E -> F


    F -> id| & id | ( E ) | E [ int ]




    then I apply another algorithm to eliminate left-recursions.
    then I apply another algorithm to left-factor this grammar.




  However, I use this tool LellRap to verify my resulted grammar. It is
still ambiguous.


    Can anyone show me how to make it unambiguous?


thanks a lot


tcs


Post a followup to this message

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