0

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 ?

1 Answers1

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