next up previous
Next: Is the grammar G (or Up: Elements of Answers for Exercise Previous: Leftmost derivation and rightmost derivation

Is the grammar G left recursive?

Yes, because of the production E  $ \longmapsto$  E $ \bf ,$ S. Observe that from G we see that E is a sequence of S's seperated by commas, with at least one S. So we just need to swap E and S in the last rule to remove the left recursivity.
S $ \longmapsto$ $ \bf a$
S $ \longmapsto$ L
L $ \longmapsto$ ()
L $ \longmapsto$ (E)
E $ \longmapsto$ S
E $ \longmapsto$ S , E


next up previous
Next: Is the grammar G (or Up: Elements of Answers for Exercise Previous: Leftmost derivation and rightmost derivation
Marc Moreno Maza
2004-12-01