#include <astl.h>
#include <combinatory.h>
#include <astl_tree.h>
#include <cursor.h>
#include <ccopy.h>
#include <dot.h>
#include <iostream>
#include <fstream>
#include <iterator>
#include <string>
#include <filter.h>
#include <stats.h>

// Send to standard output the permutation automaton representation to be used
// by the dot command (see usage). dot produces a postscript file viewable with ghostview.

// compile:
// g++ -Wall -O3 -fno-exceptions -I.. -I../.. dot.cpp
// usage:
// a.out n | dot -Tps -o dfa.eps; gv dfa.eps

int main(int argc, char **argv)
{
  permutation_cursor c(atoi(argv[1]));
  DFA_dot output(cout);
  output.ratio(.9).rankdir("LR").initial(true).state_fontsize(20).edge_fontsize(22);

  dot(output, dfirstmarkc(c));
  DFA_stats stats;
  ccopy(stats, dfirstmarkc(permutationc(atoi(argv[1]))));
  cerr << "Q = " << stats.state_count() << " T = " << stats.trans_count() 
       << " F = " << stats.final_count() << endl;
}



