Get the contextfree grammars for the following languages a a

Get the context-free grammars for the following languages:

(a) {abnabna : n 0}

(b) {an bmck : k = m + n}

(c) {an bm am bn : m, n 0}

(d) {ai bj ck : i = j or i = k}

Solution

a) S->aSaSa/b

b) S->ABCC

A->aA/a

B->bB/b

c->cC/c

c) S->BAC

A ->BA/ba

B->aA/a

c->bB/b

d) S->AC/BC

A->AB/a

B->BC/b

C->c

  

Get the context-free grammars for the following languages: (a) {abnabna : n 0} (b) {an bmck : k = m + n} (c) {an bm am bn : m, n 0} (d) {ai bj ck : i = j or i =

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site