Building NFA from Regular Grammars- Examples
Example:
Grammar
We’ll use the standard construction:
-
One NFA state per nonterminal plus a fresh final state .
-
For each rule : add a transition .
-
For each rule (terminal only): add .
-
Start state is the start nonterminal ().
-
Accepting states: (no -rules here, so neither nor is accepting).
NFA
-
States
-
Alphabet
Start -
Accepting
Transitions :
-
From :
-
on a → (from )
-
on b →
-
-
From :
-
on a → (from )
-
on b → (from and )
-
-
From :
-
on a → , on b → (no outgoing rules)
-
Comments
Post a Comment