1 ///////////////////////////////////////////////////////////////////////////////
3 // This file defines the rewriting partial evaluator
5 ///////////////////////////////////////////////////////////////////////////////
6 #ifndef rewriting_mix_h
7 #define rewriting_mix_h
13 ///////////////////////////////////////////////////////////////////////////////
15 // The rewriting partial evaluator
17 ///////////////////////////////////////////////////////////////////////////////
18 class RewriteMix : public virtual RewritingCompiler
19 { RewriteMix (const RewriteMix&); // no copy constructor
20 void operator = (const RewriteMix&); // no assignment
25 virtual ~RewriteMix();
27 virtual MatchRules optimize_rewrite (Id, MatchRules);
30 ////////////////////////////////////////////////////////////////////////////
34 ////////////////////////////////////////////////////////////////////////////
35 enum Result { SUCCESS, FAILURE, UNKNOWN };
37 MatchRules mix (MatchRules);
39 ////////////////////////////////////////////////////////////////////////////
41 // Pattern matching methods.
43 ////////////////////////////////////////////////////////////////////////////
44 Result pmatch (Pat, Exp);
45 Result pmatch (Pats, Exps);
46 Result pmatch (LabPats, LabExps);
47 Result pmatch (Exp, MatchRule);
49 ////////////////////////////////////////////////////////////////////////////
51 // Normalization methods.
53 ////////////////////////////////////////////////////////////////////////////
54 Exp normalize (Exp, MatchRules, Bool&);
55 Result reduce (Exp, MatchRules, Exp&);
57 ////////////////////////////////////////////////////////////////////////////
59 // Simplication methods.
61 ////////////////////////////////////////////////////////////////////////////
62 Exp simplify (Exp, Exp = NOexp);