项目作者: Jack-Q

项目描述 :
Regular expression to DFA, with DOT format output for visualization
高级语言: JavaScript
项目地址: git://github.com/Jack-Q/reg2dfa.git
创建时间: 2017-04-08T14:59:45Z
项目社区:https://github.com/Jack-Q/reg2dfa

开源协议:MIT License

下载


REG 2 DFA

Convert regular expression to NFA, DFA and minimal DFA,
and check the result visually.

Example

  • regular expression:

    (1|0*11)*0*1*

  • NFA (Nondeterministic Finite Automata):

    nfa

  • DFA (Deterministic Finite Automata):

    dfa

  • MIN (Minimal Deterministic Finite Automata):

    min

Web Page

The in-browser version is accessible at GitHub Pages, which can
render the DOT result to SVG.

Check it out at https://jack-q.github.io/reg2dfa/.

CLI

A CLI version is available to use in node.js environment.
The provided CLI interface can write the DOT file to working directory.
The result can be converted to other format with dot command.

  1. # install dependencies
  2. npm install
  3. # start and convert the result
  4. # this will create {nfa,dfa,min}.dot at working directory
  5. npm start '101|1(01)*1|01'
  6. dot nfa.dot -Tpng > nfa.png
  7. dot dfa.dot -Tpng > dfa.png
  8. dot min.dot -Tpng > min.png
  9. # convert to a older syntax
  10. npm convert

The dot command is part of the GraphViz package, which can be
configured on Ubuntu by installing graphviz package. For more information about GraphViz, check out http://www.graphviz.org/.