1 ///////////////////////////////////////////////////////////////////////////////
2 // This file is generated automatically using Prop (version 2.3.7),
3 // last updated on Oct 21, 2008.
4 // The original source file is "simple.pcc".
5 ///////////////////////////////////////////////////////////////////////////////
13 ///////////////////////////////////////////////////////////////////////////////
15 // Forward class definition for Exp
17 ///////////////////////////////////////////////////////////////////////////////
18 #ifndef datatype_Exp_defined
19 #define datatype_Exp_defined
24 ///////////////////////////////////////////////////////////////////////////////
26 // Base class for datatype Exp
28 ///////////////////////////////////////////////////////////////////////////////
32 tag_INT
= 0, tag_ADD
= 1, tag_SUB
= 2,
33 tag_MUL
= 3, tag_DIV
= 4
37 const Tag_Exp tag__
; // variant tag
39 inline a_Exp(Tag_Exp t__
) : tag__(t__
) {}
42 inline int boxed(const a_Exp
*) { return 1; }
43 inline int untag(const a_Exp
* x
) { return x
->tag__
; }
44 ///////////////////////////////////////////////////////////////////////////////
46 // Class for datatype constructor Exp::INT
48 ///////////////////////////////////////////////////////////////////////////////
49 class Exp_INT
: public a_Exp
{
53 inline Exp_INT (int x_INT
)
54 : a_Exp(tag_INT
), INT(x_INT
)
59 ///////////////////////////////////////////////////////////////////////////////
61 // Class for datatype constructor Exp::ADD
63 ///////////////////////////////////////////////////////////////////////////////
64 class Exp_ADD
: public a_Exp
{
68 inline Exp_ADD (Exp x_1
, Exp x_2
)
69 : a_Exp(tag_ADD
), _1(x_1
), _2(x_2
)
74 ///////////////////////////////////////////////////////////////////////////////
76 // Class for datatype constructor Exp::SUB
78 ///////////////////////////////////////////////////////////////////////////////
79 class Exp_SUB
: public a_Exp
{
83 inline Exp_SUB (Exp x_1
, Exp x_2
)
84 : a_Exp(tag_SUB
), _1(x_1
), _2(x_2
)
89 ///////////////////////////////////////////////////////////////////////////////
91 // Class for datatype constructor Exp::MUL
93 ///////////////////////////////////////////////////////////////////////////////
94 class Exp_MUL
: public a_Exp
{
98 inline Exp_MUL (Exp x_1
, Exp x_2
)
99 : a_Exp(tag_MUL
), _1(x_1
), _2(x_2
)
104 ///////////////////////////////////////////////////////////////////////////////
106 // Class for datatype constructor Exp::DIV
108 ///////////////////////////////////////////////////////////////////////////////
109 class Exp_DIV
: public a_Exp
{
113 inline Exp_DIV (Exp x_1
, Exp x_2
)
114 : a_Exp(tag_DIV
), _1(x_1
), _2(x_2
)
119 ///////////////////////////////////////////////////////////////////////////////
121 // Datatype constructor functions for Exp
123 ///////////////////////////////////////////////////////////////////////////////
124 inline a_Exp
* INT (int x_INT
)
126 return new Exp_INT (x_INT
);
128 inline a_Exp
* ADD (Exp x_1
, Exp x_2
)
130 return new Exp_ADD (x_1
, x_2
);
132 inline a_Exp
* SUB (Exp x_1
, Exp x_2
)
134 return new Exp_SUB (x_1
, x_2
);
136 inline a_Exp
* MUL (Exp x_1
, Exp x_2
)
138 return new Exp_MUL (x_1
, x_2
);
140 inline a_Exp
* DIV (Exp x_1
, Exp x_2
)
142 return new Exp_DIV (x_1
, x_2
);
144 ///////////////////////////////////////////////////////////////////////////////
146 // Downcasting functions for Exp
148 ///////////////////////////////////////////////////////////////////////////////
149 inline Exp_INT
* _INT(const a_Exp
* _x_
) { return (Exp_INT
*)_x_
; }
150 inline Exp_ADD
* _ADD(const a_Exp
* _x_
) { return (Exp_ADD
*)_x_
; }
151 inline Exp_SUB
* _SUB(const a_Exp
* _x_
) { return (Exp_SUB
*)_x_
; }
152 inline Exp_MUL
* _MUL(const a_Exp
* _x_
) { return (Exp_MUL
*)_x_
; }
153 inline Exp_DIV
* _DIV(const a_Exp
* _x_
) { return (Exp_DIV
*)_x_
; }
159 #line 11 "simple.pcc"
160 #line 11 "simple.pcc"
161 ///////////////////////////////////////////////////////////////////////////////
163 // Forward class definition for Q
165 ///////////////////////////////////////////////////////////////////////////////
166 #ifndef datatype_Q_defined
167 #define datatype_Q_defined
172 ///////////////////////////////////////////////////////////////////////////////
174 // Base class for datatype Q
176 ///////////////////////////////////////////////////////////////////////////////
180 tag_Expr
= 0, tag_Str
= 1
184 const Tag_Q tag__
; // variant tag
186 inline a_Q(Tag_Q t__
) : tag__(t__
) {}
189 inline int boxed(const a_Q
*) { return 1; }
190 inline int untag(const a_Q
* x
) { return x
->tag__
; }
191 ///////////////////////////////////////////////////////////////////////////////
193 // Class for datatype constructor Q::Expr
195 ///////////////////////////////////////////////////////////////////////////////
196 class Q_Expr
: public a_Q
{
198 #line 11 "simple.pcc"
200 inline Q_Expr (Exp x_Expr
)
201 : a_Q(tag_Expr
), Expr(x_Expr
)
206 ///////////////////////////////////////////////////////////////////////////////
208 // Class for datatype constructor Q::Str
210 ///////////////////////////////////////////////////////////////////////////////
211 class Q_Str
: public a_Q
{
213 #line 11 "simple.pcc"
215 inline Q_Str (std::string x_Str
)
216 : a_Q(tag_Str
), Str(x_Str
)
221 ///////////////////////////////////////////////////////////////////////////////
223 // Datatype constructor functions for Q
225 ///////////////////////////////////////////////////////////////////////////////
226 inline a_Q
* Expr (Exp x_Expr
)
228 return new Q_Expr (x_Expr
);
230 inline a_Q
* Str (std::string x_Str
)
232 return new Q_Str (x_Str
);
234 ///////////////////////////////////////////////////////////////////////////////
236 // Downcasting functions for Q
238 ///////////////////////////////////////////////////////////////////////////////
239 inline Q_Expr
* _Expr(const a_Q
* _x_
) { return (Q_Expr
*)_x_
; }
240 inline Q_Str
* _Str(const a_Q
* _x_
) { return (Q_Str
*)_x_
; }
242 #line 11 "simple.pcc"
243 #line 11 "simple.pcc"
248 std::auto_ptr
<a_Q
> q(Expr(ADD(INT(2),INT(3))));
251 #line 17 "simple.pcc"
252 #line 19 "simple.pcc"
257 #line 19 "simple.pcc"
258 std::cout
<< _Str(_V1
)->Str
<< std::endl
;
259 #line 19 "simple.pcc"
262 #line 18 "simple.pcc"
263 std::cout
<< "expr" << std::endl
;
264 #line 18 "simple.pcc"
267 #line 20 "simple.pcc"
268 #line 20 "simple.pcc"
273 #line 24 "simple.pcc"
275 ------------------------------- Statistics -------------------------------
276 Merge matching rules = yes
277 Number of DFA nodes merged = 0
278 Number of ifs generated = 1
279 Number of switches generated = 0
282 Adaptive matching = disabled
283 Fast string matching = disabled
284 Inline downcasts = disabled
285 --------------------------------------------------------------------------