in Theory of Computation edited by
1,489 views
0 votes
0 votes

Which of the regular expressions corresponds to this grammar ?

$S → AB/AS, A → a/aA, B → b$

  1. $aa^*b^+$

  2. $aa^*b$

  3. $(ab)^*$

  4. $a(ab)^*$

in Theory of Computation edited by
1.5k views

1 Answer

0 votes
0 votes
S->AB|AS,  A->a/aA,  B->b (b will appear exactly  once so option A,C, D are out)

S->AB->ab (smallest string )

or

S->AB->aAb->aaAb...   and so on  aa*b

or S->AS->AAS->AAAS.... so on  aa*b

option B is the ans

2 Comments

why not A?
0
0
as mentioned  option A  will contain any number of b (1,2,3,.)  , while given grammar can produce only one b
0
0