5 Jan 2002 01:31:12 -0500

Related articles |
---|

LL(1) parser table hyperarien@yahoo.com (2002-01-05) |

Re: LL(1) parser table gsc@zip.com.au (Sean Case) (2002-01-07) |

Re: LL(1) parser table dr_feriozi@prodigy.net (SLK Parsing) (2002-01-13) |

Re: LL(1) parser table kaarthik@cisco.com (Kaarthik) (2002-01-13) |

Re: LL(1) parser table kaarthik@cisco.com (Kaarthik) (2002-01-13) |

Re: LL(1) parser table hyperarien@yahoo.com (2002-01-14) |

From: | hyperarien@yahoo.com (lee) |

Newsgroups: | comp.compilers |

Date: | 5 Jan 2002 01:31:12 -0500 |

Organization: | http://groups.google.com/ |

Keywords: | parse, LL(1), question |

Posted-Date: | 05 Jan 2002 01:31:12 EST |

Hi all,

I am trying construct a LL1 parser table for the following grammar.

S -> E

E -> ++E | E++ | E-E | E/E | id

where symbols have usual meanings.

However in the final table this grammar seems to be ambiguous. I

actually first transformed the above into this disambiguous form.

S -> E

E -> E-T | T

T -> T/F | F

F -> F++ | G

G -> ++E | id

And after that I removed all left-recursions.

S -> E

E -> TE'

E'-> -TE'

E'-> epsilon

T -> FT'

T'-> /FT'

T'-> epsilon

F -> GF'

F'-> ++F'

F'-> epsilon

G -> ++E

G -> id

Still after all this grammar is ambiguous. Because F' FOLLOW set is

{/,-,++,$} and there are two entries for [F',++] comination.

Does this means the above grammar is not suitable for LL1 parsing?

thanks in advance...

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.