NFA from grammar productions

243 Views Asked by At

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.

1

There are 1 best solutions below

0
On BEST ANSWER

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