build.cpp

来自「一个类似STL的自动机的源代码库」· C++ 代码 · 共 52 行

CPP
52 行
字号
#include <astl.h>#include <dfa.h>#include <build.h>#include <stream.h>#include <cursor.h>#include <ccopy.h>#include <tools.h>#include <iostream>using namespace std;template <typename DFA>void run(DFA& dfa, bool verbose, bool state_mark){  dfa.initial(build(dfa, cin));  if (verbose)     cerr << "DFA built has " << dfa.state_count() << " states and "	 << dfa.trans_count() << " transitions" << endl;  DFA_stream out(cout);  if (state_mark)    clone(out, dfirst_markc(dfa));  else    clone(out, dfirstc(dfa));}int main(int argc, char** argv){  config c(argc, argv, 1, "all");  if (c.representation == "matrix") {    DFA_matrix<> dfa;    run(dfa, c.verbose_mode, c.state_mark);  }  if (c.representation == "map") {    DFA_map<> dfa;    run(dfa, c.verbose_mode, c.state_mark);  }  if (c.representation == "bin") {    DFA_bin<> dfa;    run(dfa, c.verbose_mode, c.state_mark);  }  if (c.representation == "mtf") {    DFA_mtf<> dfa;    run(dfa, c.verbose_mode, c.state_mark);  }  if (c.representation == "tr") {    DFA_tr<> dfa;    run(dfa, c.verbose_mode, c.state_mark);  }  return 0;}  

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?