in Theory of Computation edited by
3,583 views
2 votes
2 votes

Consider the grammar:
S->aSbS/ bSaS/ ε,
The smallest string for which the grammar has two derivation trees:

  1. abab
  2. aabb
  3. bbaa
  4. aaabbb


and how?

in Theory of Computation edited by
3.6k views

1 comment

In the same way

B. aabb

c. bbaa

Are possible?
0
0

2 Answers

4 votes
4 votes
Best answer

Option A
The smallest string that can be derived is abab

S $\rightarrow$ aSbS $\rightarrow$ a[bSaS]bS , now substitute ε in place of S, we will get 'abab'
S $\rightarrow$ aSbS $\rightarrow$ a[ε]bS $\rightarrow$ ab[aSbS] , now substitue ε in place of S, we will get 'abab'

selected by

1 comment

why can't we simultaneously connect on middle as well as on the right most?
0
0
0 votes
0 votes
(A)abab       as in second level of derivation tree we have 2 choices to connect bSa either on middle S or on rightmost S