Safe HaskellSafe

GNFA_

Description

Conversions from DFAs and NFAs

Synopsis

Documentation

single :: Char -> Regexp #

Construct the regexp on an arrow corresponding to a single letter, including ε.

>>> single 'a' == Single 'a'
True
>>> single NFA.emptyStr == Single_ε
True

fromDFA :: Ord a => DFA a -> GNFA Int #

Construct a GNFA from a DFA.

  • ε arrows from the new start state to the old start state
  • ε arrows from the old accept states to the new accept state
  • Construct the regexp arrows, e.g. q_i ->(a,b) q_j turns into q_i ->(a∪b) q_j.

fromNFA :: Ord a => NFA a -> GNFA Int #

Construct a GNFA from an NFA. See fromDFA for a brief description of the process.