Consider the following grammar G:
S ➝ A B C | A C | A | B
A ➝ a
B ➝ b C | a
C ➝ c D
D ➝ d A
Recall that a non-terminal A is generating if A =>* w holds for some string w of terminals. In other words, a non-terminal A can generate a string of terminals. This does not always hold. For example, if the only rule of a grammar is S ➝ a S, then S is not generating.
For the grammar G above, the generating non-terminals are:
- A, B, C, and D
- A and B
- A, B, and S
- None