next up previous contents
Next: Using a Depth-First Cursor Up: Getting Started Previous: Matching   Contents

Using a Forward Cursor

#include <astl.h>
#include <dfa.h>
#include <language.h>
#include <cursor.h>
#include <iostream>

int main()
{
  DFA_matrix<> A;
  // Construction...
  forward_cursor<DFA_matrix<> > c(A, A.initial());
  if (c.first_transition()) 
    do 
      std::cout << " source " << c.src() 
                << " letter " << c.letter() 
                << " aim "    << c.aim();
    while (c.next_transition());


  const char *w = "word";
  if (is_in(w, w + 4, forwardc(A))) std::cout << "recognized";

}


Vincent Le Maout 2003-07-08