-- Mar 25 In-Class Exercise
Hamir here.
Here is how I would convert the context-free grammar S -> SS | (S) | a into Greibach Normal Form.
We add a new variable N and add the rules S -> (S)N, N -> S, and N -> SN.
We also add a new variable O and add the rules S -> aO, O -> S, and O -> SO.
The context-free grammar now appears as follows:
S -> (S) | a | (S)N | aO
N -> S | SN
O -> S | SO.
And, I'm not sure where I should go from here. What should I do next?
Hamir here.
Here is how I would convert the context-free grammar S -> SS | (S) | a into Greibach Normal Form.
We add a new variable N and add the rules S -> (S)N, N -> S, and N -> SN.
We also add a new variable O and add the rules S -> aO, O -> S, and O -> SO.
The context-free grammar now appears as follows:
S -> (S) | a | (S)N | aO
N -> S | SN
O -> S | SO.
And, I'm not sure where I should go from here. What should I do next?