Related articles |
---|
Is this grammar LL(1) ? sky4walk@gmx.de (2005-09-17) |
Re: Is this grammar LL(1) ? DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2005-09-22) |
Re: Is this grammar LL(1) ? jjan@cs.rug.nl (J.H.Jongejan) (2005-09-22) |
From: | Hans-Peter Diettrich <DrDiettrich@compuserve.de> |
Newsgroups: | comp.compilers |
Date: | 22 Sep 2005 23:42:04 -0400 |
Organization: | Compilers Central |
References: | 05-09-064 |
Keywords: | parse, LL(1) |
Posted-Date: | 22 Sep 2005 23:42:04 EDT |
sky4walk@gmx.de wrote:
> i've a question about this grammar
>
> E->'a',F,A,F,'b'.
> F->'c',F | epsilon.
> A->'d',A_1.
> A_1->'d',A_1 | epsilon.
>
> is this grammar LL(1)?
IMO your grammar syntax is not very appropriate for LL(1), in detail
the epsilon's lead to confusion. Using an EBNF with optional elements
and recursion would be more appropriate instead. Have a look at
CoCo/R, for some more appropriate grammar representation.
I'd rewrite this grammar as:
E -> 'a' F A F 'b'.
F -> { 'c' }. //or F -> ('c')*.
A -> 'd' { 'd' }. //or A -> ('d')+.
DoDi
Return to the
comp.compilers page.
Search the
comp.compilers archives again.