python/JS/C++/CLI interface for converting regexes to AT&T FSTs
C++ Python Shell JavaScript Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
npm
src
tests
third_party
vagrant
.gitignore
.travis.yml
LICENSE
Makefile.in
Manifest.in
README
README.md
configure
configure.ac
regex2dfa.py
regex2dfa_build.py
setup.py
tests.py

README.md

regex2dfa

Build Status

This is a command-line utility that converts a regular expression to a DFA.

  • input: A perl-compatible regular expression, as defined by re2 [1].
  • output: An AT&T DFA [2], which accepts an equivelent language to the input regular expression.

References

Building

This utillity requires standard build tools: autoconf, make, gcc, etc.

Once you have your developement environment setup:

$ ./configure
$ make
$ ls bin/
regex2dfa

Example Usage

Command-line

$ ./bin/regex2dfa -r "^(a|b)*$"
0   0   97  97
0   0   98  98
0
$ ./bin/regex2dfa -r "^(a|b)+$"
0   1   97  97
0   1   98  98
1   1   97  97
1   1   98  98
1

C++ API

#include "regex2dfa.h"

...
std::string input_regex = "^(a|b)*$"; 
std::string minimized_dfa;
bool success = regex2dfa::Regex2Dfa(input_regex, &minimized_dfa);
std::cout << minimized_dfa << std::endl;
...

will output

0       0       97      97
0       0       98      98
0