| ||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||
Description | ||||||||||||||||||||||||||||||||||||||
A module for regular expression matching based on derivatives of regular expressions. The code was taken from Joe English (http://www.flightlab.com/~joe/sgml/validate.html). Tested and extended by Martin Schmidt. Further references for the algorithm: Janusz A. Brzozowski. Derivatives of Regular Expressions. Journal of the ACM, Volume 11, Issue 4, 1964. Mark Hopkins. Regular Expression Package. Posted to comp.compilers, 1994. Available per FTP at ftp://iecc.com/pub/file/regex.tar.gz. Version : $Id: RE.hs,v 1.1 20040902 19:12:03 hxml Exp $ | ||||||||||||||||||||||||||||||||||||||
Synopsis | ||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||
Documentation | ||||||||||||||||||||||||||||||||||||||
data RE a | ||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||
re_unit :: RE a | ||||||||||||||||||||||||||||||||||||||
Constructs a regular expression for an empty sequence.
| ||||||||||||||||||||||||||||||||||||||
re_zero :: String -> RE a | ||||||||||||||||||||||||||||||||||||||
Constructs a regular expression for an empty set.
| ||||||||||||||||||||||||||||||||||||||
re_sym :: a -> RE a | ||||||||||||||||||||||||||||||||||||||
Constructs a regular expression for accepting a symbol
| ||||||||||||||||||||||||||||||||||||||
re_rep :: RE a -> RE a | ||||||||||||||||||||||||||||||||||||||
Constructs an optional repetition (*) of a regular expression
| ||||||||||||||||||||||||||||||||||||||
re_plus :: RE a -> RE a | ||||||||||||||||||||||||||||||||||||||
Constructs a repetition (+) of a regular expression
| ||||||||||||||||||||||||||||||||||||||
re_opt :: RE a -> RE a | ||||||||||||||||||||||||||||||||||||||
Constructs an option (?) of a regular expression
| ||||||||||||||||||||||||||||||||||||||
re_seq :: RE a -> RE a -> RE a | ||||||||||||||||||||||||||||||||||||||
Constructs a sequence (,) of two regular expressions
| ||||||||||||||||||||||||||||||||||||||
re_alt :: RE a -> RE a -> RE a | ||||||||||||||||||||||||||||||||||||||
Constructs an alternative (|) of two regular expressions
| ||||||||||||||||||||||||||||||||||||||
re_dot :: RE a | ||||||||||||||||||||||||||||||||||||||
Constructs a regular expression for accepting any singel symbol
| ||||||||||||||||||||||||||||||||||||||
checkRE :: Show a => RE a -> String | ||||||||||||||||||||||||||||||||||||||
Checks if an input matched a regular expression. The function should be called after matches. Was the sentence used in matches in the language of the regular expression? -> matches e s == s `in` L(e)?
| ||||||||||||||||||||||||||||||||||||||
matches :: (Eq a, Show a) => RE a -> [a] -> RE a | ||||||||||||||||||||||||||||||||||||||
Derives a regular expression with respect to a sentence.
| ||||||||||||||||||||||||||||||||||||||
nullable :: Show a => RE a -> Bool | ||||||||||||||||||||||||||||||||||||||
Checks if a regular expression matches the empty sequence. nullable e == [] `in` L(e) This check indicates if a regular expression fits to a sentence or not.
| ||||||||||||||||||||||||||||||||||||||
printRE :: Show a => RE a -> String | ||||||||||||||||||||||||||||||||||||||
Constructs a string representation of a regular expression.
| ||||||||||||||||||||||||||||||||||||||
Produced by Haddock version 2.1.0 |