next up previous contents
Next: Accessing States Transitions Up: Getting Started Previous: NFA   Contents

Constructing an Automaton

#include <astl.h>
#include <dfa.h>
#include <vector>
#include <iterator>

int main()
{
  using namespace std;
  DFA_matrix<> A;
  DFA_matrix<>::state_type q = A.new_state();
  DFA_matrix<>::state_type p = A.new_state();
  A.set_trans(q, 'a', p);
  A.initial(q);
  A.final(p) = true;
  DFA_matrix<>::state_type Q1[10];
  A.new_state(10, Q1);
  vector<DFA_matrix<>::state_type> Q2(10);
  A.new_state(10, Q2.begin());
  vector<DFA_matrix<>::state_type> Q3;
  A.new_state(10, back_inserter(Q3));
}


Vincent Le Maout 2003-07-08