If I want to find the reversal of a regular expression using an automata, Do I have to transform the automata to DFA if it wasn't ?
Asked
Active
Viewed 68 times
0
-
Colleague Vor has demonstrated that inverse (mirror image) of the language of a regular expression can be found by merely inverting the expression itself. So why would you use the automaton? – Hendrik Jan Jul 26 '21 at 19:45
1 Answers
1
No. Represent your automata as a directed graph where each edge is labelled as a symbol of the alphabet. Then:
- Reverse all edges.
- Change the former initial state to an non-initial accepting state.
- Add a new initial state $q_0$, and add a transition (edge) $q_0 \overset{\varepsilon}{\to}q$ towards every state (vertex) $q$ that formerly was an accepting state.
This works even if the starting automata is a NFA.

Steven
- 29,419
- 2
- 28
- 49