##### What strings are generated by this grammar?

S --> aB S --> bA B --> b A --> a B --> bS A --> aS B --> aBB A --> bAA

what strings is generated by the grammar?

S --> aB S --> bA B --> b A --> a B --> bS A --> aS B --> aBB A --> bAA

what strings is generated by the grammar?

No. Of a's is equal to no. Of b's

By tracing we get set of strings derived from a grammar

ab,abb,abab

@sharmilakarpe

We can't generate abb from given grammar

plz explain how to solve this?

@shraddhagami nd @sharmilakarpe

@karmjitjoshi To solve such problems, try to derive some strings from the given grammar.

how? sir

@karmjitjoshi,

It is clear that string can start from either a or b from these two productions

S --> aB, S --> bA .

Now let's take a string that will start from a.

So we will use production, S --> aB.

We have three choices for B as B -->b, B --> bS, B --> aBB

If we use

B -->b, our string will beab.If we use B --> bS, we will get

abS// Now you can again start with either a or b.If we use B --> aBB, we will get

aaBB. // Now you have again three options for every B.But, In every case you have equal count of of

aandb.Similary, you can check for the strings starting from

bas well.thanks a lot @sumitverma sir for this wonderful explanation