3 RE parser provides a simple API to regular expression parsing.
4 It is also able to convert a regular expression into a NFA or a DFA and produce dot files from it.
8 From the `re_parser` directory:
14 ## RE parser in command line
16 RE parser can be used as a command line tool to generate NFA and DFA dot files from a regular expression:
19 ./re_parser "a(b|c)+d*"
22 Will produce the two files `nfa.dot` and `dfa.dot`.
24 These can be directly viwed with `xdot`:
31 Or translated to png images with `dot`:
34 dot -Tpng -onfa.png nfa.dot
35 dot -Tpng -odfa.png dfa.dot
38 See `man dot` for available formats.
40 ## RE parser as a web app
42 RE parser comes with a web app that allow users to submit regular expression and see the resulting NFA and DFA.
44 To run the web app server:
47 ./re_app --host localhost --port 3000
50 The server will be available at <a href='http://localhost:3000'>http://localhost:3000</a>.
52 ## RE parser as a library
54 You can also use RE parser as a library by importing `re_parser`.
61 var re_parser = new REParser
62 var node = re_parser.parse_re(re)
65 print re_parser.last_error.as(not null)
71 var nfa = re_parser.make_nfa(node)
72 print nfa.to_dot(false)
73 print nfa.to_dfa.to_dot(false)
75 Use `to_dot(true)` to merge transitions on characters.