|predictive parsing firstname.lastname@example.org (j0mbolar) (2006-02-19)|
|Re: predictive parsing email@example.com (firstname.lastname@example.org) (2006-02-19)|
|Re: predictive parsing email@example.com (Ulrich Hobelmann) (2006-02-19)|
|Date:||19 Feb 2006 11:02:58 -0500|
|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...
Return to the
Search the comp.compilers archives again.