0
$\begingroup$

I am able to form the regular expression but I am not confident with the grammar. I have tried the following:

S-->aaaS|bS|b|lambda

Regular expression is given by:

b* +(ab*ab*ab*)*

Somebody please guide me.

Zulfi.

$\endgroup$
  • $\begingroup$ How to convert a regular expression to a CFG. Your question might be better if you include the regular expression which you think answers the assignment. $\endgroup$ – rici Dec 3 '19 at 3:09
  • 1
    $\begingroup$ Please edit the question instead of adding details in a comment. As you can see, formatting characters often make comments unreadable. Anyway, that regular expression is (probably) correct or almost correct but the CFG in your question is quite different. See the link in my previous comment. $\endgroup$ – rici Dec 3 '19 at 4:16
  • $\begingroup$ Sorry, this is not CFG question: Give a regular expression for L on Σ ={a,b},where L={w|na(w) mod 3=0}. $\endgroup$ – user2994783 Dec 3 '19 at 4:25
  • $\begingroup$ Its not an assignment, its exam preparation. $\endgroup$ – user2994783 Dec 3 '19 at 4:43
  • 1
    $\begingroup$ Descriptions of how to convert a regular expression to a NFA are well-documented, as are descriptions of how to convert automata to a grammar. This should be in any decent textbook. It's also easy to convert a grammar to a grammar directly $\endgroup$ – D.W. Dec 3 '19 at 6:12