- #1
francisg3
- 32
- 0
Consider the regular gramma G1 (seen below as S1) and the grammar G2 (seen below as S2). Give a left-linear grammar of L(G1) U L(G2)
S1->abA
A->baB
B->aA | bb
S2->AS2 | λ
A->aaB
B->bB | ab
I know that S1 is a regular right-linear grammar which can be changed into a left-linear grammar easily. I am having trouble with the second grammar which seems to be non-linear.
I was able to convert the first grammar into a left-grammar (seen below) however I do not know what to do with the second non-linear grammar.
S1->Aba
A->Bab
B->Aa | bb
S1->abA
A->baB
B->aA | bb
S2->AS2 | λ
A->aaB
B->bB | ab
I know that S1 is a regular right-linear grammar which can be changed into a left-linear grammar easily. I am having trouble with the second grammar which seems to be non-linear.
I was able to convert the first grammar into a left-grammar (seen below) however I do not know what to do with the second non-linear grammar.
S1->Aba
A->Bab
B->Aa | bb