Cheap and Secure Web Hosting Provider : See Now

Design the grammar for the following

, , No Comments
Problem Detail: 

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

Asked By : Mohammed Shadab
Answered By : Vishal Kalwapalli

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

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/56397

3200 people like this

 Download Related Notes/Documents

0 comments:

Post a Comment

Let us know your responses and feedback