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$
5
  • $\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
    Commented Dec 3, 2019 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
    Commented Dec 3, 2019 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$ Commented Dec 3, 2019 at 4:25
  • $\begingroup$ Its not an assignment, its exam preparation. $\endgroup$ Commented Dec 3, 2019 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.
    Commented Dec 3, 2019 at 6:12

0

Browse other questions tagged or ask your own question.