Skip to content

NicklasBoto/brzozowski

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library for constructing generalized regular expressions (and more, in the future).

Examples

We can construct a simple regex saying that santas has many ho's, that is one or more.

>>> santa = many "ho"
>>> "hohoho" ^- santa
^((ho)+|ε)$

Deriving santa with respect to three ho's, gives us a regex matching remaining possible strings that also match santa. Seeing that (ho)+ | ε is saying zero or more ho's, we can further reduce this to (ho)*. It is easy to see that this regex contains the empty string but the ? function will tell you nonetheless.

>>> "hohoho" ? santa
True

We can also demonstrate some strings that do not match.

>>> "hahaha" ^- santa
^∅$
>>> "hahaha" ? santa
False
>>> -- santa does not laugh
>>> "" ^- santa
^(ho)+$
>>> "" ? santa
False
>>> -- santa needs at least one ho

About

Haskell library for formal language theory

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published