Skip to content

Haskell parser for Regular Expressions based on Parser Combinators and without the usage of any external library

Notifications You must be signed in to change notification settings

RaffaeleGalliera/regex-parser-kozelinator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Regular Expressions Parser

Print the AST (Abstract Syntax Tree) of Regular Expressions taken in input from a file with every RegExp separed by new lines.

RegExp should be a data structured like:

data RegExp
    = Epsilon
    | Term Char
    | Star RegExp
    | Concatenation RegExp RegExp
    | Union RegExp RegExp

As terminal symbols we kept all the lower case letters and digits.

Given a string "a*(b+d)*" the program should build an AST like

Concatenation (Star (Term 'a')) (Star (Union (Term 'b') (Term 'd')))

Compile and try it with the example file "regex.txt".

About

Haskell parser for Regular Expressions based on Parser Combinators and without the usage of any external library

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published