Module RegExpSem

Summary of exported operations:

plus :: RE a -> RE a  Deterministic 
We can extend the language of regular expressions by standard abstractions.
sem :: RE a -> [a]  Non-deterministic 
The semantics of regular expressions can be defined as a nondeterministic operation associating any word of the language defined by the regular expression:
match :: Data a => RE a -> [a] -> Bool  Non-deterministic 
An operation to match a string against a regular expression can be defined by the following constraint:
grep :: Data a => RE a -> [a] -> Bool  Non-deterministic 
grepShow :: Data a => RE a -> [a] -> [a]  Non-deterministic 
The following operation extends the operation grep to return the substring which starts with the regular expression.
grepPos :: Data a => RE a -> [a] -> Int  Non-deterministic 
The following operation extends the operation grep to return the position where the matched regular expression starts.

Exported datatypes:


RE

A data type to represent regular expression over some alphabet. A regular expression is either a literal, i.e., a member of the alphabet, an choice between two regular expressions, the concatenation of two regular expressions, or the repetition of a regular expression.

Constructors:

  • Lit :: a -> RE a
  • Alt :: (RE a) -> (RE a) -> RE a
  • Conc :: (RE a) -> (RE a) -> RE a
  • Star :: (RE a) -> RE a

Exported operations:

plus :: RE a -> RE a  Deterministic 

We can extend the language of regular expressions by standard abstractions. Here we introduce an operator denoting at least one or more repetitions of a regular expression:

Further infos:
  • solution complete, i.e., able to compute all solutions

sem :: RE a -> [a]  Non-deterministic 

The semantics of regular expressions can be defined as a nondeterministic operation associating any word of the language defined by the regular expression:

Further infos:
  • solution complete, i.e., able to compute all solutions

match :: Data a => RE a -> [a] -> Bool  Non-deterministic 

An operation to match a string against a regular expression can be defined by the following constraint:

grep :: Data a => RE a -> [a] -> Bool  Non-deterministic 

grepShow :: Data a => RE a -> [a] -> [a]  Non-deterministic 

The following operation extends the operation grep to return the substring which starts with the regular expression.

grepPos :: Data a => RE a -> [a] -> Int  Non-deterministic 

The following operation extends the operation grep to return the position where the matched regular expression starts.