fst-0.10.0.1: Finite state transducers

FST.RegTypes

Description

Functions for constructing a simplified regular expression.

Synopsis

# Type classes

class Combinators a where Source

Combinators. The regular expressions are simplified while combined.

Methods

(<|>) infixl 4 Source

Arguments

 :: a -> a -> a Union

(|>) infixl 5 Source

Arguments

 :: a -> a -> a Concatenation

Arguments

 :: a -> a Kleene's star

Arguments

 :: a -> a Kleene's plus

Arguments

 :: a Empty language

Instances

 Eq a => Combinators (Reg a) Eq a => Combinators (RReg a)

class Symbols f where Source

Type class for the collection of symbols in an expression.

Methods

Arguments

 :: Eq a => f a -> [a] Collect the symbols in a regular expression.

Instances

 Symbols Reg Symbols RReg

# Types

data Reg a Source

Data type for a regular expression.

Constructors

 Empty Epsilon 0 All ? Symbol a a (Reg a) :|: (Reg a) r1 | r2 (Reg a) :.: (Reg a) r1 r2 (Reg a) :&: (Reg a) r1 & r2 Complement (Reg a) ~[ r1 ] Star (Reg a) r2 *

Instances

 Symbols Reg Eq a => Eq (Reg a) Show a => Show (Reg a) Eq a => Combinators (Reg a)

# Combinators

(<&>) :: Eq a => Reg a -> Reg a -> Reg a infixl 3 Source

Intersection

(<->) :: Eq a => Reg a -> Reg a -> Reg a infixl 3 Source

Minus. Definition A - B = A & ~B

complement :: Eq a => Reg a -> Reg a Source

Complement

reversal :: Eq a => Reg a -> Reg a Source

Reverse the language denoted by the regular expression.

allFree :: Eq a => Reg a -> [a] -> Reg a Source

Construct a ?-free regular expression with respect to an alphabet [a]

# Constructors

s :: a -> Reg a Source

Symbol

eps :: Reg a Source

Epsilon

All symbol

allToSymbols :: Eq a => [a] -> Reg a Source

Transform the `all` symbol to union over alphabet. ? -> [a|..] with respect to an alphabet [a]

# Query functions

acceptEps :: Eq a => Reg a -> Bool Source

Examines if a regular expression accepts the empty string.