Thu, 16 Aug 2007 23:10:11 +0530

Related articles |
---|

Factoring a Grammar for Predictive Parsers ? j.vimal@gmail.com (Vimal) (2007-08-16) |

Re: Factoring a Grammar for Predictive Parsers ? j.vimal@gmail.com (Vimal) (2007-08-17) |

From: | Vimal <j.vimal@gmail.com> |

Newsgroups: | comp.compilers |

Date: | Thu, 16 Aug 2007 23:10:11 +0530 |

Organization: | Compilers Central |

Keywords: | parse, question |

Posted-Date: | 17 Aug 2007 11:54:50 EDT |

Hi

I have a grammar G generating a language L. To write predictive parsers

for the grammar, I would like to convert the grammar G into an equivalent

grammar G' such that it is easy to "predictively" parse the input and test

for membership.

Q: Is it always possible to do such a conversion?

Q: If possible, I would like to know how to convert this grammar

to help predictive parsers.

S -> {L} | {}

L -> E | E,L

E -> { | } | ,

The grammar generates valid expressions to represent sets. But

its difficult to parse, because, the set can contain { or } or , as an

element. So, this confuses me :(

The predictive parser I would be using (not code one), is Haskell's Parsec.

Thanks!

Vimal

Department of Computer Science and Engineering

Indian Institute of Technology Madras

PS: To the editor: I am not sure if this question is valid in your forum!

I just hope it is not misunderstood as a "Solve my homework" type question :)

I really broke my head on this one, so, some help required!

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.