initial
[prop.git] / include / AD / automata / treegen.h
blob7bb28cfc1a05feb5480994c2c0571933bcff2ecd
1 //////////////////////////////////////////////////////////////////////////////
2 // NOTICE:
3 //
4 // ADLib, Prop and their related set of tools and documentation are in the
5 // public domain. The author(s) of this software reserve no copyrights on
6 // the source code and any code generated using the tools. You are encouraged
7 // to use ADLib and Prop to develop software, in both academic and commercial
8 // settings, and are free to incorporate any part of ADLib and Prop into
9 // your programs.
11 // Although you are under no obligation to do so, we strongly recommend that
12 // you give away all software developed using our tools.
14 // We also ask that credit be given to us when ADLib and/or Prop are used in
15 // your programs, and that this notice be preserved intact in all the source
16 // code.
18 // This software is still under development and we welcome any suggestions
19 // and help from the users.
21 // Allen Leung
22 // 1994
23 //////////////////////////////////////////////////////////////////////////////
25 #ifndef deterministic_finite_state_tree_automata_generator_h
26 #define deterministic_finite_state_tree_automata_generator_h
28 #include <iostream.h>
29 #include <AD/automata/treeauto.h> // Tree automata
30 #include <AD/automata/treegram.h> // Tree grammars
32 //////////////////////////////////////////////////////////////////////////////
34 // The class TreeGen generates a tree-matching automaton
35 // using a NFA to DFA subset construction generalized to
36 // k-algebra/tree grammars.
38 //////////////////////////////////////////////////////////////////////////////
39 class TreeGen : public TreeAutomaton {
41 TreeGen(const TreeGen&); // no copy constructor
42 void operator = (const TreeGen&); // no assignment
44 public:
46 ///////////////////////////////////////////////////////////////////////////
47 // Inherit some types
48 ///////////////////////////////////////////////////////////////////////////
49 typedef TreeAutomaton Super;
50 typedef Super::Functor Functor;
51 typedef Super::Functor Variable;
52 typedef Super::Arity Arity;
53 typedef Super::State State;
54 typedef TreeGrammar::TreeProduction TreeProduction;
56 private:
58 ///////////////////////////////////////////////////////////////////////////
59 // Internal data structure.
60 ///////////////////////////////////////////////////////////////////////////
61 class TreeGenerator * impl; // opaque! for your sanitary protection.
63 public:
65 ///////////////////////////////////////////////////////////////////////////
66 // Constructors and destructor
67 ///////////////////////////////////////////////////////////////////////////
68 TreeGen(Mem&);
69 TreeGen(Mem&, TreeGrammar&);
70 virtual ~TreeGen();
72 ///////////////////////////////////////////////////////////////////////////
73 // Compilation and table emission
74 ///////////////////////////////////////////////////////////////////////////
75 virtual void compile (TreeGrammar&);
76 virtual ostream& print_report (ostream&) const;
77 virtual ostream& print_state (ostream&, State) const;
79 ///////////////////////////////////////////////////////////////////////////
80 // Name of algorithm
81 ///////////////////////////////////////////////////////////////////////////
82 virtual const char * algorithm () const;
85 #endif