Sign up ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Based on this grammar:

\begin{align} G = (\{S,A,B\}, \{a,b, c\}, S, P) \end{align}

\begin{matrix} \\P: \\S → abaS | cA \\A → bA | cB | aa \\B → bB | cA | bb \end{matrix}

I created this NFA:

enter image description here

I'm not sure about $q1 \to q2$ and $q1 \to q3$, if maybe someone can clarify if this is wrong and why.

share|cite|improve this question

1 Answer 1

up vote 3 down vote accepted

It looks okay. The language consists of all words of the form $(aba)^ncwaa$ with $n\ge 0$, $w\in\{b,c\}^*$, and $|w|_a$ even and all words of the form $(aba)^ncwbb$ with $n\ge 0$, $w\in\{b,c\}^*$, and $|w|_a$ odd, where $|w|_a$ is the number of $a$’s in $w$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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