Re: predictive parsing

"" <>
19 Feb 2006 11:02:58 -0500

          From comp.compilers

Related articles
predictive parsing (j0mbolar) (2006-02-19)
Re: predictive parsing ( (2006-02-19)
Re: predictive parsing (Ulrich Hobelmann) (2006-02-19)
| List of all articles for this month |

From: "" <>
Newsgroups: comp.compilers
Date: 19 Feb 2006 11:02:58 -0500
References: 06-02-139
Keywords: parse
Posted-Date: 19 Feb 2006 11:02:58 EST

This looks very much like the sort of problem i'd give students in
tutorials, so i have some misgivings...

Your first problem is that you have an ambiguous grammar (at LL(1)) so
you need to fix any productions with a common prefix, so
A -> C | CA | D | DA
A -> C A1 | D A2
A1 -> A | e
A2 -> A | e

where e means epsilon.
At this point all that is necessary is to do is remove the epsilon
transitions and all will be well.

You could in fact take this grammar all the way through to CNF, but
that's probably excessive...

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.