Skip to content
Tape‑n‑Trace
PracticeSearch 26 tools

← All conversions

Regular grammar → NFA

Each variable becomes a state and each production becomes a move.

Beyond the syllabusThis topic is not in the prescribed text and is not examined on this course. It is here because it is worth knowing, not because you need it.
S → 0S | 1S | 0A
A → 1B
B → ε

Result · NFA

3 of 3 states
SAB

Working

5 rows
The grammar. Each production is one move of the automaton.
#HeadBody
1S0S
2S1S
3S0A
4A1B
5Bε

Each variable becomes a state, starting at S. Each production becomes a move.

The answer appears at the last step. if you would rather read it than watch it.

How to read itBeyond the prescribed text — see docs/citations.md
  • A → aB reads a and moves to B. A → a reads a and finishes. A → ε makes A accepting.
  • A right-linear grammar and an NFA are the same object written two ways.
  • This topic is not in Hopcroft 2e and is not examined on this course — it is here as enrichment.