Next: Using a Forward Cursor
Up: Getting Started
Previous: Minimizing Acyclic DFAs
Contents
#include <astl.h>
#include <dfa.h>
#include <cursor.h>
#include <language.h>
#include <string>
#include <iostream>
int main()
{
using namespace std;
DFA_matrix<> A;
string w = "word";
// Construction...
cursor<DFA_matrix<> > c(A);
string::const_iterator i = w.begin();
for(c = A.initial(); i != w.end() && c.forward(*i); ++i);
if (i == w.end() && c.src_final()) cout << "recognized";
if (is_in(w.begin(), w.end(), plainc(A))) cout << "recognized too";
if (is_in(istream_iterator<char>(cin), istream_iterator<char>(),
plainc(A))) cout << "found on stdin";
}
Vincent Le Maout
2003-07-08