1

Design the grammar for the following: L = (a^n)w(w^r)(b^n) where n>=0 and w={a,b}

1 Answers1

0

The answer goes something like this

S->ε/ aSb

S->A

A->ε/ aAa / bAb

here is a sample string for the above with proof

aabaabbb

S=>aSb

S=>aaSbb

S=>aaAbb

S=>aabAbbb

S=>aabaAabbb

S=>aabaεabbb

S=>aabaabbb

here above symbol ε is epsilon