Related articles |
---|
LL(1) grammar and LL(2) grammar felixmish@usa.net (Felix Mish) (1998-10-17) |
Re: LL(1) grammar and LL(2) grammar tc@charlie.cns.iit.edu (Thomas W. Christopher) (1998-10-18) |
Re: LL(1) grammar and LL(2) grammar os@cs.tu-berlin.de (Olaf Stoyke) (1998-10-21) |
Re: LL(1) grammar and LL(2) grammar mravirala@my-dejanews.com (1998-10-21) |
From: | mravirala@my-dejanews.com |
Newsgroups: | comp.compilers |
Date: | 21 Oct 1998 01:33:53 -0400 |
Organization: | Deja News - The Leader in Internet Discussion |
References: | 98-10-097 |
Keywords: | LL(1), parse |
Felix Mish <felixmish@usa.net> wrote:
> Hello everyone,
> I have such a production which is obviously not a
> LL(1) gramar.
>
> factor:
> TOK_ID
> | TOK_ID "\(" parameters "\)"
> | TOK_NUM
> | "\(" expression "\)"
> | TOK_NOT factor
> | TOK_ID "\[" expression "\]"
>
> But is it possible to make a LL(1) grammar that accepts the same
> language?
>
Hi,
If we left factorize the grammar, then it is possible to make it an LL(1)
grammar. It will, however, introduce an extra non-terminal in the grammar.
factor:
TOK_ID factor'
| TOK_NUM
| "\(" expression "\)"
| TOK_NOT factor
factor' :
"\(" parameters "\)"
| "\[" expression "\]"
| epsilon
Regards,
Murali.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.