1.

Give a production grammar for the language L = {x/x ∈ (a,b)*, the number of a’s in x is multiple of 3}.(a) {S->bS, S->b,S->aA, S->bA, A->aB, B->bB, B->aS, S->a}(b) {S->aS,S->bA,A->bB,B->bBa,B->bB}(c) {S->aaS,S->bbA,A->bB,B->ba}(d) None of the mentionedI got this question by my college professor while I was bunking the class.My doubt stems from Regular Grammar in chapter Contextfree Grammar and Syntax Analysis of Compiler

Answer»

Right OPTION is (a) {S->BS, S->B,S->aA, S->bA, A->AB, B->bB, B->aS, S->a}

The explanation: The above given condition is satisfied by

S->bS S->B

S->aA s->bA A->aB B->bB

B->aS S->a.



Discussion

No Comment Found

Related InterviewSolutions