-4
$\begingroup$

Need a grammar that can create this language, I am having issues getting a language to work and was looking for help.

$\endgroup$
1
  • $\begingroup$ Hello there 👋, are the $n$s and the $2n$ supposed to be exponents? As in $L = \{a^nb^na^{2n} : n \geq 1\}$? $\endgroup$
    – Knogger
    Commented Mar 18 at 0:55

1 Answer 1

0
$\begingroup$

This is probably not the simplest, but here's a grammar for $L = \{a^nb^na^{2n} : n \geq 1\}$. Let $G = (\{S, A, B\}, \{a, b\}, P, S)$ where $P$ contains exactly

$$S \to aAbaa$$ $$A \to aAbBB | \varepsilon$$ $$Bb \to bB$$ $$Ba \to aa$$

then $L(G) = L$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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