1,052 views
3 votes
3 votes
As Type(3)/Regular grammars are form of left linear or right linear ,

Now suppose i have two grammars,G1 and G2 which are generating left linear and right linear grammars respectively.And now my new Grammar G :- has one production as S->S1|S2(where S1 and S2 are productions from G1 and G2)

Now my G is context free and it has both left and right linear.But we also know that regular union is regular.So what can be concluded from this scenario ?

1 Answer

1 votes
1 votes
This property of Regular languages come from regular expressions.We can write regular expression for every regular language so we can argue as regular expressions are closed under addition hence language generated by these regex will surely be regular.Whereas grammar is concerned you need to be bit cautious while making the same argument as union of grammars my not give you regular language so how to make a valid argument.As you might be knowing that for a regular language you can generate different different grammars.So I can argue that I will generate either Right linear grammars or left linear grammar for both the regular languages & then I will perform union.So resultant grammar will surely be regular.

If in exam such question on grammar is asked so answer would be union of 2 regular grammars may or may not be regular as they need to be compatible in terms of linearity.

Related questions

7.1k
views
2 answers
7 votes
pC asked Jul 23, 2016
7,059 views
How to convert a Regular Expression to Left Linear Grammar ?Eg : (0+1)*00(0+1)*
1.3k
views
1 answers
1 votes
rahul sharma 5 asked Aug 6, 2017
1,285 views
Which of the following grammars are equivalent?S is non terminal ,e is epsilon,a is terminal1. S-> aS |e2. S-> aS | a |e3. S-> aaS |e
537
views
1 answers
0 votes