Consider the grammars:
G1: S → SaS | aa | a
G2: S → SS | ε
G3: S → SS | a
G4: S → SS | aa
G5: S → Sa | a
G6: S → aSa | aa | a
G7: S → SAS | ε
Describe the language of each of these grammars. Then, identify from the list below a pair of grammars that define the same language.
a) G1, G5
b) G5, G7
c) G6, G4
d) G1, G2
I couldn’t understant. Tried many ways. plz explain what is the answer and how? Thanks!!!!!!!!!!!
Expert Answer
in the question, we need to change the left side alphabet to one of the right side everytime.
G1 and G5 are defining same language as we can convert s to any variable in G1 and G2 and we are getting same results every time. but in other two the variables are different hence not same in every case. in G6 and G4
IN G6 if s is replaced by aSa and then s is replaced by a then wwe cannot derrive this solution in case of G4 hence not same grammar.
hence answer is a)G1,G5