Safe HaskellSafe

Regexp_

Description

Operations on Regexps and conversions from DFAs and NFAs

Synopsis

Documentation

plus :: Regexp -> Regexp #

R+ is shorthand for RR*.

>>> plus (Single 'a')
(a(a*))

exp :: Regexp -> Int -> Regexp #

R^k is shorthand for the concatenation of k R's with each other.

>>> Single '0' `Regexp_.exp` 3
(0(00))

fromDFA :: Ord a => DFA a -> Regexp #

Convert a DNA into a regexp.

>>> fromDFA DFA.dOddOnes -- note the extra '∪ε' at the end, to be simplified
(((1(((1∪0)1)*))((1∪0)∪ε))∪ε)

fromNFA :: Ord a => NFA a -> Regexp #

Convert an NFA into a regexp.

>>> fromNFA NFA.nOddOnes
(((1(((1∪0)1)*))((1∪0)∪ε))∪ε)