typename fix
[prop.git] / prop-src / prog.C
blob2cf4405c9cfbd3599cc2b8ba0814bf25566494e5
1 ///////////////////////////////////////////////////////////////////////////////
2 //  This file is generated automatically using Prop (version 2.3.3),
3 //  last updated on Mar 27, 1997.
4 //  The original source file is "prog.pC".
5 ///////////////////////////////////////////////////////////////////////////////
7 #define PROP_REWRITING_USED
8 #define PROP_PRINTER_USED
9 #define PROP_QUARK_USED
10 #include <propdefs.h>
11 #line 1 "prog.pC"
12 /////////////////////////////////////////////////////////////////////////////
13 //  This test implements a rewrite based simplifier for the abstract
14 //  syntax of a toy imperative language.  
15 /////////////////////////////////////////////////////////////////////////////
16 #include <iostream>
18 /////////////////////////////////////////////////////////////////////////////
19 //  The following recursive type equations define the abstract syntax
20 //  of our small language.
21 //  ( Note: we define our own boolean type because not all C++ compilers
22 //    have bool built-in yet. )
23 /////////////////////////////////////////////////////////////////////////////
24 #line 13 "prog.pC"
25 #line 50 "prog.pC"
26 ///////////////////////////////////////////////////////////////////////////////
28 // Forward class definition for List<T>
30 ///////////////////////////////////////////////////////////////////////////////
31 #ifndef datatype_List_defined
32 #define datatype_List_defined
33 template <class T> class a_List;
34 #define List(T) a_List<T> *
35 #endif
37 #  define nil_1_ 0
39 enum BOOL {
40    False = 0, True = 1
45 ///////////////////////////////////////////////////////////////////////////////
47 // Forward class definition for Exp
49 ///////////////////////////////////////////////////////////////////////////////
50 #ifndef datatype_Exp_defined
51 #define datatype_Exp_defined
52    class a_Exp;
53    typedef a_Exp * Exp;
54 #endif
56 enum BinOp {
57    add = 0, sub = 1, mul = 2, 
58    divide = 3, mod = 4, logical_and = 5, 
59    logical_or = 6, eq = 7, ge = 8, 
60    le = 9, lt = 10, gt = 11, 
61    ne = 12
66 enum UnaryOp {
67    uminus = 0, logical_not = 1
72 ///////////////////////////////////////////////////////////////////////////////
74 // Forward class definition for Stmt
76 ///////////////////////////////////////////////////////////////////////////////
77 #ifndef datatype_Stmt_defined
78 #define datatype_Stmt_defined
79    class a_Stmt;
80    typedef a_Stmt * Stmt;
81 #endif
83 ///////////////////////////////////////////////////////////////////////////////
85 // Forward class definition for Type
87 ///////////////////////////////////////////////////////////////////////////////
88 #ifndef datatype_Type_defined
89 #define datatype_Type_defined
90    class a_Type;
91    typedef a_Type * Type;
92 #endif
94 ///////////////////////////////////////////////////////////////////////////////
96 // Forward class definition for Decl
98 ///////////////////////////////////////////////////////////////////////////////
99 #ifndef datatype_Decl_defined
100 #define datatype_Decl_defined
101    class a_Decl;
102    typedef a_Decl * Decl;
103 #endif
105 ///////////////////////////////////////////////////////////////////////////////
107 // Forward class definition for LabeledType
109 ///////////////////////////////////////////////////////////////////////////////
110 #ifndef datatype_LabeledType_defined
111 #define datatype_LabeledType_defined
112    class a_LabeledType;
113    typedef a_LabeledType * LabeledType;
114 #endif
116 ///////////////////////////////////////////////////////////////////////////////
117 // Definition of type Id
118 ///////////////////////////////////////////////////////////////////////////////
119 #line 49 "prog.pC"
120 typedef char const * Id;
122 ///////////////////////////////////////////////////////////////////////////////
124 // Class for datatype constructor List<T>::#[...]
126 ///////////////////////////////////////////////////////////////////////////////
127 template <class T> class a_List : public TermObj {
128 public:
129 #line 13 "prog.pC"
130    T _1; a_List<T> *  _2; 
131    inline a_List (T x_1, a_List<T> *  x_2)
132     : _1(x_1), _2(x_2)
133    {
134    }
135    inline a_List (T x_1)
136     : _1(x_1), _2((a_List<T> *)0)
137    {
138    }
140 template <class T> inline int boxed(const a_List<T> * x) { return x != 0; }
141 template <class T> inline int untag(const a_List<T> * x) { return x ? 1 : 0; }
142 ///////////////////////////////////////////////////////////////////////////////
144 //  Pretty printing methods for List<T>
146 ///////////////////////////////////////////////////////////////////////////////
147 class PrettyOStream;
148 template <class T> extern std::ostream& operator<<(std::ostream&, List(T));
149 template <class T> extern PrettyOStream& operator<<(PrettyOStream&, List(T));
150 ///////////////////////////////////////////////////////////////////////////////
152 // Datatype constructor functions for List<T>
154 ///////////////////////////////////////////////////////////////////////////////
155 template <class T> inline a_List<T> * list_1_ (T x_1, a_List<T> *  x_2)
157    return new a_List<T> (x_1, x_2);
159 template <class T> inline a_List<T> * list_1_ (T x_1)
161    return new a_List<T> (x_1);
163 ///////////////////////////////////////////////////////////////////////////////
165 // Downcasting functions for List<T>
167 ///////////////////////////////////////////////////////////////////////////////
171 ///////////////////////////////////////////////////////////////////////////////
173 //  Pretty printing methods for BOOL
175 ///////////////////////////////////////////////////////////////////////////////
176 class PrettyOStream;
177 extern std::ostream& operator<<(std::ostream&, BOOL);
178 extern PrettyOStream& operator<<(PrettyOStream&, BOOL);
179 ///////////////////////////////////////////////////////////////////////////////
181 // Base class for datatype Exp
183 ///////////////////////////////////////////////////////////////////////////////
184 class a_Exp : public TermObj {
185 public:
186    enum Tag_Exp {
187       tag_integer = 0, tag_real = 1, tag_string = 2, 
188       tag_boolean = 3, tag_binop = 4, tag_unaryop = 5, 
189       tag_var = 6
190    };
192 public:
193    const Tag_Exp tag__; // variant tag
194 protected:
195    inline a_Exp(Tag_Exp t__) : tag__(t__) {}
196 public:
198 inline int boxed(const a_Exp *) { return 1; }
199 inline int untag(const a_Exp * x) { return x->tag__; }
200 ///////////////////////////////////////////////////////////////////////////////
202 //  Pretty printing methods for Exp
204 ///////////////////////////////////////////////////////////////////////////////
205 class PrettyOStream;
206 extern std::ostream& operator<<(std::ostream&, Exp);
207 extern PrettyOStream& operator<<(PrettyOStream&, Exp);
208 ///////////////////////////////////////////////////////////////////////////////
210 // Class for datatype constructor Exp::integer
212 ///////////////////////////////////////////////////////////////////////////////
213 class Exp_integer : public a_Exp {
214 public:
215 #line 18 "prog.pC"
216    int integer; 
217    inline Exp_integer (int x_integer)
218     : a_Exp(tag_integer), integer(x_integer)
219    {
220    }
223 ///////////////////////////////////////////////////////////////////////////////
225 // Class for datatype constructor Exp::real
227 ///////////////////////////////////////////////////////////////////////////////
228 class Exp_real : public a_Exp {
229 public:
230 #line 19 "prog.pC"
231    double real; 
232    inline Exp_real (double x_real)
233     : a_Exp(tag_real), real(x_real)
234    {
235    }
238 ///////////////////////////////////////////////////////////////////////////////
240 // Class for datatype constructor Exp::string
242 ///////////////////////////////////////////////////////////////////////////////
243 class Exp_string : public a_Exp {
244 public:
245 #line 20 "prog.pC"
246    char * string; 
247    inline Exp_string (char * x_string)
248     : a_Exp(tag_string), string(x_string)
249    {
250    }
253 ///////////////////////////////////////////////////////////////////////////////
255 // Class for datatype constructor Exp::boolean
257 ///////////////////////////////////////////////////////////////////////////////
258 class Exp_boolean : public a_Exp {
259 public:
260 #line 21 "prog.pC"
261    BOOL boolean; 
262    inline Exp_boolean (BOOL x_boolean)
263     : a_Exp(tag_boolean), boolean(x_boolean)
264    {
265    }
268 ///////////////////////////////////////////////////////////////////////////////
270 // Class for datatype constructor Exp::binop
272 ///////////////////////////////////////////////////////////////////////////////
273 class Exp_binop : public a_Exp {
274 public:
275 #line 22 "prog.pC"
276    BinOp _1; Exp _2; Exp _3; 
277    inline Exp_binop (BinOp x_1, Exp x_2, Exp x_3)
278     : a_Exp(tag_binop), _1(x_1), _2(x_2), _3(x_3)
279    {
280    }
283 ///////////////////////////////////////////////////////////////////////////////
285 // Class for datatype constructor Exp::unaryop
287 ///////////////////////////////////////////////////////////////////////////////
288 class Exp_unaryop : public a_Exp {
289 public:
290 #line 23 "prog.pC"
291    UnaryOp _1; Exp _2; 
292    inline Exp_unaryop (UnaryOp x_1, Exp x_2)
293     : a_Exp(tag_unaryop), _1(x_1), _2(x_2)
294    {
295    }
298 ///////////////////////////////////////////////////////////////////////////////
300 // Class for datatype constructor Exp::var
302 ///////////////////////////////////////////////////////////////////////////////
303 class Exp_var : public a_Exp {
304 public:
305 #line 24 "prog.pC"
306    Id var; 
307    inline Exp_var (Id x_var)
308     : a_Exp(tag_var), var(x_var)
309    {
310    }
313 ///////////////////////////////////////////////////////////////////////////////
315 // Datatype constructor functions for Exp
317 ///////////////////////////////////////////////////////////////////////////////
318 inline a_Exp * integer (int x_integer)
320    return new Exp_integer (x_integer);
322 inline a_Exp * real (double x_real)
324    return new Exp_real (x_real);
326 inline a_Exp * string (char * x_string)
328    return new Exp_string (x_string);
330 inline a_Exp * boolean (BOOL x_boolean)
332    return new Exp_boolean (x_boolean);
334 inline a_Exp * binop (BinOp x_1, Exp x_2, Exp x_3)
336    return new Exp_binop (x_1, x_2, x_3);
338 inline a_Exp * unaryop (UnaryOp x_1, Exp x_2)
340    return new Exp_unaryop (x_1, x_2);
342 inline a_Exp * var (Id x_var)
344    return new Exp_var (x_var);
346 ///////////////////////////////////////////////////////////////////////////////
348 // Downcasting functions for Exp
350 ///////////////////////////////////////////////////////////////////////////////
351 inline Exp_integer * _integer(const a_Exp * _x_) { return (Exp_integer *)_x_; }
352 inline Exp_real * _real(const a_Exp * _x_) { return (Exp_real *)_x_; }
353 inline Exp_string * _string(const a_Exp * _x_) { return (Exp_string *)_x_; }
354 inline Exp_boolean * _boolean(const a_Exp * _x_) { return (Exp_boolean *)_x_; }
355 inline Exp_binop * _binop(const a_Exp * _x_) { return (Exp_binop *)_x_; }
356 inline Exp_unaryop * _unaryop(const a_Exp * _x_) { return (Exp_unaryop *)_x_; }
357 inline Exp_var * _var(const a_Exp * _x_) { return (Exp_var *)_x_; }
360 ///////////////////////////////////////////////////////////////////////////////
362 //  Pretty printing methods for BinOp
364 ///////////////////////////////////////////////////////////////////////////////
365 class PrettyOStream;
366 extern std::ostream& operator<<(std::ostream&, BinOp);
367 extern PrettyOStream& operator<<(PrettyOStream&, BinOp);
368 ///////////////////////////////////////////////////////////////////////////////
370 //  Pretty printing methods for UnaryOp
372 ///////////////////////////////////////////////////////////////////////////////
373 class PrettyOStream;
374 extern std::ostream& operator<<(std::ostream&, UnaryOp);
375 extern PrettyOStream& operator<<(PrettyOStream&, UnaryOp);
376 ///////////////////////////////////////////////////////////////////////////////
378 // Base class for datatype Stmt
380 ///////////////////////////////////////////////////////////////////////////////
381 class a_Stmt : public TermObj {
382 public:
383    enum Tag_Stmt {
384       tag_assign_stmt = 0, tag_while_stmt = 1, tag_if_stmt = 2, 
385       tag_print_stmt = 3, tag_block_stmt = 4
386    };
388 public:
389    const Tag_Stmt tag__; // variant tag
390 protected:
391    inline a_Stmt(Tag_Stmt t__) : tag__(t__) {}
392 public:
394 inline int boxed(const a_Stmt *) { return 1; }
395 inline int untag(const a_Stmt * x) { return x->tag__; }
396 ///////////////////////////////////////////////////////////////////////////////
398 //  Pretty printing methods for Stmt
400 ///////////////////////////////////////////////////////////////////////////////
401 class PrettyOStream;
402 extern std::ostream& operator<<(std::ostream&, Stmt);
403 extern PrettyOStream& operator<<(PrettyOStream&, Stmt);
404 ///////////////////////////////////////////////////////////////////////////////
406 // Class for datatype constructor Stmt::assign_stmt
408 ///////////////////////////////////////////////////////////////////////////////
409 class Stmt_assign_stmt : public a_Stmt {
410 public:
411 #line 32 "prog.pC"
412    Id _1; Exp _2; 
413    inline Stmt_assign_stmt (Id x_1, Exp x_2)
414     : a_Stmt(tag_assign_stmt), _1(x_1), _2(x_2)
415    {
416    }
419 ///////////////////////////////////////////////////////////////////////////////
421 // Class for datatype constructor Stmt::while_stmt
423 ///////////////////////////////////////////////////////////////////////////////
424 class Stmt_while_stmt : public a_Stmt {
425 public:
426 #line 33 "prog.pC"
427    Exp _1; Stmt _2; 
428    inline Stmt_while_stmt (Exp x_1, Stmt x_2)
429     : a_Stmt(tag_while_stmt), _1(x_1), _2(x_2)
430    {
431    }
434 ///////////////////////////////////////////////////////////////////////////////
436 // Class for datatype constructor Stmt::if_stmt
438 ///////////////////////////////////////////////////////////////////////////////
439 class Stmt_if_stmt : public a_Stmt {
440 public:
441 #line 34 "prog.pC"
442    Exp _1; Stmt _2; Stmt _3; 
443    inline Stmt_if_stmt (Exp x_1, Stmt x_2, Stmt x_3)
444     : a_Stmt(tag_if_stmt), _1(x_1), _2(x_2), _3(x_3)
445    {
446    }
449 ///////////////////////////////////////////////////////////////////////////////
451 // Class for datatype constructor Stmt::print_stmt
453 ///////////////////////////////////////////////////////////////////////////////
454 class Stmt_print_stmt : public a_Stmt {
455 public:
456 #line 35 "prog.pC"
457    Exp print_stmt; 
458    inline Stmt_print_stmt (Exp x_print_stmt)
459     : a_Stmt(tag_print_stmt), print_stmt(x_print_stmt)
460    {
461    }
464 ///////////////////////////////////////////////////////////////////////////////
466 // Class for datatype constructor Stmt::block_stmt
468 ///////////////////////////////////////////////////////////////////////////////
469 class Stmt_block_stmt : public a_Stmt {
470 public:
471 #line 36 "prog.pC"
472    a_List<Decl> *  _1; a_List<Stmt> *  _2; 
473    inline Stmt_block_stmt (a_List<Decl> *  x_1, a_List<Stmt> *  x_2)
474     : a_Stmt(tag_block_stmt), _1(x_1), _2(x_2)
475    {
476    }
479 ///////////////////////////////////////////////////////////////////////////////
481 // Datatype constructor functions for Stmt
483 ///////////////////////////////////////////////////////////////////////////////
484 inline a_Stmt * assign_stmt (Id x_1, Exp x_2)
486    return new Stmt_assign_stmt (x_1, x_2);
488 inline a_Stmt * while_stmt (Exp x_1, Stmt x_2)
490    return new Stmt_while_stmt (x_1, x_2);
492 inline a_Stmt * if_stmt (Exp x_1, Stmt x_2, Stmt x_3)
494    return new Stmt_if_stmt (x_1, x_2, x_3);
496 inline a_Stmt * print_stmt (Exp x_print_stmt)
498    return new Stmt_print_stmt (x_print_stmt);
500 inline a_Stmt * block_stmt (a_List<Decl> *  x_1, a_List<Stmt> *  x_2)
502    return new Stmt_block_stmt (x_1, x_2);
504 ///////////////////////////////////////////////////////////////////////////////
506 // Downcasting functions for Stmt
508 ///////////////////////////////////////////////////////////////////////////////
509 inline Stmt_assign_stmt * _assign_stmt(const a_Stmt * _x_) { return (Stmt_assign_stmt *)_x_; }
510 inline Stmt_while_stmt * _while_stmt(const a_Stmt * _x_) { return (Stmt_while_stmt *)_x_; }
511 inline Stmt_if_stmt * _if_stmt(const a_Stmt * _x_) { return (Stmt_if_stmt *)_x_; }
512 inline Stmt_print_stmt * _print_stmt(const a_Stmt * _x_) { return (Stmt_print_stmt *)_x_; }
513 inline Stmt_block_stmt * _block_stmt(const a_Stmt * _x_) { return (Stmt_block_stmt *)_x_; }
515 ///////////////////////////////////////////////////////////////////////////////
517 // Base class for datatype Type
519 ///////////////////////////////////////////////////////////////////////////////
520 class a_Type : public TermObj {
521 public:
522    enum Tag_Type {
523       tag_primitive_type = 0, tag_pointer_type = 1, tag_array_type = 2, 
524       tag_function_type = 3, tag_tuple_type = 4, tag_record_type = 5
525    };
527 public:
528    const Tag_Type tag__; // variant tag
529 protected:
530    inline a_Type(Tag_Type t__) : tag__(t__) {}
531 public:
533 inline int boxed(const a_Type *) { return 1; }
534 inline int untag(const a_Type * x) { return x->tag__; }
535 ///////////////////////////////////////////////////////////////////////////////
537 //  Pretty printing methods for Type
539 ///////////////////////////////////////////////////////////////////////////////
540 class PrettyOStream;
541 extern std::ostream& operator<<(std::ostream&, Type);
542 extern PrettyOStream& operator<<(PrettyOStream&, Type);
543 ///////////////////////////////////////////////////////////////////////////////
545 // Class for datatype constructor Type::primitive_type
547 ///////////////////////////////////////////////////////////////////////////////
548 class Type_primitive_type : public a_Type {
549 public:
550 #line 38 "prog.pC"
551    Id primitive_type; 
552    inline Type_primitive_type (Id x_primitive_type)
553     : a_Type(tag_primitive_type), primitive_type(x_primitive_type)
554    {
555    }
558 ///////////////////////////////////////////////////////////////////////////////
560 // Class for datatype constructor Type::pointer_type
562 ///////////////////////////////////////////////////////////////////////////////
563 class Type_pointer_type : public a_Type {
564 public:
565 #line 39 "prog.pC"
566    Type pointer_type; 
567    inline Type_pointer_type (Type x_pointer_type)
568     : a_Type(tag_pointer_type), pointer_type(x_pointer_type)
569    {
570    }
573 ///////////////////////////////////////////////////////////////////////////////
575 // Class for datatype constructor Type::array_type
577 ///////////////////////////////////////////////////////////////////////////////
578 class Type_array_type : public a_Type {
579 public:
580 #line 40 "prog.pC"
581    Type element; Exp bound; 
582    inline Type_array_type (Type x_element, Exp x_bound)
583     : a_Type(tag_array_type), element(x_element), bound(x_bound)
584    {
585    }
588 ///////////////////////////////////////////////////////////////////////////////
590 // Class for datatype constructor Type::function_type
592 ///////////////////////////////////////////////////////////////////////////////
593 class Type_function_type : public a_Type {
594 public:
595 #line 41 "prog.pC"
596    Type arg; Type ret; 
597    inline Type_function_type (Type x_arg, Type x_ret)
598     : a_Type(tag_function_type), arg(x_arg), ret(x_ret)
599    {
600    }
603 ///////////////////////////////////////////////////////////////////////////////
605 // Class for datatype constructor Type::tuple_type
607 ///////////////////////////////////////////////////////////////////////////////
608 class Type_tuple_type : public a_Type {
609 public:
610 #line 42 "prog.pC"
611    a_List<Type> *  tuple_type; 
612    inline Type_tuple_type (a_List<Type> *  x_tuple_type)
613     : a_Type(tag_tuple_type), tuple_type(x_tuple_type)
614    {
615    }
618 ///////////////////////////////////////////////////////////////////////////////
620 // Class for datatype constructor Type::record_type
622 ///////////////////////////////////////////////////////////////////////////////
623 class Type_record_type : public a_Type {
624 public:
625 #line 43 "prog.pC"
626    a_List<LabeledType> *  record_type; 
627    inline Type_record_type (a_List<LabeledType> *  x_record_type)
628     : a_Type(tag_record_type), record_type(x_record_type)
629    {
630    }
633 ///////////////////////////////////////////////////////////////////////////////
635 // Datatype constructor functions for Type
637 ///////////////////////////////////////////////////////////////////////////////
638 inline a_Type * primitive_type (Id x_primitive_type)
640    return new Type_primitive_type (x_primitive_type);
642 inline a_Type * pointer_type (Type x_pointer_type)
644    return new Type_pointer_type (x_pointer_type);
646 inline a_Type * array_type (Type x_element, Exp x_bound)
648    return new Type_array_type (x_element, x_bound);
650 inline a_Type * function_type (Type x_arg, Type x_ret)
652    return new Type_function_type (x_arg, x_ret);
654 inline a_Type * tuple_type (a_List<Type> *  x_tuple_type)
656    return new Type_tuple_type (x_tuple_type);
658 inline a_Type * record_type (a_List<LabeledType> *  x_record_type)
660    return new Type_record_type (x_record_type);
662 ///////////////////////////////////////////////////////////////////////////////
664 // Downcasting functions for Type
666 ///////////////////////////////////////////////////////////////////////////////
667 inline Type_primitive_type * _primitive_type(const a_Type * _x_) { return (Type_primitive_type *)_x_; }
668 inline Type_pointer_type * _pointer_type(const a_Type * _x_) { return (Type_pointer_type *)_x_; }
669 inline Type_array_type * _array_type(const a_Type * _x_) { return (Type_array_type *)_x_; }
670 inline Type_function_type * _function_type(const a_Type * _x_) { return (Type_function_type *)_x_; }
671 inline Type_tuple_type * _tuple_type(const a_Type * _x_) { return (Type_tuple_type *)_x_; }
672 inline Type_record_type * _record_type(const a_Type * _x_) { return (Type_record_type *)_x_; }
674 ///////////////////////////////////////////////////////////////////////////////
676 // Class for datatype constructor Decl::decl
678 ///////////////////////////////////////////////////////////////////////////////
679 class a_Decl : public TermObj {
680 public:
681 #line 45 "prog.pC"
682    Id name; Type typ; 
683    inline a_Decl (Id x_name, Type x_typ)
684     : name(x_name), typ(x_typ)
685    {
686    }
688 inline int boxed(const a_Decl *) { return 1; }
689 inline int untag(const a_Decl *) { return 0; }
690 ///////////////////////////////////////////////////////////////////////////////
692 //  Pretty printing methods for Decl
694 ///////////////////////////////////////////////////////////////////////////////
695 class PrettyOStream;
696 extern std::ostream& operator<<(std::ostream&, Decl);
697 extern PrettyOStream& operator<<(PrettyOStream&, Decl);
698 ///////////////////////////////////////////////////////////////////////////////
700 // Datatype constructor functions for Decl
702 ///////////////////////////////////////////////////////////////////////////////
703 inline a_Decl * decl (Id x_name, Type x_typ)
705    return new a_Decl (x_name, x_typ);
707 ///////////////////////////////////////////////////////////////////////////////
709 // Downcasting functions for Decl
711 ///////////////////////////////////////////////////////////////////////////////
714 ///////////////////////////////////////////////////////////////////////////////
716 // Class for datatype constructor LabeledType::labeled_type
718 ///////////////////////////////////////////////////////////////////////////////
719 class a_LabeledType : public TermObj {
720 public:
721 #line 47 "prog.pC"
722    Id _1; Type _2; 
723    inline a_LabeledType (Id x_1, Type x_2)
724     : _1(x_1), _2(x_2)
725    {
726    }
728 inline int boxed(const a_LabeledType *) { return 1; }
729 inline int untag(const a_LabeledType *) { return 0; }
730 ///////////////////////////////////////////////////////////////////////////////
732 //  Pretty printing methods for LabeledType
734 ///////////////////////////////////////////////////////////////////////////////
735 class PrettyOStream;
736 extern std::ostream& operator<<(std::ostream&, LabeledType);
737 extern PrettyOStream& operator<<(PrettyOStream&, LabeledType);
738 ///////////////////////////////////////////////////////////////////////////////
740 // Datatype constructor functions for LabeledType
742 ///////////////////////////////////////////////////////////////////////////////
743 inline a_LabeledType * labeled_type (Id x_1, Type x_2)
745    return new a_LabeledType (x_1, x_2);
747 ///////////////////////////////////////////////////////////////////////////////
749 // Downcasting functions for LabeledType
751 ///////////////////////////////////////////////////////////////////////////////
754 #line 50 "prog.pC"
755 #line 50 "prog.pC"
756    
758 /////////////////////////////////////////////////////////////////////////////
759 //  Refine the implementation of the datatypes.
760 //  The qualifiers may be also declared in the datatype definition.
761 //  We qualify the datatypes here so that they won't clutter up
762 //  the equations above.
764 //  All types are declared to be printable by 
765 //  the printer method and rewritable.
766 /////////////////////////////////////////////////////////////////////////////
767 #line 61 "prog.pC"
768 #line 111 "prog.pC"
771 /////////////////////////////////////////////////////////////////////////////
772 //  Generate the interfaces to instantiated polymorphic datatypes.
773 //  These are not strictly necessary since the instantiation is in the
774 //  same file below.  However, in general the 'instantiate extern' declaration
775 //  must be placed in the .h files for each instance of a polymorphic
776 //  datatype.
777 /////////////////////////////////////////////////////////////////////////////
778 #line 121 "prog.pC"
779 #line 121 "prog.pC"
780 ///////////////////////////////////////////////////////////////////////////////
782 // Interface specification of datatype List<Type>
784 ///////////////////////////////////////////////////////////////////////////////
785 #line 121 "prog.pC"
786 ///////////////////////////////////////////////////////////////////////////////
788 // Pretty printing methods for List<Type>
790 ///////////////////////////////////////////////////////////////////////////////
791 std::ostream& operator << (std::ostream& strm__, a_List<Type> *   obj__);
792 PrettyOStream& operator << (PrettyOStream& strm__, a_List<Type> *   obj__);
794 ///////////////////////////////////////////////////////////////////////////////
796 // Interface specification of datatype List<Stmt>
798 ///////////////////////////////////////////////////////////////////////////////
799 #line 121 "prog.pC"
800 ///////////////////////////////////////////////////////////////////////////////
802 // Pretty printing methods for List<Stmt>
804 ///////////////////////////////////////////////////////////////////////////////
805 std::ostream& operator << (std::ostream& strm__, a_List<Stmt> *   obj__);
806 PrettyOStream& operator << (PrettyOStream& strm__, a_List<Stmt> *   obj__);
808 ///////////////////////////////////////////////////////////////////////////////
810 // Interface specification of datatype List<LabeledType>
812 ///////////////////////////////////////////////////////////////////////////////
813 #line 121 "prog.pC"
814 ///////////////////////////////////////////////////////////////////////////////
816 // Pretty printing methods for List<LabeledType>
818 ///////////////////////////////////////////////////////////////////////////////
819 std::ostream& operator << (std::ostream& strm__, a_List<LabeledType> *   obj__);
820 PrettyOStream& operator << (PrettyOStream& strm__, a_List<LabeledType> *   obj__);
822 ///////////////////////////////////////////////////////////////////////////////
824 // Interface specification of datatype List<Decl>
826 ///////////////////////////////////////////////////////////////////////////////
827 #line 121 "prog.pC"
828 ///////////////////////////////////////////////////////////////////////////////
830 // Pretty printing methods for List<Decl>
832 ///////////////////////////////////////////////////////////////////////////////
833 std::ostream& operator << (std::ostream& strm__, a_List<Decl> *   obj__);
834 PrettyOStream& operator << (PrettyOStream& strm__, a_List<Decl> *   obj__);
836 #line 122 "prog.pC"
837 #line 122 "prog.pC"
840 /////////////////////////////////////////////////////////////////////////////
841 //  Now instantiate all the datatypes.
842 /////////////////////////////////////////////////////////////////////////////
843 #line 127 "prog.pC"
844 #line 127 "prog.pC"
845 ///////////////////////////////////////////////////////////////////////////////
847 // Interface specification of datatype Exp
849 ///////////////////////////////////////////////////////////////////////////////
850 #line 127 "prog.pC"
851 ///////////////////////////////////////////////////////////////////////////////
853 // Pretty printing methods for Exp
855 ///////////////////////////////////////////////////////////////////////////////
856 std::ostream& operator << (std::ostream& strm__, Exp  obj__);
857 PrettyOStream& operator << (PrettyOStream& strm__, Exp  obj__);
859 ///////////////////////////////////////////////////////////////////////////////
861 // Interface specification of datatype BOOL
863 ///////////////////////////////////////////////////////////////////////////////
864 #line 127 "prog.pC"
865 ///////////////////////////////////////////////////////////////////////////////
867 // Pretty printing methods for BOOL
869 ///////////////////////////////////////////////////////////////////////////////
870 std::ostream& operator << (std::ostream& strm__, BOOL  obj__);
871 PrettyOStream& operator << (PrettyOStream& strm__, BOOL  obj__);
873 ///////////////////////////////////////////////////////////////////////////////
875 // Interface specification of datatype BinOp
877 ///////////////////////////////////////////////////////////////////////////////
878 #line 127 "prog.pC"
879 ///////////////////////////////////////////////////////////////////////////////
881 // Pretty printing methods for BinOp
883 ///////////////////////////////////////////////////////////////////////////////
884 std::ostream& operator << (std::ostream& strm__, BinOp  obj__);
885 PrettyOStream& operator << (PrettyOStream& strm__, BinOp  obj__);
887 ///////////////////////////////////////////////////////////////////////////////
889 // Interface specification of datatype UnaryOp
891 ///////////////////////////////////////////////////////////////////////////////
892 #line 127 "prog.pC"
893 ///////////////////////////////////////////////////////////////////////////////
895 // Pretty printing methods for UnaryOp
897 ///////////////////////////////////////////////////////////////////////////////
898 std::ostream& operator << (std::ostream& strm__, UnaryOp  obj__);
899 PrettyOStream& operator << (PrettyOStream& strm__, UnaryOp  obj__);
901 ///////////////////////////////////////////////////////////////////////////////
903 // Interface specification of datatype Stmt
905 ///////////////////////////////////////////////////////////////////////////////
906 #line 127 "prog.pC"
907 ///////////////////////////////////////////////////////////////////////////////
909 // Pretty printing methods for Stmt
911 ///////////////////////////////////////////////////////////////////////////////
912 std::ostream& operator << (std::ostream& strm__, Stmt  obj__);
913 PrettyOStream& operator << (PrettyOStream& strm__, Stmt  obj__);
915 ///////////////////////////////////////////////////////////////////////////////
917 // Interface specification of datatype Type
919 ///////////////////////////////////////////////////////////////////////////////
920 #line 127 "prog.pC"
921 ///////////////////////////////////////////////////////////////////////////////
923 // Pretty printing methods for Type
925 ///////////////////////////////////////////////////////////////////////////////
926 std::ostream& operator << (std::ostream& strm__, Type  obj__);
927 PrettyOStream& operator << (PrettyOStream& strm__, Type  obj__);
929 ///////////////////////////////////////////////////////////////////////////////
931 // Interface specification of datatype Decl
933 ///////////////////////////////////////////////////////////////////////////////
934 #line 127 "prog.pC"
935 ///////////////////////////////////////////////////////////////////////////////
937 // Pretty printing methods for Decl
939 ///////////////////////////////////////////////////////////////////////////////
940 std::ostream& operator << (std::ostream& strm__, Decl  obj__);
941 PrettyOStream& operator << (PrettyOStream& strm__, Decl  obj__);
943 ///////////////////////////////////////////////////////////////////////////////
945 // Interface specification of datatype LabeledType
947 ///////////////////////////////////////////////////////////////////////////////
948 #line 127 "prog.pC"
949 ///////////////////////////////////////////////////////////////////////////////
951 // Pretty printing methods for LabeledType
953 ///////////////////////////////////////////////////////////////////////////////
954 std::ostream& operator << (std::ostream& strm__, LabeledType  obj__);
955 PrettyOStream& operator << (PrettyOStream& strm__, LabeledType  obj__);
957 ///////////////////////////////////////////////////////////////////////////////
959 // Interface specification of datatype List<Type>
961 ///////////////////////////////////////////////////////////////////////////////
962 #line 127 "prog.pC"
963 ///////////////////////////////////////////////////////////////////////////////
965 // Pretty printing methods for List<Type>
967 ///////////////////////////////////////////////////////////////////////////////
968 std::ostream& operator << (std::ostream& strm__, a_List<Type> *   obj__);
969 PrettyOStream& operator << (PrettyOStream& strm__, a_List<Type> *   obj__);
971 ///////////////////////////////////////////////////////////////////////////////
973 // Interface specification of datatype List<Stmt>
975 ///////////////////////////////////////////////////////////////////////////////
976 #line 127 "prog.pC"
977 ///////////////////////////////////////////////////////////////////////////////
979 // Pretty printing methods for List<Stmt>
981 ///////////////////////////////////////////////////////////////////////////////
982 std::ostream& operator << (std::ostream& strm__, a_List<Stmt> *   obj__);
983 PrettyOStream& operator << (PrettyOStream& strm__, a_List<Stmt> *   obj__);
985 ///////////////////////////////////////////////////////////////////////////////
987 // Interface specification of datatype List<LabeledType>
989 ///////////////////////////////////////////////////////////////////////////////
990 #line 127 "prog.pC"
991 ///////////////////////////////////////////////////////////////////////////////
993 // Pretty printing methods for List<LabeledType>
995 ///////////////////////////////////////////////////////////////////////////////
996 std::ostream& operator << (std::ostream& strm__, a_List<LabeledType> *   obj__);
997 PrettyOStream& operator << (PrettyOStream& strm__, a_List<LabeledType> *   obj__);
999 ///////////////////////////////////////////////////////////////////////////////
1001 // Interface specification of datatype List<Decl>
1003 ///////////////////////////////////////////////////////////////////////////////
1004 #line 127 "prog.pC"
1005 ///////////////////////////////////////////////////////////////////////////////
1007 // Pretty printing methods for List<Decl>
1009 ///////////////////////////////////////////////////////////////////////////////
1010 std::ostream& operator << (std::ostream& strm__, a_List<Decl> *   obj__);
1011 PrettyOStream& operator << (PrettyOStream& strm__, a_List<Decl> *   obj__);
1013 ///////////////////////////////////////////////////////////////////////////////
1015 // Instantiation of datatype Exp
1017 ///////////////////////////////////////////////////////////////////////////////
1018 #line 127 "prog.pC"
1019 ///////////////////////////////////////////////////////////////////////////////
1021 // Pretty printing methods for Exp
1023 ///////////////////////////////////////////////////////////////////////////////
1024 std::ostream& operator << (std::ostream& strm__, Exp  obj__)
1025 {  PrettyOStream S(strm__); S << obj__; return strm__; }
1027 PrettyOStream& operator << (PrettyOStream& strm__, Exp  obj__)
1029    switch (untag(obj__))
1030    {
1031       case 0: 
1032          strm__ << _integer(obj__)->integer; // int
1033          break;
1034       case 1: 
1035          strm__ << _real(obj__)->real; // double
1036          break;
1037       case 2: 
1038          strm__ << "\"";
1039          strm__ << _string(obj__)->string; // char *
1040          strm__ << "\"";
1041          break;
1042       case 3: 
1043          strm__ << _boolean(obj__)->boolean; // BOOL
1044          break;
1045       case 4: 
1046          strm__ << '(';
1047          strm__ << _binop(obj__)->_2;
1048          strm__ << _binop(obj__)->_1;
1049          strm__ << _binop(obj__)->_3;
1050          strm__ << ')';
1051          break;
1052       case 5: 
1053          strm__ << '(';
1054          strm__ << _unaryop(obj__)->_1; // UnaryOp
1055          strm__ << _unaryop(obj__)->_2; // Exp
1056          strm__ << ')';
1057          break;
1058       case 6: 
1059          strm__ << _var(obj__)->var; // char const *
1060          break;
1061    }
1062    return strm__;
1067 ///////////////////////////////////////////////////////////////////////////////
1069 // Instantiation of datatype BOOL
1071 ///////////////////////////////////////////////////////////////////////////////
1072 #line 127 "prog.pC"
1073 ///////////////////////////////////////////////////////////////////////////////
1075 // Pretty printing methods for BOOL
1077 ///////////////////////////////////////////////////////////////////////////////
1078 std::ostream& operator << (std::ostream& strm__, BOOL  obj__)
1079 {  PrettyOStream S(strm__); S << obj__; return strm__; }
1081 PrettyOStream& operator << (PrettyOStream& strm__, BOOL  obj__)
1083    switch (obj__)
1084    {
1085       case False: 
1086          strm__ << "false";
1087          break;
1088       case True: 
1089          strm__ << "true";
1090          break;
1091    }
1092    return strm__;
1097 ///////////////////////////////////////////////////////////////////////////////
1099 // Instantiation of datatype BinOp
1101 ///////////////////////////////////////////////////////////////////////////////
1102 #line 127 "prog.pC"
1103 ///////////////////////////////////////////////////////////////////////////////
1105 // Pretty printing methods for BinOp
1107 ///////////////////////////////////////////////////////////////////////////////
1108 std::ostream& operator << (std::ostream& strm__, BinOp  obj__)
1109 {  PrettyOStream S(strm__); S << obj__; return strm__; }
1111 PrettyOStream& operator << (PrettyOStream& strm__, BinOp  obj__)
1113    switch (obj__)
1114    {
1115       case add: 
1116          strm__ << '+';
1117          break;
1118       case sub: 
1119          strm__ << '-';
1120          break;
1121       case mul: 
1122          strm__ << '*';
1123          break;
1124       case divide: 
1125          strm__ << '/';
1126          break;
1127       case mod: 
1128          strm__ << "mod";
1129          break;
1130       case logical_and: 
1131          strm__ << "and";
1132          break;
1133       case logical_or: 
1134          strm__ << "or";
1135          break;
1136       case eq: 
1137          strm__ << '=';
1138          break;
1139       case ge: 
1140          strm__ << ">=";
1141          break;
1142       case le: 
1143          strm__ << "<=";
1144          break;
1145       case lt: 
1146          strm__ << '<';
1147          break;
1148       case gt: 
1149          strm__ << '>';
1150          break;
1151       case ne: 
1152          strm__ << "<>";
1153          break;
1154    }
1155    return strm__;
1160 ///////////////////////////////////////////////////////////////////////////////
1162 // Instantiation of datatype UnaryOp
1164 ///////////////////////////////////////////////////////////////////////////////
1165 #line 127 "prog.pC"
1166 ///////////////////////////////////////////////////////////////////////////////
1168 // Pretty printing methods for UnaryOp
1170 ///////////////////////////////////////////////////////////////////////////////
1171 std::ostream& operator << (std::ostream& strm__, UnaryOp  obj__)
1172 {  PrettyOStream S(strm__); S << obj__; return strm__; }
1174 PrettyOStream& operator << (PrettyOStream& strm__, UnaryOp  obj__)
1176    switch (obj__)
1177    {
1178       case uminus: 
1179          strm__ << '-';
1180          break;
1181       case logical_not: 
1182          strm__ << "not";
1183          break;
1184    }
1185    return strm__;
1190 ///////////////////////////////////////////////////////////////////////////////
1192 // Instantiation of datatype Stmt
1194 ///////////////////////////////////////////////////////////////////////////////
1195 #line 127 "prog.pC"
1196 ///////////////////////////////////////////////////////////////////////////////
1198 // Pretty printing methods for Stmt
1200 ///////////////////////////////////////////////////////////////////////////////
1201 std::ostream& operator << (std::ostream& strm__, Stmt  obj__)
1202 {  PrettyOStream S(strm__); S << obj__; return strm__; }
1204 PrettyOStream& operator << (PrettyOStream& strm__, Stmt  obj__)
1206    switch (untag(obj__))
1207    {
1208       case 0: 
1209          strm__ << _assign_stmt(obj__)->_1; // Id
1210          strm__ << ":=";
1211          strm__ << _assign_stmt(obj__)->_2; // Exp
1212          strm__ << ';';
1213          break;
1214       case 1: 
1215          strm__ << "while";
1216          strm__ << _while_stmt(obj__)->_1; // Exp
1217          strm__ << "do";
1218          strm__.indent().newline().tab();
1219          strm__ << _while_stmt(obj__)->_2; // Stmt
1220          strm__.unindent().newline().tab();
1221          strm__ << "end while;";
1222          break;
1223       case 2: 
1224          strm__ << "if";
1225          strm__ << _if_stmt(obj__)->_1; // Exp
1226          strm__ << "then";
1227          strm__.indent().newline().tab();
1228          strm__ << _if_stmt(obj__)->_2; // Stmt
1229          strm__.unindent().newline().tab();
1230          strm__ << "else";
1231          strm__.indent().newline().tab();
1232          strm__ << _if_stmt(obj__)->_3; // Stmt
1233          strm__.unindent().newline().tab();
1234          strm__ << "endif;";
1235          break;
1236       case 3: 
1237          strm__ << "print";
1238          strm__ << _print_stmt(obj__)->print_stmt; // Exp
1239          strm__ << ';';
1240          break;
1241       case 4: 
1242          strm__ << "begin";
1243          strm__.indent().newline().tab();
1244          strm__ << _block_stmt(obj__)->_1; // List<Decl> 
1245          strm__.newline().tab();
1246          strm__ << _block_stmt(obj__)->_2; // List<Stmt> 
1247          strm__.unindent().newline().tab();
1248          strm__ << "end";
1249          break;
1250    }
1251    return strm__;
1256 ///////////////////////////////////////////////////////////////////////////////
1258 // Instantiation of datatype Type
1260 ///////////////////////////////////////////////////////////////////////////////
1261 #line 127 "prog.pC"
1262 ///////////////////////////////////////////////////////////////////////////////
1264 // Pretty printing methods for Type
1266 ///////////////////////////////////////////////////////////////////////////////
1267 std::ostream& operator << (std::ostream& strm__, Type  obj__)
1268 {  PrettyOStream S(strm__); S << obj__; return strm__; }
1270 PrettyOStream& operator << (PrettyOStream& strm__, Type  obj__)
1272    switch (untag(obj__))
1273    {
1274       case 0: 
1275          strm__ << _primitive_type(obj__)->primitive_type; // char const *
1276          break;
1277       case 1: 
1278          strm__ << _pointer_type(obj__)->pointer_type; // Type
1279          strm__ << '^';
1280          break;
1281       case 2: 
1282          strm__ << "array";
1283          strm__ << _array_type(obj__)->bound;
1284          strm__ << "of";
1285          strm__ << _array_type(obj__)->element;
1286          break;
1287       case 3: 
1288          strm__ << _function_type(obj__)->arg;
1289          strm__ << "->";
1290          strm__ << _function_type(obj__)->ret;
1291          break;
1292       case 4: 
1293          strm__ << "tuple_type";
1294          strm__ << '(';
1295          strm__ << _tuple_type(obj__)->tuple_type; // List<Type> 
1296          strm__ << ')';
1297          break;
1298       case 5: 
1299          strm__ << "record_type";
1300          strm__ << '(';
1301          strm__ << _record_type(obj__)->record_type; // List<LabeledType> 
1302          strm__ << ')';
1303          break;
1304    }
1305    return strm__;
1310 ///////////////////////////////////////////////////////////////////////////////
1312 // Instantiation of datatype Decl
1314 ///////////////////////////////////////////////////////////////////////////////
1315 #line 127 "prog.pC"
1316 ///////////////////////////////////////////////////////////////////////////////
1318 // Pretty printing methods for Decl
1320 ///////////////////////////////////////////////////////////////////////////////
1321 std::ostream& operator << (std::ostream& strm__, Decl  obj__)
1322 {  PrettyOStream S(strm__); S << obj__; return strm__; }
1324 PrettyOStream& operator << (PrettyOStream& strm__, Decl  obj__)
1326    strm__ << "var";
1327    strm__ << obj__->name;
1328    strm__ << ':';
1329    strm__ << obj__->typ;
1330    strm__ << ';';
1331    return strm__;
1336 ///////////////////////////////////////////////////////////////////////////////
1338 // Instantiation of datatype LabeledType
1340 ///////////////////////////////////////////////////////////////////////////////
1341 #line 127 "prog.pC"
1342 ///////////////////////////////////////////////////////////////////////////////
1344 // Pretty printing methods for LabeledType
1346 ///////////////////////////////////////////////////////////////////////////////
1347 std::ostream& operator << (std::ostream& strm__, LabeledType  obj__)
1348 {  PrettyOStream S(strm__); S << obj__; return strm__; }
1350 PrettyOStream& operator << (PrettyOStream& strm__, LabeledType  obj__)
1352    strm__ << obj__->_1; // Id
1353    strm__ << ':';
1354    strm__ << obj__->_2; // Type
1355    return strm__;
1360 ///////////////////////////////////////////////////////////////////////////////
1362 // Instantiation of datatype List<Type>
1364 ///////////////////////////////////////////////////////////////////////////////
1365 #line 127 "prog.pC"
1366 #ifdef PROP_EXPLICIT_TEMPLATE_INSTANTIATION
1367 template class a_List<Type>;
1368 template a_List<Type> * list_1_(Decl x_1, a_List<Decl> *  x_2);
1369 template a_List<Type> * list_1_(Decl x_list_1_);
1370 template int boxed(const a_List<Type> *);
1371 template int untag(const a_List<Type> *);
1372 #endif /* PROP_EXPLICIT_TEMPLATE_INSTANTIATION */
1373 ///////////////////////////////////////////////////////////////////////////////
1375 // Pretty printing methods for List<Type>
1377 ///////////////////////////////////////////////////////////////////////////////
1378 std::ostream& operator << (std::ostream& strm__, a_List<Type> *   obj__)
1379 {  PrettyOStream S(strm__); S << obj__; return strm__; }
1381 PrettyOStream& operator << (PrettyOStream& strm__, a_List<Type> *   obj__)
1383    switch (untag(obj__))
1384    {
1385       case ((int)nil_1_): 
1386          strm__ << "";
1387          break;
1388       case 1: 
1389          strm__ << obj__->_1; // Type
1390          strm__.newline().tab();
1391          strm__ << obj__->_2; // List<Type> 
1392          break;
1393    }
1394    return strm__;
1399 ///////////////////////////////////////////////////////////////////////////////
1401 // Instantiation of datatype List<Stmt>
1403 ///////////////////////////////////////////////////////////////////////////////
1404 #line 127 "prog.pC"
1405 #ifdef PROP_EXPLICIT_TEMPLATE_INSTANTIATION
1406 template class a_List<Stmt>;
1407 template a_List<Stmt> * list_1_(Type x_1, a_List<Type> *  x_2);
1408 template a_List<Stmt> * list_1_(Type x_list_1_);
1409 template int boxed(const a_List<Stmt> *);
1410 template int untag(const a_List<Stmt> *);
1411 #endif /* PROP_EXPLICIT_TEMPLATE_INSTANTIATION */
1412 ///////////////////////////////////////////////////////////////////////////////
1414 // Pretty printing methods for List<Stmt>
1416 ///////////////////////////////////////////////////////////////////////////////
1417 std::ostream& operator << (std::ostream& strm__, a_List<Stmt> *   obj__)
1418 {  PrettyOStream S(strm__); S << obj__; return strm__; }
1420 PrettyOStream& operator << (PrettyOStream& strm__, a_List<Stmt> *   obj__)
1422    switch (untag(obj__))
1423    {
1424       case ((int)nil_1_): 
1425          strm__ << "";
1426          break;
1427       case 1: 
1428          strm__ << obj__->_1; // Stmt
1429          strm__.newline().tab();
1430          strm__ << obj__->_2; // List<Stmt> 
1431          break;
1432    }
1433    return strm__;
1438 ///////////////////////////////////////////////////////////////////////////////
1440 // Instantiation of datatype List<LabeledType>
1442 ///////////////////////////////////////////////////////////////////////////////
1443 #line 127 "prog.pC"
1444 #ifdef PROP_EXPLICIT_TEMPLATE_INSTANTIATION
1445 template class a_List<LabeledType>;
1446 template a_List<LabeledType> * list_1_(Stmt x_1, a_List<Stmt> *  x_2);
1447 template a_List<LabeledType> * list_1_(Stmt x_list_1_);
1448 template int boxed(const a_List<LabeledType> *);
1449 template int untag(const a_List<LabeledType> *);
1450 #endif /* PROP_EXPLICIT_TEMPLATE_INSTANTIATION */
1451 ///////////////////////////////////////////////////////////////////////////////
1453 // Pretty printing methods for List<LabeledType>
1455 ///////////////////////////////////////////////////////////////////////////////
1456 std::ostream& operator << (std::ostream& strm__, a_List<LabeledType> *   obj__)
1457 {  PrettyOStream S(strm__); S << obj__; return strm__; }
1459 PrettyOStream& operator << (PrettyOStream& strm__, a_List<LabeledType> *   obj__)
1461    switch (untag(obj__))
1462    {
1463       case ((int)nil_1_): 
1464          strm__ << "";
1465          break;
1466       case 1: 
1467          strm__ << obj__->_1; // LabeledType
1468          strm__.newline().tab();
1469          strm__ << obj__->_2; // List<LabeledType> 
1470          break;
1471    }
1472    return strm__;
1477 ///////////////////////////////////////////////////////////////////////////////
1479 // Instantiation of datatype List<Decl>
1481 ///////////////////////////////////////////////////////////////////////////////
1482 #line 127 "prog.pC"
1483 #ifdef PROP_EXPLICIT_TEMPLATE_INSTANTIATION
1484 template class a_List<Decl>;
1485 template a_List<Decl> * list_1_(LabeledType x_1, a_List<LabeledType> *  x_2);
1486 template a_List<Decl> * list_1_(LabeledType x_list_1_);
1487 template int boxed(const a_List<Decl> *);
1488 template int untag(const a_List<Decl> *);
1489 #endif /* PROP_EXPLICIT_TEMPLATE_INSTANTIATION */
1490 ///////////////////////////////////////////////////////////////////////////////
1492 // Pretty printing methods for List<Decl>
1494 ///////////////////////////////////////////////////////////////////////////////
1495 std::ostream& operator << (std::ostream& strm__, a_List<Decl> *   obj__)
1496 {  PrettyOStream S(strm__); S << obj__; return strm__; }
1498 PrettyOStream& operator << (PrettyOStream& strm__, a_List<Decl> *   obj__)
1500    switch (untag(obj__))
1501    {
1502       case ((int)nil_1_): 
1503          strm__ << "";
1504          break;
1505       case 1: 
1506          strm__ << obj__->_1; // Decl
1507          strm__.newline().tab();
1508          strm__ << obj__->_2; // List<Decl> 
1509          break;
1510    }
1511    return strm__;
1516 #line 128 "prog.pC"
1517 #line 128 "prog.pC"
1520 /////////////////////////////////////////////////////////////////////////////
1521 //  Defines the interface of a rewrite class Simplify.
1522 //  All types that are referenced (directly or indirectly) should be
1523 //  declared in the interface.
1524 /////////////////////////////////////////////////////////////////////////////
1525 #line 135 "prog.pC"
1526 #line 144 "prog.pC"
1527 class Simplify : public BURS {
1528 private:
1529    Simplify(const Simplify&);