simple.cc - generated code example
[prop.git] / app / willard / phase5.cc
blob36215dc4f5c22d9f18872fa5d05196a6a379859a
1 ///////////////////////////////////////////////////////////////////////////////
2 // This file is generated automatically using Prop (version 2.3.5),
3 // last updated on Jun 18, 1997.
4 // The original source file is "phase5.pcc".
5 ///////////////////////////////////////////////////////////////////////////////
7 #define PROP_REWRITING_USED
8 #define PROP_STRCMP_USED
9 #define PROP_QUARK_USED
10 #define PROP_TUPLE2_USED
11 #include <propdefs.h>
12 #line 1 "phase5.pcc"
13 #include <AD/pretty/postream.h>
14 #include "phase5.h"
16 ///////////////////////////////////////////////////////////////////////////////
18 // Constructor and destructor for phase5
20 ///////////////////////////////////////////////////////////////////////////////
21 Phase5::Phase5() {}
22 Phase5::~Phase5() {}
24 ///////////////////////////////////////////////////////////////////////////////
26 // Method to invoke phase5
28 ///////////////////////////////////////////////////////////////////////////////
29 Exp Phase5::phase5(Exp e)
30 { message("Simple find/count query decomposition phase", e);
31 (*this)(e); return collect_subqueries(e);
34 ///////////////////////////////////////////////////////////////////////////////
36 // Transformation to decompose conjunctions
38 ///////////////////////////////////////////////////////////////////////////////
39 #line 27 "phase5.pcc"
40 #line 30 "phase5.pcc"
41 ///////////////////////////////////////////////////////////////////////////////
43 // This macro can be redefined by the user for debugging
45 ///////////////////////////////////////////////////////////////////////////////
46 #ifndef DEBUG_Phase5
47 #define DEBUG_Phase5(repl,redex,file,line,rule) repl
48 #else
49 static const char * Phase5_file_name = "phase5.pcc";
50 #endif
52 inline void Phase5::labeler(char const * redex,int& s__,int)
55 s__ = 0;
59 inline void Phase5::labeler(Quark redex,int& s__,int)
62 s__ = 0;
66 void Phase5::labeler (Exp & redex, int& s__, int r__)
68 replacement__:
69 switch(redex->tag__) {
70 case a_Exp::tag_OP: {
71 int s0__;
72 int s1__;
73 labeler(_OP(redex)->_1, s0__, r__);
74 labeler(_OP(redex)->_2, s1__, r__);
75 s__ = 0;} break;
76 case a_Exp::tag_APP: {
77 int s0__;
78 int s1__;
79 labeler(_APP(redex)->_1, s0__, r__);
80 labeler(_APP(redex)->_2, s1__, r__);
81 s__ = 0;} break;
82 case a_Exp::tag_LIT: {
83 int s0__;
84 labeler(_LIT(redex)->LIT, s0__, r__);
85 s__ = 0;} break;
86 case a_Exp::tag_ID: {
87 int s0__;
88 labeler(_ID(redex)->ID, s0__, r__);
89 s__ = 0;} break;
90 case a_Exp::tag_TUPLE: {
91 int s0__;
92 labeler(_TUPLE(redex)->TUPLE, s0__, r__);
93 s__ = 0;} break;
94 case a_Exp::tag_FORALL: {
95 int s0__;
96 int s1__;
97 int s2__;
98 labeler(_FORALL(redex)->_1, s0__, r__);
99 labeler(_FORALL(redex)->_2, s1__, r__);
100 labeler(_FORALL(redex)->_3, s2__, r__);
101 s__ = 0;} break;
102 case a_Exp::tag_EXISTS: {
103 int s0__;
104 int s1__;
105 int s2__;
106 labeler(_EXISTS(redex)->_1, s0__, r__);
107 labeler(_EXISTS(redex)->_2, s1__, r__);
108 labeler(_EXISTS(redex)->_3, s2__, r__);
109 s__ = 0;} break;
110 case a_Exp::tag_GUARD: {
111 int s0__;
112 int s1__;
113 labeler(_GUARD(redex)->_1, s0__, r__);
114 labeler(_GUARD(redex)->_2, s1__, r__);
115 s__ = 0;} break;
116 case a_Exp::tag_GENERATOR: {
117 int s0__;
118 int s1__;
119 int s2__;
120 s0__ = 0; // Ids
121 labeler(_GENERATOR(redex)->_2, s1__, r__);
122 labeler(_GENERATOR(redex)->_3, s2__, r__);
123 s__ = 1;} break;
124 default: {
125 int s0__;
126 int s1__;
127 int s2__;
128 labeler(_LET(redex)->_1, s0__, r__);
129 labeler(_LET(redex)->_2, s1__, r__);
130 labeler(_LET(redex)->_3, s2__, r__);
131 s__ = 0;} break;
133 switch (s__) {
134 case 1: {
135 #line 30 "phase5.pcc"
137 #line 30 "phase5.pcc"
138 } break;
143 void Phase5::labeler (Literal & redex, int& s__, int r__)
145 replacement__:
146 switch(redex->tag__) {
147 case a_Literal::tag_INT: {
148 int s0__;
149 s0__ = 0; // int
150 s__ = 0;} break;
151 case a_Literal::tag_STRING: {
152 int s0__;
153 labeler(_STRING(redex)->STRING, s0__, r__);
154 s__ = 0;} break;
155 default: {
156 int s0__;
157 s0__ = 0; // Bool
158 s__ = 0;} break;
163 void Phase5::labeler (a_List<Exp> * & redex, int& s__, int r__)
165 replacement__:
166 if ((redex)) {
167 int s0__;
168 int s1__;
169 labeler(redex->_1, s0__, r__);
170 labeler(redex->_2, s1__, r__);
171 s__ = 0;
172 } else {s__ = 0;
177 #line 31 "phase5.pcc"
178 #line 31 "phase5.pcc"
181 #line 33 "phase5.pcc"
183 ------------------------------- Statistics -------------------------------
184 Merge matching rules = yes
185 Number of DFA nodes merged = 0
186 Number of ifs generated = 0
187 Number of switches generated = 0
188 Number of labels = 0
189 Number of gotos = 0
190 Adaptive matching = disabled
191 Fast string matching = disabled
192 Inline downcasts = disabled
193 --------------------------------------------------------------------------