Factoring a Grammar for Predictive Parsers ?
- From: Vimal <j.vimal@xxxxxxxxx>
- Date: Thu, 16 Aug 2007 23:10:11 +0530
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!
.
- Prev by Date: OOPS 2008 Call for Papers (Brazil, Mar 08)
- Next by Date: Re: Vector assignment semantics (was Re: latest trends in compiler optimization research?)
- Previous by thread: OOPS 2008 Call for Papers (Brazil, Mar 08)
- Next by thread: Re: Factoring a Grammar for Predictive Parsers ?
- Index(es):