22 Sep 2005 23:44:46 -0400

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: | "J.H.Jongejan" <jjan@cs.rug.nl> |

Newsgroups: | comp.compilers |

Date: | 22 Sep 2005 23:44:46 -0400 |

Organization: | RuG |

References: | 05-09-064 |

Keywords: | parse, LL(1) |

Posted-Date: | 22 Sep 2005 23:44:46 EDT |

sky4walk@gmx.de wrote:

*> Hi,*

*> 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)?*

*>*

*> my first and follow list*

*>*

*> First(E) = {a}*

*> First(F) = {c,epsilon}*

*> First(A) = {d}*

*> First(A_1) = {d,epsilon}*

*>*

*> Follow(E) = {}*

*> Follow(F) = {d,b}*

*> Follow(A) = {c,d,b}*

*> Follow(A_1) = {c,d,b}*

*>*

*> sp I see, that in Follow(A_1) and First(A_1) is a problem because of*

*> same terminal 'd'.*

*>*

*> So my question is:*

*>*

*> 1) is my follow list correct?*

*> 2) when 1) is true, why isn't my grammar LL(1), it isn't leftrecursivea*

*> nd how can I change this one?*

Andre,

your follow(A) and follow(A_1) contain 'd', which should

not be there! Hence, this grammar is LL(1).

With kind regards,

Jan Jongejan

Dept. Comp.Sci.,

Univ. of Groningen,

Netherlands.

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.