Given is the regular grammar
G = ({A,B}, {a,b}, P, A)
with the rulesP : A → aB, a, ε (where ε is the empty word) B → bA, b
For this regular grammar, create an equivalent NFA.
A regular grammar is a 4 tuple G = (N, Σ, P, S)
.
So our NFA is made up of 2 states, A
and B
. The initial state is A
and it's also the ending state because the rule says we have the empty word ε
in the state A
. If we read an a
from state A
, we go to the state B
.
But I don't know what that single a
means in the first rule?
From state B, if we read a b
, we go to state A
. But again, what does this single b
mean in this rule?
All in all I would construct the NFA for the regular grammar G
like that: