1 ///////////////////////////////////////////////////////////////////////////////
2 // This file is generated automatically using Prop (version 2.3.0),
3 // last updated on Feb 16, 1997.
4 // The original source file is "bugfix3.pcc".
5 ///////////////////////////////////////////////////////////////////////////////
7 #define PROP_REWRITING_USED
8 #define PROP_QUARK_USED
12 // Testing the rewriting features
17 #line 11 "bugfix3.pcc"
18 ///////////////////////////////////////////////////////////////////////////////
19 // Forward class definition for EXP
20 ///////////////////////////////////////////////////////////////////////////////
21 #ifndef datatype_EXP_defined
22 #define datatype_EXP_defined
23 typedef class a_EXP
* EXP
;
26 ///////////////////////////////////////////////////////////////////////////////
27 // Class hierarchy for datatype EXP
28 ///////////////////////////////////////////////////////////////////////////////
29 class a_EXP
; // base class for datatype EXP
30 class EXP_num
; // subclass for 'num int'
31 class EXP_add
; // subclass for 'add (EXP, EXP)'
32 class EXP_sub
; // subclass for 'sub (EXP, EXP)'
33 class EXP_mul
; // subclass for 'mul (EXP, EXP)'
34 class EXP_div
; // subclass for 'div (EXP, EXP)'
36 ///////////////////////////////////////////////////////////////////////////////
37 // Base class for datatype 'EXP'
38 ///////////////////////////////////////////////////////////////////////////////
42 tag_num
= 0, tag_add
= 1, tag_sub
= 2, tag_mul
= 3,
48 inline a_EXP(Tag_EXP _t_
) : _tag_(_t_
) {}
50 inline int untag() const { return _tag_
; }
51 inline friend int boxed(const a_EXP
* x
) { return 1; }
52 inline friend int untag(const a_EXP
* x
) { return x
->_tag_
; }
53 ////////////////////////////////////////////////////////////////////////////
54 // Downcasting functions for EXP
55 ////////////////////////////////////////////////////////////////////////////
56 inline friend EXP_num
* _num(EXP _x_
) { return (EXP_num
*)_x_
; }
57 inline friend EXP_add
* _add(EXP _x_
) { return (EXP_add
*)_x_
; }
58 inline friend EXP_sub
* _sub(EXP _x_
) { return (EXP_sub
*)_x_
; }
59 inline friend EXP_mul
* _mul(EXP _x_
) { return (EXP_mul
*)_x_
; }
60 inline friend EXP_div
* _div(EXP _x_
) { return (EXP_div
*)_x_
; }
63 ///////////////////////////////////////////////////////////////////////////////
64 // class for constructor 'EXP::num int'
65 ///////////////////////////////////////////////////////////////////////////////
66 class EXP_num
: public a_EXP
{
70 inline EXP_num (int _xnum
)
71 : a_EXP(a_EXP::tag_num
), num(_xnum
) {}
72 inline friend a_EXP
* num (int _xnum
)
73 { return new EXP_num (_xnum
); }
76 ///////////////////////////////////////////////////////////////////////////////
77 // class for constructor 'EXP::add (EXP, EXP)'
78 ///////////////////////////////////////////////////////////////////////////////
79 class EXP_add
: public a_EXP
{
83 inline EXP_add (EXP _x1
, EXP _x2
)
84 : a_EXP(a_EXP::tag_add
), _1(_x1
), _2(_x2
) {}
85 inline friend a_EXP
* add (EXP _x1
, EXP _x2
)
86 { return new EXP_add (_x1
, _x2
); }
89 ///////////////////////////////////////////////////////////////////////////////
90 // class for constructor 'EXP::sub (EXP, EXP)'
91 ///////////////////////////////////////////////////////////////////////////////
92 class EXP_sub
: public a_EXP
{
96 inline EXP_sub (EXP _x1
, EXP _x2
)
97 : a_EXP(a_EXP::tag_sub
), _1(_x1
), _2(_x2
) {}
98 inline friend a_EXP
* sub (EXP _x1
, EXP _x2
)
99 { return new EXP_sub (_x1
, _x2
); }
102 ///////////////////////////////////////////////////////////////////////////////
103 // class for constructor 'EXP::mul (EXP, EXP)'
104 ///////////////////////////////////////////////////////////////////////////////
105 class EXP_mul
: public a_EXP
{
107 #line 9 "bugfix3.pcc"
109 inline EXP_mul (EXP _x1
, EXP _x2
)
110 : a_EXP(a_EXP::tag_mul
), _1(_x1
), _2(_x2
) {}
111 inline friend a_EXP
* mul (EXP _x1
, EXP _x2
)
112 { return new EXP_mul (_x1
, _x2
); }
115 ///////////////////////////////////////////////////////////////////////////////
116 // class for constructor 'EXP::div (EXP, EXP)'
117 ///////////////////////////////////////////////////////////////////////////////
118 class EXP_div
: public a_EXP
{
120 #line 10 "bugfix3.pcc"
122 inline EXP_div (EXP _x1
, EXP _x2
)
123 : a_EXP(a_EXP::tag_div
), _1(_x1
), _2(_x2
) {}
124 inline friend a_EXP
* div (EXP _x1
, EXP _x2
)
125 { return new EXP_div (_x1
, _x2
); }
128 #line 11 "bugfix3.pcc"
129 #line 11 "bugfix3.pcc"
132 #line 13 "bugfix3.pcc"
133 #line 13 "bugfix3.pcc"
134 class Simplify
: public BURS
{
136 Simplify(const Simplify
&); // no copy constructor
137 void operator = (const Simplify
&); // no assignment
139 struct Simplify_StateRec
* stack__
, * stack_top__
;
141 void labeler(const char *, int&, int);
142 void labeler(Quark
, int&, int);
143 void labeler(EXP
& redex
, int&, int);
144 inline virtual void operator () (EXP
& redex
) { int s
; labeler(redex
,s
,0); }
147 #line 13 "bugfix3.pcc"
148 #line 13 "bugfix3.pcc"
152 #line 16 "bugfix3.pcc"
153 #line 31 "bugfix3.pcc"
154 static const TreeTables::Offset Simplify_accept_base
[ 12 ] = {
155 0, 0, 1, 3, 7, 9, 11, 14, 18, 26, 30, 32
157 static const TreeTables::Rule Simplify_accept_vector
[ 35 ] = {
158 -1, 1, -1, 0, 1, 10, -1, 0, -1, 2, -1, 2, 11, -1, 3, 5,
159 7, -1, 3, 4, 5, 6, 7, 8, 12, -1, 4, 6, 8, -1, 9, -1,
162 static const TreeTables::State Simplify_theta_1
[2][2] = {
168 static const TreeTables::State Simplify_theta_2
[2][2] = {
174 static const TreeTables::State Simplify_theta_3
[2][2] = {
180 static const TreeTables::State Simplify_theta_4
[2][2] = {
186 static const TreeTables::State Simplify_mu_1_0
[12] = {
187 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
191 static const TreeTables::State Simplify_mu_1_1
[12] = {
192 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
196 static const TreeTables::State Simplify_mu_2_0
[12] = {
197 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
201 static const TreeTables::State Simplify_mu_2_1
[12] = {
202 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
206 static const TreeTables::State Simplify_mu_3_0
[12] = {
207 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
211 static const TreeTables::State Simplify_mu_3_1
[12] = {
212 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
216 static const TreeTables::State Simplify_mu_4_0
[12] = {
217 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
221 static const TreeTables::State Simplify_mu_4_1
[12] = {
222 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
226 inline void Simplify::labeler(char const * redex
,int& s__
,int)
233 inline void Simplify::labeler(Quark redex
,int& s__
,int)
240 void Simplify::labeler (EXP
& redex
, int& s__
, int r__
)
243 switch(redex
->untag()) {
244 case a_EXP::tag_num
: {
248 case a_EXP::tag_add
: {
251 labeler(_add(redex
)->_1
, s0__
, r__
);
252 labeler(_add(redex
)->_2
, s1__
, r__
);
253 s__
= Simplify_theta_1
[Simplify_mu_1_0
[s0__
]][Simplify_mu_1_1
[s1__
]]; } break;
254 case a_EXP::tag_sub
: {
257 labeler(_sub(redex
)->_1
, s0__
, r__
);
258 labeler(_sub(redex
)->_2
, s1__
, r__
);
259 s__
= Simplify_theta_2
[Simplify_mu_2_0
[s0__
]][Simplify_mu_2_1
[s1__
]]; } break;
260 case a_EXP::tag_mul
: {
263 labeler(_mul(redex
)->_1
, s0__
, r__
);
264 labeler(_mul(redex
)->_2
, s1__
, r__
);
265 s__
= Simplify_theta_3
[Simplify_mu_3_0
[s0__
]][Simplify_mu_3_1
[s1__
]]; } break;
269 labeler(_div(redex
)->_1
, s0__
, r__
);
270 labeler(_div(redex
)->_2
, s1__
, r__
);
271 s__
= Simplify_theta_4
[Simplify_mu_4_0
[s0__
]][Simplify_mu_4_1
[s1__
]]; } break;
273 const TreeTables::Rule
* o__
= Simplify_accept_vector
+ Simplify_accept_base
[s__
];
277 #line 30 "bugfix3.pcc"
278 num(_num(_div(redex
)->_1
)->num
/ _num(_div(redex
)->_2
)->num
);
279 #line 31 "bugfix3.pcc"
282 #line 29 "bugfix3.pcc"
283 num(_num(_mul(redex
)->_1
)->num
* _num(_mul(redex
)->_2
)->num
);
285 #line 30 "bugfix3.pcc"
288 #line 28 "bugfix3.pcc"
289 num(_num(_sub(redex
)->_1
)->num
- _num(_sub(redex
)->_2
)->num
);
291 #line 29 "bugfix3.pcc"
294 #line 27 "bugfix3.pcc"
295 num(_num(_add(redex
)->_1
)->num
+ _num(_add(redex
)->_2
)->num
);
297 #line 28 "bugfix3.pcc"
299 case 9: if ((_num(_div(redex
)->_2
)->num
== 1))
301 #line 26 "bugfix3.pcc"
304 #line 27 "bugfix3.pcc"
306 else { ++o__
; goto accept__
; } break;
307 case 8: if ((_num(_mul(redex
)->_1
)->num
== 2))
309 #line 25 "bugfix3.pcc"
310 add(_mul(redex
)->_2
,_mul(redex
)->_2
);
312 #line 26 "bugfix3.pcc"
314 else { ++o__
; goto accept__
; } break;
315 case 7: if ((_num(_mul(redex
)->_2
)->num
== 2))
317 #line 24 "bugfix3.pcc"
318 add(_mul(redex
)->_1
,_mul(redex
)->_1
);
320 #line 25 "bugfix3.pcc"
322 else { ++o__
; goto accept__
; } break;
323 case 6: if ((_num(_mul(redex
)->_1
)->num
== 1))
325 #line 23 "bugfix3.pcc"
328 #line 24 "bugfix3.pcc"
330 else { ++o__
; goto accept__
; } break;
331 case 5: if ((_num(_mul(redex
)->_2
)->num
== 1))
333 #line 22 "bugfix3.pcc"
336 #line 23 "bugfix3.pcc"
338 else { ++o__
; goto accept__
; } break;
339 case 4: if ((_num(_mul(redex
)->_1
)->num
== 0))
341 #line 21 "bugfix3.pcc"
344 #line 22 "bugfix3.pcc"
346 else { ++o__
; goto accept__
; } break;
347 case 3: if ((_num(_mul(redex
)->_2
)->num
== 0))
349 #line 20 "bugfix3.pcc"
352 #line 21 "bugfix3.pcc"
354 else { ++o__
; goto accept__
; } break;
355 case 2: if ((_num(_sub(redex
)->_2
)->num
== 0))
357 #line 19 "bugfix3.pcc"
360 #line 20 "bugfix3.pcc"
362 else { ++o__
; goto accept__
; } break;
363 case 1: if ((_num(_add(redex
)->_2
)->num
== 0))
365 #line 18 "bugfix3.pcc"
368 #line 19 "bugfix3.pcc"
370 else { ++o__
; goto accept__
; } break;
371 case 0: if ((_num(_add(redex
)->_1
)->num
== 0))
373 #line 17 "bugfix3.pcc"
376 #line 18 "bugfix3.pcc"
378 else { ++o__
; goto accept__
; } break;
383 #line 31 "bugfix3.pcc"
384 #line 31 "bugfix3.pcc"
387 #line 33 "bugfix3.pcc"
388 #line 35 "bugfix3.pcc"
389 ///////////////////////////////////////////////////////////////////////////////
390 // Forward class definition for NAT
391 ///////////////////////////////////////////////////////////////////////////////
392 #ifndef datatype_NAT_defined
393 #define datatype_NAT_defined
394 typedef class a_NAT
* NAT
;
397 ///////////////////////////////////////////////////////////////////////////////
398 // Class hierarchy for datatype NAT
399 ///////////////////////////////////////////////////////////////////////////////
400 class a_NAT
; // base class for datatype NAT
402 ///////////////////////////////////////////////////////////////////////////////
403 // Base class for datatype 'NAT'
404 ///////////////////////////////////////////////////////////////////////////////
408 inline friend int boxed(const a_NAT
* x
) { return x
!= 0; }
409 inline friend int untag(const a_NAT
* x
) { return x
? 1 : 0; }
410 #line 34 "bugfix3.pcc"
412 inline a_NAT (NAT _xsucc
)
414 inline friend a_NAT
* succ (NAT _xsucc
)
415 { return new a_NAT (_xsucc
); }
418 #line 35 "bugfix3.pcc"
419 #line 35 "bugfix3.pcc"
422 #line 37 "bugfix3.pcc"
423 #line 39 "bugfix3.pcc"
424 class Number
: public BURS
{
426 Number(const Number
&); // no copy constructor
427 void operator = (const Number
&); // no assignment
429 struct Number_StateRec
* stack__
, * stack_top__
;
431 void labeler(const char *, int&, int);
432 void labeler(Quark
, int&, int);
433 void labeler(NAT
& redex
, int&, int);
434 inline virtual void operator () (NAT
& redex
) { int s
; labeler(redex
,s
,0); }
435 void labeler(EXP
& redex
, int&, int);
436 inline virtual void operator () (EXP
& redex
) { int s
; labeler(redex
,s
,0); }
438 #line 38 "bugfix3.pcc"
440 #line 39 "bugfix3.pcc"
442 #line 39 "bugfix3.pcc"
443 #line 39 "bugfix3.pcc"
446 #line 41 "bugfix3.pcc"
447 #line 51 "bugfix3.pcc"
448 static const TreeTables::State Number_theta_1
[6] = {
453 static const TreeTables::State Number_theta_3
[2][2] = {
459 static const TreeTables::State Number_theta_4
[2][2] = {
465 static const TreeTables::State Number_theta_5
[2][2] = {
471 static const TreeTables::State Number_theta_6
[2][2] = {
477 static const TreeTables::State Number_mu_1_0
[13] = {
478 0, 1, 2, 0, 3, 4, 0, 0, 0, 0, 4, 5, 5
482 static const TreeTables::State Number_mu_3_0
[13] = {
483 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
487 static const TreeTables::State Number_mu_3_1
[13] = {
488 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
492 static const TreeTables::State Number_mu_4_0
[13] = {
493 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
497 static const TreeTables::State Number_mu_4_1
[13] = {
498 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
502 static const TreeTables::State Number_mu_5_0
[13] = {
503 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
507 static const TreeTables::State Number_mu_5_1
[13] = {
508 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
512 static const TreeTables::State Number_mu_6_0
[13] = {
513 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
517 static const TreeTables::State Number_mu_6_1
[13] = {
518 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
522 inline void Number::labeler(char const * redex
,int& s__
,int)
529 inline void Number::labeler(Quark redex
,int& s__
,int)
536 void Number::labeler (EXP
& redex
, int& s__
, int r__
)
539 switch(redex
->untag()) {
540 case a_EXP::tag_num
: {
544 case a_EXP::tag_add
: {
547 labeler(_add(redex
)->_1
, s0__
, r__
);
548 labeler(_add(redex
)->_2
, s1__
, r__
);
549 s__
= Number_theta_3
[Number_mu_3_0
[s0__
]][Number_mu_3_1
[s1__
]]; } break;
550 case a_EXP::tag_sub
: {
553 labeler(_sub(redex
)->_1
, s0__
, r__
);
554 labeler(_sub(redex
)->_2
, s1__
, r__
);
555 s__
= Number_theta_4
[Number_mu_4_0
[s0__
]][Number_mu_4_1
[s1__
]]; } break;
556 case a_EXP::tag_mul
: {
559 labeler(_mul(redex
)->_1
, s0__
, r__
);
560 labeler(_mul(redex
)->_2
, s1__
, r__
);
561 s__
= Number_theta_5
[Number_mu_5_0
[s0__
]][Number_mu_5_1
[s1__
]]; } break;
565 labeler(_div(redex
)->_1
, s0__
, r__
);
566 labeler(_div(redex
)->_2
, s1__
, r__
);
567 s__
= Number_theta_6
[Number_mu_6_0
[s0__
]][Number_mu_6_1
[s1__
]]; } break;
571 #line 50 "bugfix3.pcc"
572 num(_num(_div(redex
)->_1
)->num
/ _num(_div(redex
)->_2
)->num
);
573 #line 51 "bugfix3.pcc"
576 #line 49 "bugfix3.pcc"
577 num(_num(_mul(redex
)->_1
)->num
* _num(_mul(redex
)->_2
)->num
);
579 #line 50 "bugfix3.pcc"
582 #line 48 "bugfix3.pcc"
583 num(_num(_sub(redex
)->_1
)->num
- _num(_sub(redex
)->_2
)->num
);
585 #line 49 "bugfix3.pcc"
588 #line 47 "bugfix3.pcc"
589 num(_num(_add(redex
)->_1
)->num
+ _num(_add(redex
)->_2
)->num
);
591 #line 48 "bugfix3.pcc"
597 void Number::labeler (NAT
& redex
, int& s__
, int r__
)
602 labeler(redex
->succ
, s0__
, r__
);
603 s__
= Number_theta_1
[Number_mu_1_0
[s0__
]];
611 #line 44 "bugfix3.pcc"
614 #line 45 "bugfix3.pcc"
617 #line 43 "bugfix3.pcc"
620 #line 44 "bugfix3.pcc"
623 #line 42 "bugfix3.pcc"
626 #line 43 "bugfix3.pcc"
632 #line 51 "bugfix3.pcc"
633 #line 51 "bugfix3.pcc"
635 #line 52 "bugfix3.pcc"
637 ------------------------------- Statistics -------------------------------
638 Merge matching rules = yes
639 Number of DFA nodes merged = 0
640 Number of ifs generated = 0
641 Number of switches generated = 0
644 Adaptive matching = disabled
645 Fast string matching = disabled
646 Inline downcasts = disabled
647 --------------------------------------------------------------------------