gcc config
[prop.git] / prop-src / rwgen.h.old
blob357f07c5d138e81c60fdb147d4a941810908718c
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 //  This file describes the interface of the rewriting compiler.
4 //
5 ///////////////////////////////////////////////////////////////////////////////
6 #ifndef rewriting_compiler_h
7 #define rewriting_compiler_h
9 #include "matchcom.h"
11 class FunctorMap;
12 class TreeGrammar;
14 ///////////////////////////////////////////////////////////////////////////////
16 //  The rewriting compiler is inherited from the pattern matcher.
18 ///////////////////////////////////////////////////////////////////////////////
19 class RewritingCompiler : virtual public CodeGen,
20                           virtual public MatchCompiler 
22    RewritingCompiler(const RewritingCompiler&); // no copy constructor
23    void operator = (const RewritingCompiler&);  // no assignment
25 private:
27    Decls rewriters; // outstanding rewriting declarations.
29 public:
30    ////////////////////////////////////////////////////////////////////////////
31    //  Constructor and destructor
32    ////////////////////////////////////////////////////////////////////////////
33             RewritingCompiler(ostream&);
34    virtual ~RewritingCompiler();
36 protected:
37    ////////////////////////////////////////////////////////////////////////////
38    //  Methods for compiling rewriting
39    ////////////////////////////////////////////////////////////////////////////
41    // generate a set of rewrite rules
42    void gen_rewrite  (Id, MatchRules);
44    // generate a rewrite statement
45    void gen_rewriting(Protocols, Exp, Exp, MatchRules, TyQual);
47    // generate a set of outstanding rewrite statements
48    void gen_rewriters();
49 private:
50    ////////////////////////////////////////////////////////////////////////////
51    //  Methods for compiling a topdown tree pattern matcher
52    ////////////////////////////////////////////////////////////////////////////
53    void gen_topdown          (Id, MatchRules, int, Protocols, FunctorMap&,
54                               TyQual, TreeGrammar&, Id [], Id []);
55    void gen_topdown_driver   (Id, MatchRules, FunctorMap&);
57    ////////////////////////////////////////////////////////////////////////////
58    //  Methods for compiling a bottomup tree pattern matcher
59    ////////////////////////////////////////////////////////////////////////////
60    void gen_bottomup          (Id, MatchRules, int, Protocols, FunctorMap&,
61                                TyQual, TreeGrammar&, Id [], Id []);
62    void gen_bottomup_literal  (Id, TyQual, Ty, FunctorMap&);
63    void gen_bottomup_datatype (Id, TyQual, Ty, FunctorMap&);
64    void gen_datatype_traversal(FunctorMap&, Ty);
65    int  gen_pattern_traversal (FunctorMap&, Pat, int);
68 #endif