| Copyright | (c) João Saraiva 20012002200320042005 2016 | 
|---|---|
| License | LGPL | 
| Maintainer | jas@di.uminho.pt | 
| Stability | provisional | 
| Portability | portable | 
| Safe Haskell | Safe | 
| Language | Haskell98 | 
Language.HaLex.RegExp
Description
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, [sy] -> 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.
Constructors
| Empty | Empty Language  | 
| Epsilon | Empty String  | 
| Literal sy | Literals  | 
| Or (RegExp sy) (RegExp sy) | Disjuncion  | 
| Then (RegExp sy) (RegExp sy) | Sequence  | 
| Star (RegExp sy) | Repetition, possibly zero time  | 
| OneOrMore (RegExp sy) | One or more times (extended RegExp)  | 
| Optional (RegExp sy) | Optional (extended RegExp)  | 
| RESet [sy] | Set (extended RegExp)  | 
cataRegExp :: (re, re, re -> re -> re, re -> re, sy -> re, re -> re -> re, re -> re, re -> re, [sy] -> 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.