Re: Is this an LL(1) Grammar ?

Alan Southall <alan.southall@bk.bosch.de>
24 Mar 1998 22:42:11 -0500

          From comp.compilers

Related articles
Is this an LL(1) Grammar ? martin_mf@hotmail.com (Martin) (1998-03-22)
Re: Is this an LL(1) Grammar ? alan.southall@bk.bosch.de (Alan Southall) (1998-03-24)
Re: Is this an LL(1) Grammar ? joachim.durchholz@munich.netsurf.de (Joachim Durchholz) (1998-03-24)
Re: Is this an LL(1) Grammar ? bmcsweeney@bigfoot.com (1998-03-30)
Re: Is this an LL(1) Grammar ? cfc@world.std.com (Chris F Clark) (1998-04-03)
| List of all articles for this month |
From: Alan Southall <alan.southall@bk.bosch.de>
Newsgroups: comp.compilers
Date: 24 Mar 1998 22:42:11 -0500
Organization: Bosch Telecom
References: 98-03-207
Keywords: parse, LL(1)

Martin wrote:
> My CFG grammar can accept:
> a = b = 1;
> and
> a = b;
>
> Is it LL(1)? Yes? How I can make it LL(1)?


I don't know if I have understood your question properly, as
the notation you have used is not familar to me, but here
goes anyway. If you mean is the following BNF LL(1):


        prod ::= a = b = 1;
                          | a = b;


Then the answer in no. The reason for this is that LL(1)
requires the first token in production alternatives to be
unique. Therefore, using your example the parser will not
know which option in the production it must take. The
following is LL(1):


        prod ::= a = b prod`


        prod` ::= = 1;
                            | ;


P.S. Have a look in the "Dragon Book" - it covers topics
like this rather well.


Regards,
Alan.
--


Post a followup to this message

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