Module RegExp

A library to defines a structure of regular expressions and a simple match operation for regular expressions. This library is used to translate integrated code in the form of POSIX extended regular expressions into Curry programs.

Author: Jasper Sikorra

Version: November 2020

Summary of exported operations:

match :: Ord a => [ORegExp a] -> [a] -> Bool  Deterministic 
The match function is used to match lists with regular expressions

Exported datatypes:


RegExp

Data type for regex representation in Curry

Type synonym: RegExp a = [ORegExp a]


ORegExp

Constructors:

  • Nil :: ORegExp a
  • Literal :: a -> ORegExp a
  • Xor :: (RegExp a) -> (RegExp a) -> ORegExp a
  • Star :: (RegExp a) -> ORegExp a
  • Plus :: (RegExp a) -> ORegExp a
  • AnyLiteral :: ORegExp a
  • Bracket :: [Either a (a,a)] -> ORegExp a
  • NegBracket :: [Either a (a,a)] -> ORegExp a
  • Start :: (RegExp a) -> ORegExp a
  • End :: (RegExp a) -> ORegExp a
  • Times :: (Int,Int) -> (RegExp a) -> ORegExp a

Exported operations:

match :: Ord a => [ORegExp a] -> [a] -> Bool  Deterministic 

The match function is used to match lists with regular expressions

Example call:
(match r s)
Parameters:
  • r : The regular expression
  • s : The input list