13 views
What will be the language generated by the following grammar ?

S → 0S1S / 1S0S/E

P.S. – E is Epsilon
| 13 views

+1 vote
Each production on right hand side generates either $2$ alphabets or an epsilon,

Further more, for each production there's always $1$ generated for every $0$ we generate, and vice versa.

So the language accepted by the grammar should be

$L(G) = \{w | w \in \{0,1\}^*, n_0(w) = n_1(w) \}$

where,

$n_0 =$ number of occurances of $0$ in $w$.

$n_1 =$ number of occurances of $1$ in $w$.

So, in poor terms, it's a language of equal number of zeros and ones.
by (305 points)
0
Can you help me by drawing it's parse tree ? @toxicdesire