1
$\begingroup$

This below language

$$L = \{ w \in \{a, b\}^n : \lvert w\rvert \text{ mod } 3 = 0 \}$$ where $n \geq0$.

$\endgroup$

closed as unclear what you're asking by xskxzr, Evil, Discrete lizard Oct 9 at 16:57

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ Could you design a CFG for a language where each string had length exactly three? If so, it's just a tiny modification to get what you want. $\endgroup$ – Rick Decker Oct 8 at 18:53
0
$\begingroup$

Since this seems very much like homework, i will give you a little Hint, taking as example a sub-case of your language:

The GFC for the string $a^3b^3$ is the following:

$S ⇒ aSb$

$aSb ⇒ aaSbb$

$aaSbb ⇒ aaaSbbb$

$aaaSbbb ⇒ aaabbb$

You can take the above as a starting point from which to adapt the grammar to your case.

$\endgroup$
  • $\begingroup$ Thank you very much $\endgroup$ – Abhimanyu Bansal Oct 27 at 7:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.