|
|
|
|
|
by jlarocco
566 days ago
|
|
I'm sure a lot of people here have much better examples, but I wrote some basic regular expression and finite automata algorithms in Haskell a long time ago: https://github.com/jl2/Compiler-Algorithm-Code/tree/master/h... I tried it out and after renaming fold -> foldr, it still builds and seems to work. The main function takes a regex as a command line argument and creates a finite automata graph using GraphViz's dot. In the Compiler-Algorithm-Code/haskell directory: make
./test "(foo)+(bar)*(foo+)" | dot -Tpdf -ofoobarfoo.pdf && xdg-open foobarfoo.pdf
|
|