NFA Simulator
Build, edit, and simulate strings in an NFA visualizer
About This Simulation
This NFA simulator lets you build a nondeterministic finite automaton, including ε-transitions, and run strings through it while tracking every state the machine could be in at once.
Features
- Add states, transitions, ε-transitions and accepting states
- Several active states tracked at every step
- ε-closure shown after each symbol
- Accept or reject result for each string
- Pan, zoom and fullscreen editing
Explanation
A nondeterministic finite automaton (NFA) can have several possible next states for the same input symbol, or none, and can move on ε (the empty string) without reading input. An NFA accepts a string if at least one possible path ends in an accepting state.
How it works
- Start with the ε-closure of the start state: the start state plus every state reachable by ε-moves.
- For each input symbol, move every active state along its transitions on that symbol.
- Take the ε-closure of the resulting set of states.
- After the last symbol, accept if any active state is an accepting state.
Why it matters
NFAs are often much smaller and easier to design than DFAs, and regular expressions convert directly into NFAs (Thompson's construction). They are a core part of CSE331 and of how regex engines and compiler lexers work.
Frequently Asked Questions
Are NFAs more powerful than DFAs?
No. Every NFA can be converted into an equivalent DFA with the subset construction, so both recognise exactly the regular languages. The DFA may need up to 2ⁿ states for an n-state NFA.
What is an ε-transition?
A transition the NFA can take without reading any input symbol. It lets the machine be in several states at once and makes it easy to combine smaller automata.
What is the ε-closure of a state?
The set of all states reachable from that state using only ε-transitions, including the state itself.
How do you convert an NFA to a DFA?
Use the subset construction: each DFA state is a set of NFA states. Start with the ε-closure of the NFA start state, and for each symbol compute the ε-closure of all states reachable from the set. A DFA state is accepting if it contains any NFA accepting state.
Topics covered
- Nondeterministic Finite Automaton (NFA)
- Epsilon (ε) Transitions
- ε-Closure
- Regular Languages
- NFA to DFA Conversion
Tags
- nfa
- nondeterministic finite automaton
- epsilon transition
- regular language
Related Simulations
Theory of Computation: Automata and Computability
DFA Simulator
Build, edit, and simulate strings in a DFA visualizer
Theory of Computation: Automata and Computability
State Transition Diagram
Create, edit, and test state machines interactively.
Theory of Computation: Automata and Computability
CFG (Context Free Grammar) Simulator
Interactive Context-Free Grammar parser and derivation visualizer
Theory of Computation: Automata and Computability
TM (Turing Machine) Simulator
Design, edit, and run computations in an interactive Turing Machine simulator

