simple.cc - generated code example
[prop.git] / include / AD / automata / bottomup.h
blob596c7393d38975e562b6a92a6f4c151397985919
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 prop_bottomup_pattern_matching_automata_h
26 #define prop_bottomup_pattern_matching_automata_h
28 /////////////////////////////////////////////////////////////////////////////
29 // Bottom up tree matching automata\cite{tree-matching}.
31 // Note: we'll use the index compression techique in\cite{Chase87} and
32 // the match set unifiers in \cite{Lippe}. Please see references
33 // for details.
34 /////////////////////////////////////////////////////////////////////////////
36 #include <iostream>
37 #include <AD/automata/treeauto.h> // Tree automaton
38 #include <AD/automata/treepat.h> // Tree patterns
40 class BottomUp : public TreeAutomaton {
42 BottomUp(const BottomUp&); // no copy constructor
43 void operator = (const BottomUp&); // no assignment
45 public:
47 //////////////////////////////////////////////////////////////////////////
48 // Inherit types
49 //////////////////////////////////////////////////////////////////////////
50 typedef TreeAutomaton Super;
51 typedef Super::Offset Offset; // table offsets
52 typedef Super::State State; // a state in the tree matcher
53 typedef Super::Functor Functor; // constructor of a term
54 typedef Super::Arity Arity; // arity of a functor
56 public:
58 //////////////////////////////////////////////////////////////////////////
59 // Constructor and destructor
60 //////////////////////////////////////////////////////////////////////////
61 BottomUp(Mem&);
62 ~BottomUp();
64 //////////////////////////////////////////////////////////////////////////
65 // Compilation and code generation
66 //////////////////////////////////////////////////////////////////////////
67 virtual void compile (TreePatterns&);
68 virtual const char * algorithm () const;
71 #endif