GithubHelp home page GithubHelp logo

kpdyer / regex2dfa Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 2.0 3.34 MB

python/JS/C++/CLI interface for converting regexes to AT&T FSTs

License: Apache License 2.0

Python 26.69% C++ 39.96% JavaScript 14.15% Ruby 3.10% Shell 16.10%

regex2dfa's People

Contributors

kpdyer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

regex2dfa's Issues

openfst and re2 have conflicting object "LogMessage"

This file, when compiled

#include "fst/fstlib.h"
#include "re2/re2.h"
int main () {
}

results in the following error.

$ g++ -o test -Ipath/to/re2 -Ipath/to/openfst test.cc
...
third_party/openfst/src/include/fst/log.h:50:9: note: previous definition is here
#define LOG(type) LogMessage(#type).stream()
        ^
In file included from test.cc:1:
In file included from third_party/re2/re2/regexp.h:89:
In file included from third_party/re2/util/util.h:118:
third_party/re2/util/logging.h:49:7: error: redefinition of 'LogMessage'
class LogMessage {
      ^
third_party/openfst/src/include/fst/log.h:34:7: note: previous definition is here
class LogMessage {
      ^

This is a placeholder issue to raise an issue against re2 and openfst, they should use namespaces.

Make regex2dfa a stand-alone executable

Currently, regex2dfa depends upon fstcompile, fstprint, and fstminimize being in the system path. This is not okay --- regex2dfa should be a stand-alone executable.

. should match newline

Currently dot . is not matching newline, which results in unexpected behavior. Specifically we have that the dfa for ^.*$ and ^\C*$ are not equal:

$ ./bin/regex2dfa -r "^.*$"
0   0   0   0
0   0   1   1
0   0   2   2
0   0   3   3
0   0   4   4
0   0   5   5
0   0   6   6
0   0   7   7
0   0   8   8
0   0   9   9
0   0   11  11
$ ./bin/regex2dfa -r "^\\C*$"
0   0   0   0
0   0   1   1
0   0   2   2
0   0   3   3
0   0   4   4
0   0   5   5
0   0   6   6
0   0   7   7
0   0   8   8
0   0   9   9
0   0   10  10
0   0   11  11

notice the missing line 0 0 10 10 for ^.*$.

DFA fails to compile

The following regular expression, the DNS regex from l7, fails to compile to a DFA with regex2dfa 0.1.4.

^.?.?.?.?[\x01\x02].?.?.?.?.?.?[\x01-?][a-z0-9][\x01-?a-z]*[\x02-\x06][a-z][a-z][fglmoprstuvz]?[aeop]?(um)?[\x01-\x10\x1c][\x01\x03\x04\xFF]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.