Copyright | (c) João Saraiva 2001,2002,2003,2004,2005 |
---|---|
License | LGPL |
Maintainer | jas@di.uminho.pt |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell98 |
Regular Expressions in Haskell.
Code Included in the Lecture Notes on Language Processing (with a functional flavour).
- data RegExp sy
- cataRegExp :: (re, re, re -> re -> re, re -> re, sy -> re, re -> re -> re, re -> re, re -> re) -> RegExp sy -> re
- matchesRE :: Eq sy => RegExp sy -> [sy] -> Bool
- matches' :: Eq sy => RegExp sy -> [sy] -> Bool
- sizeRegExp :: RegExp sy -> Int
- showRE :: Show sy => RegExp sy -> [Char]
- simplifyRegExp :: Eq sy => RegExp sy -> RegExp sy
- extREtoRE :: RegExp sy -> RegExp sy
Data type with recursion pattern
Type of regular expressions.
cataRegExp :: (re, re, re -> re -> re, re -> re, sy -> re, re -> re -> re, re -> re, re -> re) -> RegExp sy -> re Source #
Catamorphism induced by the RegExp
inductive data type
Matching
Size
Compute the size of a regular expression. We define the size of a regular expression as the number of occurrences of symbols of the alfabeth
Printing
Print regular expression to String as a catamorphism. A straightforward (catamorphic) show function.
(it produces too many brackets, making it difficult to read or understand the expression)
Simplification
simplifyRegExp :: Eq sy => RegExp sy -> RegExp sy Source #
Simplify regular expressions according to the algebra of regular expressions.