1 //////////////////////////////////////////////////////////////////////////////
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
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
18 // This software is still under development and we welcome any suggestions
19 // and help from the users.
23 //////////////////////////////////////////////////////////////////////////////
25 #ifndef deterministic_finite_state_tree_automata_generator_h
26 #define deterministic_finite_state_tree_automata_generator_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
46 ///////////////////////////////////////////////////////////////////////////
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
;
58 ///////////////////////////////////////////////////////////////////////////
59 // Internal data structure.
60 ///////////////////////////////////////////////////////////////////////////
61 class TreeGenerator
* impl
; // opaque! for your sanitary protection.
65 ///////////////////////////////////////////////////////////////////////////
66 // Constructors and destructor
67 ///////////////////////////////////////////////////////////////////////////
69 TreeGen(Mem
&, TreeGrammar
&);
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 ///////////////////////////////////////////////////////////////////////////
81 ///////////////////////////////////////////////////////////////////////////
82 virtual const char * algorithm () const;