# NFA from grammar productions

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:

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

-

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$.