Left-linear grammar from union of 2 languages

  • Thread starter Thread starter francisg3
  • Start date Start date
  • Tags Tags
    Union
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
francisg3
Messages
31
Reaction score
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
 
Physics news on Phys.org
Hi francisg3! :smile:

Hmm, from your first S1 I would conclude that abbabb is in L(G1).
However, it's not in your second S1...

Have you tried listing a number of words of each language?
See if there's a pattern?