Left-linear grammar from union of 2 languages

  • Thread starter Thread starter francisg3
  • Start date Start date
  • Tags Tags
    Union
AI Thread Summary
The discussion focuses on creating a left-linear grammar from the union of two languages defined by grammars G1 and G2. G1 is identified as a regular right-linear grammar that can be converted to left-linear, while G2 presents challenges due to its non-linear structure. A participant successfully converts G1 into a left-linear format but struggles with G2. Suggestions include listing words from each language to identify patterns that may aid in the conversion process. The conversation emphasizes the complexities of transforming non-linear grammars into left-linear forms.
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?
 

Similar threads

Replies
24
Views
4K
Replies
13
Views
3K
Replies
28
Views
6K
Replies
3
Views
2K
4
Replies
175
Views
25K
Back
Top