1 ///////////////////////////////////////////////////////////////////////////////
2 // This file is generated automatically using Prop (version 2.3.6),
3 // last updated on Nov 2, 1999.
4 // The original source file is "ast.ph".
5 ///////////////////////////////////////////////////////////////////////////////
8 ///////////////////////////////////////////////////////////////////////////////
10 // This file contains the abstract syntax tree definitions for the
11 // Prop language. For simplicity, C++ statements are currently not
12 // handled directly in the AST.
14 ///////////////////////////////////////////////////////////////////////////////
15 #ifndef abstract_syntax_tree_h
16 #define abstract_syntax_tree_h
21 ///////////////////////////////////////////////////////////////////////////////
23 // Options to the pattern matching compiler.
25 ///////////////////////////////////////////////////////////////////////////////
26 enum { MATCHnone
= 0, // no option (select first matching rule)
27 MATCHall
= 1<<0, // select all matching rules
28 MATCHwhile
= 1<<1, // loop back
29 MATCHnocheck
= 1<<2, // no checking
30 MATCHwithcost
= 1<<3, // with cost minimization
31 MATCHwithintcost
= 1<<4, // with integer costs
32 MATCHwithexpcost
= 1<<5, // with expression costs
33 MATCHwithtreecost
= 1<<6, // use cumulative cost
34 MATCHrefutable
= 1<<7, // pattern is refutable
35 MATCHscanner
= 1<<8, // lexical scanner
36 MATCHcaseinsensitive
= 1<<9, // insensitive case during string matching
37 MATCHlexemepat
= 1<<10, // with lexeme pattern
38 MATCHnotrace
= 1<<11, // no tracing
39 MATCHunification
= 1<<12 // unification mode
42 ///////////////////////////////////////////////////////////////////////////////
44 // Forward type declarations.
45 // These are defined in other places.
47 ///////////////////////////////////////////////////////////////////////////////
50 ///////////////////////////////////////////////////////////////////////////////
52 // Forward class definition for Ty
54 ///////////////////////////////////////////////////////////////////////////////
55 #ifndef datatype_Ty_defined
56 #define datatype_Ty_defined
61 ///////////////////////////////////////////////////////////////////////////////
63 // Forward class definition for Pat
65 ///////////////////////////////////////////////////////////////////////////////
66 #ifndef datatype_Pat_defined
67 #define datatype_Pat_defined
72 ///////////////////////////////////////////////////////////////////////////////
74 // Forward class definition for Cons
76 ///////////////////////////////////////////////////////////////////////////////
77 #ifndef datatype_Cons_defined
78 #define datatype_Cons_defined
80 typedef a_Cons
* Cons
;
83 ///////////////////////////////////////////////////////////////////////////////
85 // Forward class definition for Literal
87 ///////////////////////////////////////////////////////////////////////////////
88 #ifndef datatype_Literal_defined
89 #define datatype_Literal_defined
91 typedef a_Literal
* Literal
;
94 ///////////////////////////////////////////////////////////////////////////////
96 // Forward class definition for GramExp
98 ///////////////////////////////////////////////////////////////////////////////
99 #ifndef datatype_GramExp_defined
100 #define datatype_GramExp_defined
102 typedef a_GramExp
* GramExp
;
105 ///////////////////////////////////////////////////////////////////////////////
107 // Forward class definition for FieldDef
109 ///////////////////////////////////////////////////////////////////////////////
110 #ifndef datatype_FieldDef_defined
111 #define datatype_FieldDef_defined
113 typedef a_FieldDef
* FieldDef
;
116 ///////////////////////////////////////////////////////////////////////////////
118 // Forward class definition for FieldLaw
120 ///////////////////////////////////////////////////////////////////////////////
121 #ifndef datatype_FieldLaw_defined
122 #define datatype_FieldLaw_defined
124 typedef a_FieldLaw
* FieldLaw
;
127 ///////////////////////////////////////////////////////////////////////////////
129 // Forward class definition for Stmt
131 ///////////////////////////////////////////////////////////////////////////////
132 #ifndef datatype_Stmt_defined
133 #define datatype_Stmt_defined
135 typedef a_Stmt
* Stmt
;
138 ///////////////////////////////////////////////////////////////////////////////
140 // Forward class definition for Def
142 ///////////////////////////////////////////////////////////////////////////////
143 #ifndef datatype_Def_defined
144 #define datatype_Def_defined
149 ///////////////////////////////////////////////////////////////////////////////
151 // Forward class definition for Cost
153 ///////////////////////////////////////////////////////////////////////////////
154 #ifndef datatype_Cost_defined
155 #define datatype_Cost_defined
157 typedef a_Cost
* Cost
;
160 ///////////////////////////////////////////////////////////////////////////////
162 // Forward class definition for ConstraintSet
164 ///////////////////////////////////////////////////////////////////////////////
165 #ifndef datatype_ConstraintSet_defined
166 #define datatype_ConstraintSet_defined
167 class a_ConstraintSet
;
168 typedef a_ConstraintSet
* ConstraintSet
;
171 ///////////////////////////////////////////////////////////////////////////////
173 // Forward class definition for GraphRewritingRule
175 ///////////////////////////////////////////////////////////////////////////////
176 #ifndef datatype_GraphRewritingRule_defined
177 #define datatype_GraphRewritingRule_defined
178 class a_GraphRewritingRule
;
179 typedef a_GraphRewritingRule
* GraphRewritingRule
;
186 class ClassDefinition
;
187 class RewriteIndexing
;
189 ///////////////////////////////////////////////////////////////////////////////
191 // Information on a match rule.
193 ///////////////////////////////////////////////////////////////////////////////
194 class MatchRuleInfo
: public Loc
195 { MatchRuleInfo (const MatchRuleInfo
&); // no copy constructor
196 void operator = (const MatchRuleInfo
&); // no assignment
198 Bool used
; // is the rule being used?
199 Ty ty
; // type of pattern
200 int rule_number
; // rule number
201 Bool negated
; // negation in inference?
202 Bool rewriting
; // A rewriting pattern?
203 Bool is_chain_rule
; // Chain rule?
205 { BEFORE
, PREORDER
, POSTORDER
, TOPDOWN
, BOTTOMUP
, LAST_REWRITING_MODE
206 } mode
; // rewriting mode
208 { NO_OPTIONS
= 0, CUTREWRITE
= 1, REPLACEMENT
= 2, FAILREWRITE
= 4 };
209 typedef int RewritingOption
;
210 RewritingOption option
;
215 ///////////////////////////////////////////////////////////////////////////////
219 ///////////////////////////////////////////////////////////////////////////////
222 ///////////////////////////////////////////////////////////////////////////////
224 // Forward class definition for Exp
226 ///////////////////////////////////////////////////////////////////////////////
227 #ifndef datatype_Exp_defined
228 #define datatype_Exp_defined
233 # define NOexp (Exp)0
236 ARBop
= 0, DOMop
= 1, RANop
= 2,
237 CARDop
= 3, WITHop
= 4, WITHASSIGNop
= 5,
238 LESSop
= 6, LESSASSIGNop
= 7
243 ///////////////////////////////////////////////////////////////////////////////
245 // Forward class definition for Generator
247 ///////////////////////////////////////////////////////////////////////////////
248 #ifndef datatype_Generator_defined
249 #define datatype_Generator_defined
251 typedef a_Generator
* Generator
;
254 ///////////////////////////////////////////////////////////////////////////////
256 // Forward class definition for MatchExp
258 ///////////////////////////////////////////////////////////////////////////////
259 #ifndef datatype_MatchExp_defined
260 #define datatype_MatchExp_defined
262 typedef a_MatchExp
* MatchExp
;
265 ///////////////////////////////////////////////////////////////////////////////
267 // Forward class definition for MatchRule
269 ///////////////////////////////////////////////////////////////////////////////
270 #ifndef datatype_MatchRule_defined
271 #define datatype_MatchRule_defined
273 typedef a_MatchRule
* MatchRule
;
276 ///////////////////////////////////////////////////////////////////////////////
278 // Forward class definition for Decl
280 ///////////////////////////////////////////////////////////////////////////////
281 #ifndef datatype_Decl_defined
282 #define datatype_Decl_defined
284 typedef a_Decl
* Decl
;
287 # define NOdecl (Decl)0
289 enum EntryDirection
{
290 LEFTdirection
= 0, RIGHTdirection
= 1
295 ///////////////////////////////////////////////////////////////////////////////
297 // Forward class definition for Protocol
299 ///////////////////////////////////////////////////////////////////////////////
300 #ifndef datatype_Protocol_defined
301 #define datatype_Protocol_defined
303 typedef a_Protocol
* Protocol
;
306 ///////////////////////////////////////////////////////////////////////////////
308 // Forward class definition for DatatypeDef
310 ///////////////////////////////////////////////////////////////////////////////
311 #ifndef datatype_DatatypeDef_defined
312 #define datatype_DatatypeDef_defined
314 typedef a_DatatypeDef
* DatatypeDef
;
317 ///////////////////////////////////////////////////////////////////////////////
319 // Forward class definition for TermDef
321 ///////////////////////////////////////////////////////////////////////////////
322 #ifndef datatype_TermDef_defined
323 #define datatype_TermDef_defined
325 typedef a_TermDef
* TermDef
;
328 ///////////////////////////////////////////////////////////////////////////////
330 // Forward class definition for ViewDef
332 ///////////////////////////////////////////////////////////////////////////////
333 #ifndef datatype_ViewDef_defined
334 #define datatype_ViewDef_defined
336 typedef a_ViewDef
* ViewDef
;
339 ///////////////////////////////////////////////////////////////////////////////
341 // Forward class definition for LawDef
343 ///////////////////////////////////////////////////////////////////////////////
344 #ifndef datatype_LawDef_defined
345 #define datatype_LawDef_defined
347 typedef a_LawDef
* LawDef
;
350 ///////////////////////////////////////////////////////////////////////////////
352 // Forward class definition for TyDef
354 ///////////////////////////////////////////////////////////////////////////////
355 #ifndef datatype_TyDef_defined
356 #define datatype_TyDef_defined
358 typedef a_TyDef
* TyDef
;
361 ///////////////////////////////////////////////////////////////////////////////
363 // Forward class definition for FunDef
365 ///////////////////////////////////////////////////////////////////////////////
366 #ifndef datatype_FunDef_defined
367 #define datatype_FunDef_defined
369 typedef a_FunDef
* FunDef
;
372 ///////////////////////////////////////////////////////////////////////////////
374 // Forward class definition for QualId
376 ///////////////////////////////////////////////////////////////////////////////
377 #ifndef datatype_QualId_defined
378 #define datatype_QualId_defined
380 typedef a_QualId
* QualId
;
383 ///////////////////////////////////////////////////////////////////////////////
385 // Forward class definition for InferenceRule
387 ///////////////////////////////////////////////////////////////////////////////
388 #ifndef datatype_InferenceRule_defined
389 #define datatype_InferenceRule_defined
390 class a_InferenceRule
;
391 typedef a_InferenceRule
* InferenceRule
;
394 ///////////////////////////////////////////////////////////////////////////////
396 // Forward class definition for Conclusion
398 ///////////////////////////////////////////////////////////////////////////////
399 #ifndef datatype_Conclusion_defined
400 #define datatype_Conclusion_defined
402 typedef a_Conclusion
* Conclusion
;
405 ///////////////////////////////////////////////////////////////////////////////
406 // Definition of type MatchExps
407 ///////////////////////////////////////////////////////////////////////////////
409 typedef a_List
<MatchExp
> * MatchExps
;
411 ///////////////////////////////////////////////////////////////////////////////
412 // Definition of type MatchRules
413 ///////////////////////////////////////////////////////////////////////////////
415 typedef a_List
<MatchRule
> * MatchRules
;
417 ///////////////////////////////////////////////////////////////////////////////
418 // Definition of type Decls
419 ///////////////////////////////////////////////////////////////////////////////
421 typedef a_List
<Decl
> * Decls
;
423 ///////////////////////////////////////////////////////////////////////////////
424 // Definition of type DatatypeDefs
425 ///////////////////////////////////////////////////////////////////////////////
427 typedef a_List
<DatatypeDef
> * DatatypeDefs
;
429 ///////////////////////////////////////////////////////////////////////////////
430 // Definition of type ViewDefs
431 ///////////////////////////////////////////////////////////////////////////////
433 typedef a_List
<ViewDef
> * ViewDefs
;
435 ///////////////////////////////////////////////////////////////////////////////
436 // Definition of type LawDefs
437 ///////////////////////////////////////////////////////////////////////////////
439 typedef a_List
<LawDef
> * LawDefs
;
441 ///////////////////////////////////////////////////////////////////////////////
442 // Definition of type TyDefs
443 ///////////////////////////////////////////////////////////////////////////////
445 typedef a_List
<TyDef
> * TyDefs
;
447 ///////////////////////////////////////////////////////////////////////////////
448 // Definition of type TermDefs
449 ///////////////////////////////////////////////////////////////////////////////
451 typedef a_List
<TermDef
> * TermDefs
;
453 ///////////////////////////////////////////////////////////////////////////////
454 // Definition of type FunDefs
455 ///////////////////////////////////////////////////////////////////////////////
457 typedef a_List
<FunDef
> * FunDefs
;
459 ///////////////////////////////////////////////////////////////////////////////
460 // Definition of type Protocols
461 ///////////////////////////////////////////////////////////////////////////////
463 typedef a_List
<Protocol
> * Protocols
;
465 ///////////////////////////////////////////////////////////////////////////////
466 // Definition of type LabExp
467 ///////////////////////////////////////////////////////////////////////////////
469 typedef struct { Id label
; Exp exp
; } LabExp
;
471 ///////////////////////////////////////////////////////////////////////////////
472 // Definition of type LabMatchRule
473 ///////////////////////////////////////////////////////////////////////////////
475 typedef struct { QualId id
; MatchRule rule
; Ty return_ty
; } LabMatchRule
;
477 ///////////////////////////////////////////////////////////////////////////////
478 // Definition of type LabMatchRules
479 ///////////////////////////////////////////////////////////////////////////////
481 typedef struct { QualId id
; MatchRules rules
; Ty return_ty
; } LabMatchRules
;
483 ///////////////////////////////////////////////////////////////////////////////
484 // Definition of type Exps
485 ///////////////////////////////////////////////////////////////////////////////
487 typedef a_List
<Exp
> * Exps
;
489 ///////////////////////////////////////////////////////////////////////////////
490 // Definition of type LabExps
491 ///////////////////////////////////////////////////////////////////////////////
493 typedef a_List
<LabExp
> * LabExps
;
495 ///////////////////////////////////////////////////////////////////////////////
496 // Definition of type InferenceRules
497 ///////////////////////////////////////////////////////////////////////////////
499 typedef a_List
<InferenceRule
> * InferenceRules
;
501 ///////////////////////////////////////////////////////////////////////////////
502 // Definition of type Conclusions
503 ///////////////////////////////////////////////////////////////////////////////
505 typedef a_List
<Conclusion
> * Conclusions
;
507 ///////////////////////////////////////////////////////////////////////////////
508 // Definition of type GraphRewritingRules
509 ///////////////////////////////////////////////////////////////////////////////
511 typedef a_List
<GraphRewritingRule
> * GraphRewritingRules
;
513 ///////////////////////////////////////////////////////////////////////////////
514 // Definition of type FieldDefs
515 ///////////////////////////////////////////////////////////////////////////////
517 typedef a_List
<FieldDef
> * FieldDefs
;
519 ///////////////////////////////////////////////////////////////////////////////
520 // Definition of type FieldLaws
521 ///////////////////////////////////////////////////////////////////////////////
523 typedef a_List
<FieldLaw
> * FieldLaws
;
525 ///////////////////////////////////////////////////////////////////////////////
526 // Definition of type ChildNo
527 ///////////////////////////////////////////////////////////////////////////////
531 ///////////////////////////////////////////////////////////////////////////////
532 // Definition of type RuleNo
533 ///////////////////////////////////////////////////////////////////////////////
537 ///////////////////////////////////////////////////////////////////////////////
538 // Definition of type MatchOptions
539 ///////////////////////////////////////////////////////////////////////////////
541 typedef int MatchOptions
;
543 ///////////////////////////////////////////////////////////////////////////////
544 // Definition of type RewriteIndexings
545 ///////////////////////////////////////////////////////////////////////////////
547 typedef a_List
<RewriteIndexing
*> * RewriteIndexings
;
549 ///////////////////////////////////////////////////////////////////////////////
551 // Base class for datatype Exp
553 ///////////////////////////////////////////////////////////////////////////////
554 class a_Exp
: public MEM
{
557 tag_LITERALexp
= 0, tag_IDexp
= 1, tag_RELexp
= 2,
558 tag_DOTexp
= 3, tag_SELECTORexp
= 4, tag_DEREFexp
= 5,
559 tag_ARROWexp
= 6, tag_INDEXexp
= 7, tag_BINOPexp
= 8,
560 tag_PREFIXexp
= 9, tag_POSTFIXexp
= 10, tag_APPexp
= 11,
561 tag_ASSIGNexp
= 12, tag_IFexp
= 13, tag_TUPLEexp
= 14,
562 tag_EXTUPLEexp
= 15, tag_RECORDexp
= 16, tag_LISTexp
= 17,
563 tag_VECTORexp
= 18, tag_CONSexp
= 19, tag_CASTexp
= 20,
564 tag_QUALexp
= 21, tag_EQexp
= 22, tag_UNIFYexp
= 23,
565 tag_LTexp
= 24, tag_HASHexp
= 25, tag_THISCOSTexp
= 26,
566 tag_COSTexp
= 27, tag_THISSYNexp
= 28, tag_SYNexp
= 29,
567 tag_SENDexp
= 30, tag_SETLexp
= 31, tag_LISTCOMPexp
= 32,
568 tag_FORALLexp
= 33, tag_EXISTSexp
= 34, tag_MARKEDexp
= 35
572 const Tag_Exp tag__
; // variant tag
574 inline a_Exp(Tag_Exp t__
) : tag__(t__
) {}
582 inline int boxed(const a_Exp
* x
) { return x
!= 0; }
583 inline int untag(const a_Exp
* x
) { return x
? (x
->tag__
+1) : 0; }
584 ///////////////////////////////////////////////////////////////////////////////
586 // Class for datatype constructor Exp::LITERALexp
588 ///////////////////////////////////////////////////////////////////////////////
589 class Exp_LITERALexp
: public a_Exp
{
593 Exp_LITERALexp (Literal x_LITERALexp
);
596 ///////////////////////////////////////////////////////////////////////////////
598 // Class for datatype constructor Exp::IDexp
600 ///////////////////////////////////////////////////////////////////////////////
601 class Exp_IDexp
: public a_Exp
{
605 Exp_IDexp (Id x_IDexp
);
608 ///////////////////////////////////////////////////////////////////////////////
610 // Class for datatype constructor Exp::RELexp
612 ///////////////////////////////////////////////////////////////////////////////
613 class Exp_RELexp
: public a_Exp
{
617 Exp_RELexp (int x_RELexp
);
620 ///////////////////////////////////////////////////////////////////////////////
622 // Class for datatype constructor Exp::DOTexp
624 ///////////////////////////////////////////////////////////////////////////////
625 class Exp_DOTexp
: public a_Exp
{
629 Exp_DOTexp (Exp x_1
, Id x_2
);
632 ///////////////////////////////////////////////////////////////////////////////
634 // Class for datatype constructor Exp::SELECTORexp
636 ///////////////////////////////////////////////////////////////////////////////
637 class Exp_SELECTORexp
: public a_Exp
{
640 Exp _1
; Cons _2
; Ty _3
;
641 Exp_SELECTORexp (Exp x_1
, Cons x_2
, Ty x_3
);
644 ///////////////////////////////////////////////////////////////////////////////
646 // Class for datatype constructor Exp::DEREFexp
648 ///////////////////////////////////////////////////////////////////////////////
649 class Exp_DEREFexp
: public a_Exp
{
653 Exp_DEREFexp (Exp x_DEREFexp
);
656 ///////////////////////////////////////////////////////////////////////////////
658 // Class for datatype constructor Exp::ARROWexp
660 ///////////////////////////////////////////////////////////////////////////////
661 class Exp_ARROWexp
: public a_Exp
{
665 Exp_ARROWexp (Exp x_1
, Id x_2
);
668 ///////////////////////////////////////////////////////////////////////////////
670 // Class for datatype constructor Exp::INDEXexp
672 ///////////////////////////////////////////////////////////////////////////////
673 class Exp_INDEXexp
: public a_Exp
{
677 Exp_INDEXexp (Exp x_1
, Exp x_2
);
680 ///////////////////////////////////////////////////////////////////////////////
682 // Class for datatype constructor Exp::BINOPexp
684 ///////////////////////////////////////////////////////////////////////////////
685 class Exp_BINOPexp
: public a_Exp
{
688 Id _1
; Exp _2
; Exp _3
;
689 Exp_BINOPexp (Id x_1
, Exp x_2
, Exp x_3
);
692 ///////////////////////////////////////////////////////////////////////////////
694 // Class for datatype constructor Exp::PREFIXexp
696 ///////////////////////////////////////////////////////////////////////////////
697 class Exp_PREFIXexp
: public a_Exp
{
701 Exp_PREFIXexp (Id x_1
, Exp x_2
);
704 ///////////////////////////////////////////////////////////////////////////////
706 // Class for datatype constructor Exp::POSTFIXexp
708 ///////////////////////////////////////////////////////////////////////////////
709 class Exp_POSTFIXexp
: public a_Exp
{
713 Exp_POSTFIXexp (Id x_1
, Exp x_2
);
716 ///////////////////////////////////////////////////////////////////////////////
718 // Class for datatype constructor Exp::APPexp
720 ///////////////////////////////////////////////////////////////////////////////
721 class Exp_APPexp
: public a_Exp
{
725 Exp_APPexp (Exp x_1
, Exp x_2
);
728 ///////////////////////////////////////////////////////////////////////////////
730 // Class for datatype constructor Exp::ASSIGNexp
732 ///////////////////////////////////////////////////////////////////////////////
733 class Exp_ASSIGNexp
: public a_Exp
{
737 Exp_ASSIGNexp (Exp x_1
, Exp x_2
);
740 ///////////////////////////////////////////////////////////////////////////////
742 // Class for datatype constructor Exp::IFexp
744 ///////////////////////////////////////////////////////////////////////////////
745 class Exp_IFexp
: public a_Exp
{
748 Exp _1
; Exp _2
; Exp _3
;
749 Exp_IFexp (Exp x_1
, Exp x_2
, Exp x_3
);
752 ///////////////////////////////////////////////////////////////////////////////
754 // Class for datatype constructor Exp::TUPLEexp
756 ///////////////////////////////////////////////////////////////////////////////
757 class Exp_TUPLEexp
: public a_Exp
{
760 a_List
<Exp
> * TUPLEexp
;
761 Exp_TUPLEexp (a_List
<Exp
> * x_TUPLEexp
);
764 ///////////////////////////////////////////////////////////////////////////////
766 // Class for datatype constructor Exp::EXTUPLEexp
768 ///////////////////////////////////////////////////////////////////////////////
769 class Exp_EXTUPLEexp
: public a_Exp
{
772 a_List
<Exp
> * EXTUPLEexp
;
773 Exp_EXTUPLEexp (a_List
<Exp
> * x_EXTUPLEexp
);
776 ///////////////////////////////////////////////////////////////////////////////
778 // Class for datatype constructor Exp::RECORDexp
780 ///////////////////////////////////////////////////////////////////////////////
781 class Exp_RECORDexp
: public a_Exp
{
784 a_List
<LabExp
> * RECORDexp
;
785 Exp_RECORDexp (a_List
<LabExp
> * x_RECORDexp
);
788 ///////////////////////////////////////////////////////////////////////////////
790 // Class for datatype constructor Exp::LISTexp
792 ///////////////////////////////////////////////////////////////////////////////
793 class Exp_LISTexp
: public a_Exp
{
796 Cons _1
; Cons _2
; a_List
<Exp
> * _3
; Exp _4
;
797 Exp_LISTexp (Cons x_1
, Cons x_2
, a_List
<Exp
> * x_3
, Exp x_4
);
800 ///////////////////////////////////////////////////////////////////////////////
802 // Class for datatype constructor Exp::VECTORexp
804 ///////////////////////////////////////////////////////////////////////////////
805 class Exp_VECTORexp
: public a_Exp
{
808 Cons _1
; a_List
<Exp
> * _2
;
809 Exp_VECTORexp (Cons x_1
, a_List
<Exp
> * x_2
);
812 ///////////////////////////////////////////////////////////////////////////////
814 // Class for datatype constructor Exp::CONSexp
816 ///////////////////////////////////////////////////////////////////////////////
817 class Exp_CONSexp
: public a_Exp
{
820 Cons _1
; a_List
<Exp
> * _2
; Exp _3
;
821 Exp_CONSexp (Cons x_1
, a_List
<Exp
> * x_2
, Exp x_3
);
824 ///////////////////////////////////////////////////////////////////////////////
826 // Class for datatype constructor Exp::CASTexp
828 ///////////////////////////////////////////////////////////////////////////////
829 class Exp_CASTexp
: public a_Exp
{
833 Exp_CASTexp (Ty x_1
, Exp x_2
);
836 ///////////////////////////////////////////////////////////////////////////////
838 // Class for datatype constructor Exp::QUALexp
840 ///////////////////////////////////////////////////////////////////////////////
841 class Exp_QUALexp
: public a_Exp
{
845 Exp_QUALexp (Ty x_1
, Id x_2
);
848 ///////////////////////////////////////////////////////////////////////////////
850 // Class for datatype constructor Exp::EQexp
852 ///////////////////////////////////////////////////////////////////////////////
853 class Exp_EQexp
: public a_Exp
{
856 Ty _1
; Exp _2
; Exp _3
;
857 Exp_EQexp (Ty x_1
, Exp x_2
, Exp x_3
);
860 ///////////////////////////////////////////////////////////////////////////////
862 // Class for datatype constructor Exp::UNIFYexp
864 ///////////////////////////////////////////////////////////////////////////////
865 class Exp_UNIFYexp
: public a_Exp
{
868 Ty _1
; Exp _2
; Exp _3
;
869 Exp_UNIFYexp (Ty x_1
, Exp x_2
, Exp x_3
);
872 ///////////////////////////////////////////////////////////////////////////////
874 // Class for datatype constructor Exp::LTexp
876 ///////////////////////////////////////////////////////////////////////////////
877 class Exp_LTexp
: public a_Exp
{
880 Ty _1
; Exp _2
; Exp _3
;
881 Exp_LTexp (Ty x_1
, Exp x_2
, Exp x_3
);
884 ///////////////////////////////////////////////////////////////////////////////
886 // Class for datatype constructor Exp::HASHexp
888 ///////////////////////////////////////////////////////////////////////////////
889 class Exp_HASHexp
: public a_Exp
{
893 Exp_HASHexp (Ty x_1
, Exp x_2
);
896 ///////////////////////////////////////////////////////////////////////////////
898 // Class for datatype constructor Exp::THISCOSTexp
900 ///////////////////////////////////////////////////////////////////////////////
901 class Exp_THISCOSTexp
: public a_Exp
{
908 ///////////////////////////////////////////////////////////////////////////////
910 // Class for datatype constructor Exp::COSTexp
912 ///////////////////////////////////////////////////////////////////////////////
913 class Exp_COSTexp
: public a_Exp
{
917 Exp_COSTexp (ChildNo x_COSTexp
);
920 ///////////////////////////////////////////////////////////////////////////////
922 // Class for datatype constructor Exp::THISSYNexp
924 ///////////////////////////////////////////////////////////////////////////////
925 class Exp_THISSYNexp
: public a_Exp
{
928 RuleNo _1
; Ty _2
; Bool _3
;
929 Exp_THISSYNexp (RuleNo x_1
, Ty x_2
, Bool x_3
);
932 ///////////////////////////////////////////////////////////////////////////////
934 // Class for datatype constructor Exp::SYNexp
936 ///////////////////////////////////////////////////////////////////////////////
937 class Exp_SYNexp
: public a_Exp
{
940 ChildNo _1
; RuleNo _2
; Ty _3
; Bool _4
;
941 Exp_SYNexp (ChildNo x_1
, RuleNo x_2
, Ty x_3
, Bool x_4
);
944 ///////////////////////////////////////////////////////////////////////////////
946 // Class for datatype constructor Exp::SENDexp
948 ///////////////////////////////////////////////////////////////////////////////
949 class Exp_SENDexp
: public a_Exp
{
952 Id _1
; a_List
<Exp
> * _2
;
953 Exp_SENDexp (Id x_1
, a_List
<Exp
> * x_2
);
956 ///////////////////////////////////////////////////////////////////////////////
958 // Class for datatype constructor Exp::SETLexp
960 ///////////////////////////////////////////////////////////////////////////////
961 class Exp_SETLexp
: public a_Exp
{
965 Exp_SETLexp (SETLOp x_1
, Exps x_2
);
968 ///////////////////////////////////////////////////////////////////////////////
970 // Class for datatype constructor Exp::LISTCOMPexp
972 ///////////////////////////////////////////////////////////////////////////////
973 class Exp_LISTCOMPexp
: public a_Exp
{
976 Exp exp
; a_List
<Generator
> * generators
; Exp guard
;
977 Exp_LISTCOMPexp (Exp x_exp
, a_List
<Generator
> * x_generators
, Exp x_guard
);
980 ///////////////////////////////////////////////////////////////////////////////
982 // Class for datatype constructor Exp::FORALLexp
984 ///////////////////////////////////////////////////////////////////////////////
985 class Exp_FORALLexp
: public a_Exp
{
989 Exp_FORALLexp (Id x_1
, Exp x_2
);
992 ///////////////////////////////////////////////////////////////////////////////
994 // Class for datatype constructor Exp::EXISTSexp
996 ///////////////////////////////////////////////////////////////////////////////
997 class Exp_EXISTSexp
: public a_Exp
{
1001 Exp_EXISTSexp (Id x_1
, Exp x_2
);
1004 ///////////////////////////////////////////////////////////////////////////////
1006 // Class for datatype constructor Exp::MARKEDexp
1008 ///////////////////////////////////////////////////////////////////////////////
1009 class Exp_MARKEDexp
: public a_Exp
{
1013 Exp_MARKEDexp (Loc x_1
, Exp x_2
);
1016 ///////////////////////////////////////////////////////////////////////////////
1018 // Datatype constructor functions for Exp
1020 ///////////////////////////////////////////////////////////////////////////////
1021 extern a_Exp
* LITERALexp (Literal x_LITERALexp
);
1022 extern a_Exp
* IDexp (Id x_IDexp
);
1023 extern a_Exp
* RELexp (int x_RELexp
);
1024 extern a_Exp
* DOTexp (Exp x_1
, Id x_2
);
1025 extern a_Exp
* SELECTORexp (Exp x_1
, Cons x_2
, Ty x_3
);
1026 extern a_Exp
* DEREFexp (Exp x_DEREFexp
);
1027 extern a_Exp
* ARROWexp (Exp x_1
, Id x_2
);
1028 extern a_Exp
* INDEXexp (Exp x_1
, Exp x_2
);
1029 extern a_Exp
* BINOPexp (Id x_1
, Exp x_2
, Exp x_3
);
1030 extern a_Exp
* PREFIXexp (Id x_1
, Exp x_2
);
1031 extern a_Exp
* POSTFIXexp (Id x_1
, Exp x_2
);
1032 extern a_Exp
* APPexp (Exp x_1
, Exp x_2
);
1033 extern a_Exp
* ASSIGNexp (Exp x_1
, Exp x_2
);
1034 extern a_Exp
* IFexp (Exp x_1
, Exp x_2
, Exp x_3
);
1035 extern a_Exp
* TUPLEexp (a_List
<Exp
> * x_TUPLEexp
);
1036 extern a_Exp
* EXTUPLEexp (a_List
<Exp
> * x_EXTUPLEexp
);
1037 extern a_Exp
* RECORDexp (a_List
<LabExp
> * x_RECORDexp
);
1038 extern a_Exp
* LISTexp (Cons x_1
, Cons x_2
, a_List
<Exp
> * x_3
, Exp x_4
);
1039 extern a_Exp
* VECTORexp (Cons x_1
, a_List
<Exp
> * x_2
);
1040 extern a_Exp
* CONSexp (Cons x_1
, a_List
<Exp
> * x_2
, Exp x_3
);
1041 extern a_Exp
* CASTexp (Ty x_1
, Exp x_2
);
1042 extern a_Exp
* QUALexp (Ty x_1
, Id x_2
);
1043 extern a_Exp
* EQexp (Ty x_1
, Exp x_2
, Exp x_3
);
1044 extern a_Exp
* UNIFYexp (Ty x_1
, Exp x_2
, Exp x_3
);
1045 extern a_Exp
* LTexp (Ty x_1
, Exp x_2
, Exp x_3
);
1046 extern a_Exp
* HASHexp (Ty x_1
, Exp x_2
);
1047 extern a_Exp
* THISCOSTexp ();
1048 extern a_Exp
* COSTexp (ChildNo x_COSTexp
);
1049 extern a_Exp
* THISSYNexp (RuleNo x_1
, Ty x_2
, Bool x_3
);
1050 extern a_Exp
* SYNexp (ChildNo x_1
, RuleNo x_2
, Ty x_3
, Bool x_4
);
1051 extern a_Exp
* SENDexp (Id x_1
, a_List
<Exp
> * x_2
);
1052 extern a_Exp
* SETLexp (SETLOp x_1
, Exps x_2
);
1053 extern a_Exp
* LISTCOMPexp (Exp x_exp
, a_List
<Generator
> * x_generators
, Exp x_guard
);
1054 extern a_Exp
* FORALLexp (Id x_1
, Exp x_2
);
1055 extern a_Exp
* EXISTSexp (Id x_1
, Exp x_2
);
1056 extern a_Exp
* MARKEDexp (Loc x_1
, Exp x_2
);
1059 ///////////////////////////////////////////////////////////////////////////////
1061 // Class for datatype constructor Generator::GENERATOR
1063 ///////////////////////////////////////////////////////////////////////////////
1064 class a_Generator
: public Loc
{
1067 Pat pat
; Exp guard
; Exp exp
;
1068 a_Generator (Pat x_pat
, Exp x_guard
, Exp x_exp
);
1070 inline int boxed(const a_Generator
*) { return 1; }
1071 inline int untag(const a_Generator
*) { return 0; }
1072 ///////////////////////////////////////////////////////////////////////////////
1074 // Datatype constructor functions for Generator
1076 ///////////////////////////////////////////////////////////////////////////////
1077 extern a_Generator
* GENERATOR (Pat x_pat
, Exp x_guard
, Exp x_exp
);
1079 ///////////////////////////////////////////////////////////////////////////////
1081 // Class for datatype constructor MatchExp::MATCHexp
1083 ///////////////////////////////////////////////////////////////////////////////
1084 class a_MatchExp
: public Loc
{
1088 a_MatchExp (Exp x_1
, Id x_2
);
1090 inline int boxed(const a_MatchExp
*) { return 1; }
1091 inline int untag(const a_MatchExp
*) { return 0; }
1092 ///////////////////////////////////////////////////////////////////////////////
1094 // Datatype constructor functions for MatchExp
1096 ///////////////////////////////////////////////////////////////////////////////
1097 extern a_MatchExp
* MATCHexp (Exp x_1
, Id x_2
);
1099 ///////////////////////////////////////////////////////////////////////////////
1101 // Class for datatype constructor MatchRule::MATCHrule
1103 ///////////////////////////////////////////////////////////////////////////////
1104 class a_MatchRule
: public MatchRuleInfo
{
1107 Id _1
; Pat _2
; Exp _3
; Cost _4
; a_List
<Decl
> * _5
;
1108 a_MatchRule (Id x_1
, Pat x_2
, Exp x_3
, Cost x_4
, a_List
<Decl
> * x_5
);
1110 inline int boxed(const a_MatchRule
*) { return 1; }
1111 inline int untag(const a_MatchRule
*) { return 0; }
1112 ///////////////////////////////////////////////////////////////////////////////
1114 // Datatype constructor functions for MatchRule
1116 ///////////////////////////////////////////////////////////////////////////////
1117 extern a_MatchRule
* MATCHrule (Id x_1
, Pat x_2
, Exp x_3
, Cost x_4
, a_List
<Decl
> * x_5
);
1119 ///////////////////////////////////////////////////////////////////////////////
1121 // Base class for datatype Decl
1123 ///////////////////////////////////////////////////////////////////////////////
1124 class a_Decl
: public MEM
{
1127 tag_OPAQUEdecl
= 0, tag_DATATYPEdecl
= 1, tag_INSTANTIATEdecl
= 2,
1128 tag_CLASSDEFdecl
= 3, tag_INFERENCEdecl
= 4, tag_REWRITEdecl
= 5,
1129 tag_REWRITINGdecl
= 6, tag_REPLACEMENTdecl
= 7, tag_CUTREWRITEdecl
= 8,
1130 tag_FAILREWRITEdecl
= 9, tag_INJECTdecl
= 10, tag_GOTOdecl
= 11,
1131 tag_SETSTATEdecl
= 12, tag_CONSTRAINTdecl
= 13, tag_SYNTAXdecl
= 14,
1132 tag_ATTRIBUTEGRAMMARdecl
= 15, tag_FUNdecl
= 16, tag_MATCHdecl
= 17,
1133 tag_BITFIELDdecl
= 18, tag_SETLSTMTdecl
= 19, tag_SETLDEFdecl
= 20,
1134 tag_GRAPHREWRITEdecl
= 21, tag_DATAFLOWdecl
= 22, tag_CLASSOFdecl
= 23,
1135 tag_TYPEEXPdecl
= 24, tag_EXPdecl
= 25, tag_MARKEDdecl
= 26
1139 const Tag_Decl tag__
; // variant tag
1141 inline a_Decl(Tag_Decl t__
) : tag__(t__
) {}
1144 inline int boxed(const a_Decl
* x
) { return x
!= 0; }
1145 inline int untag(const a_Decl
* x
) { return x
? (x
->tag__
+1) : 0; }
1146 ///////////////////////////////////////////////////////////////////////////////
1148 // Class for datatype constructor Decl::OPAQUEdecl
1150 ///////////////////////////////////////////////////////////////////////////////
1151 class Decl_OPAQUEdecl
: public a_Decl
{
1154 char const * OPAQUEdecl
;
1155 Decl_OPAQUEdecl (char const * x_OPAQUEdecl
);
1158 ///////////////////////////////////////////////////////////////////////////////
1160 // Class for datatype constructor Decl::DATATYPEdecl
1162 ///////////////////////////////////////////////////////////////////////////////
1163 class Decl_DATATYPEdecl
: public a_Decl
{
1166 DatatypeDefs _1
; ViewDefs _2
; LawDefs _3
; TyDefs _4
;
1167 Decl_DATATYPEdecl (DatatypeDefs x_1
, ViewDefs x_2
, LawDefs x_3
, TyDefs x_4
);
1170 ///////////////////////////////////////////////////////////////////////////////
1172 // Class for datatype constructor Decl::INSTANTIATEdecl
1174 ///////////////////////////////////////////////////////////////////////////////
1175 class Decl_INSTANTIATEdecl
: public a_Decl
{
1179 Decl_INSTANTIATEdecl (Bool x_1
, Tys x_2
);
1182 ///////////////////////////////////////////////////////////////////////////////
1184 // Class for datatype constructor Decl::CLASSDEFdecl
1186 ///////////////////////////////////////////////////////////////////////////////
1187 class Decl_CLASSDEFdecl
: public a_Decl
{
1190 ClassDefinition
* CLASSDEFdecl
;
1191 Decl_CLASSDEFdecl (ClassDefinition
* x_CLASSDEFdecl
);
1194 ///////////////////////////////////////////////////////////////////////////////
1196 // Class for datatype constructor Decl::INFERENCEdecl
1198 ///////////////////////////////////////////////////////////////////////////////
1199 class Decl_INFERENCEdecl
: public a_Decl
{
1202 Id _1
; InferenceRules _2
;
1203 Decl_INFERENCEdecl (Id x_1
, InferenceRules x_2
);
1206 ///////////////////////////////////////////////////////////////////////////////
1208 // Class for datatype constructor Decl::REWRITEdecl
1210 ///////////////////////////////////////////////////////////////////////////////
1211 class Decl_REWRITEdecl
: public a_Decl
{
1214 Id _1
; RewriteIndexings _2
; MatchRules _3
;
1215 Decl_REWRITEdecl (Id x_1
, RewriteIndexings x_2
, MatchRules x_3
);
1218 ///////////////////////////////////////////////////////////////////////////////
1220 // Class for datatype constructor Decl::REWRITINGdecl
1222 ///////////////////////////////////////////////////////////////////////////////
1223 class Decl_REWRITINGdecl
: public a_Decl
{
1226 Protocols _1
; Exp _2
; Exp _3
; RewriteIndexings _4
; MatchRules _5
; TyQual _6
;
1227 Decl_REWRITINGdecl (Protocols x_1
, Exp x_2
, Exp x_3
, RewriteIndexings x_4
, MatchRules x_5
, TyQual x_6
);
1230 ///////////////////////////////////////////////////////////////////////////////
1232 // Class for datatype constructor Decl::REPLACEMENTdecl
1234 ///////////////////////////////////////////////////////////////////////////////
1235 class Decl_REPLACEMENTdecl
: public a_Decl
{
1238 Exp _1
; MatchRuleInfo::RewritingMode _2
;
1239 Decl_REPLACEMENTdecl (Exp x_1
, MatchRuleInfo::RewritingMode x_2
);
1242 ///////////////////////////////////////////////////////////////////////////////
1244 // Class for datatype constructor Decl::CUTREWRITEdecl
1246 ///////////////////////////////////////////////////////////////////////////////
1247 class Decl_CUTREWRITEdecl
: public a_Decl
{
1250 Exp _1
; MatchRuleInfo::RewritingMode _2
;
1251 Decl_CUTREWRITEdecl (Exp x_1
, MatchRuleInfo::RewritingMode x_2
);
1254 ///////////////////////////////////////////////////////////////////////////////
1256 // Class for datatype constructor Decl::FAILREWRITEdecl
1258 ///////////////////////////////////////////////////////////////////////////////
1259 class Decl_FAILREWRITEdecl
: public a_Decl
{
1262 MatchRuleInfo::RewritingMode FAILREWRITEdecl
;
1263 Decl_FAILREWRITEdecl (MatchRuleInfo::RewritingMode x_FAILREWRITEdecl
);
1266 ///////////////////////////////////////////////////////////////////////////////
1268 // Class for datatype constructor Decl::INJECTdecl
1270 ///////////////////////////////////////////////////////////////////////////////
1271 class Decl_INJECTdecl
: public a_Decl
{
1274 int node_number
; EntryDirection direction
;
1275 Decl_INJECTdecl (int x_node_number
, EntryDirection x_direction
);
1278 ///////////////////////////////////////////////////////////////////////////////
1280 // Class for datatype constructor Decl::GOTOdecl
1282 ///////////////////////////////////////////////////////////////////////////////
1283 class Decl_GOTOdecl
: public a_Decl
{
1287 Decl_GOTOdecl (Id x_GOTOdecl
);
1290 ///////////////////////////////////////////////////////////////////////////////
1292 // Class for datatype constructor Decl::SETSTATEdecl
1294 ///////////////////////////////////////////////////////////////////////////////
1295 class Decl_SETSTATEdecl
: public a_Decl
{
1299 Decl_SETSTATEdecl (int x_SETSTATEdecl
);
1302 ///////////////////////////////////////////////////////////////////////////////
1304 // Class for datatype constructor Decl::CONSTRAINTdecl
1306 ///////////////////////////////////////////////////////////////////////////////
1307 class Decl_CONSTRAINTdecl
: public a_Decl
{
1310 Id _1
; ConstraintSet _2
;
1311 Decl_CONSTRAINTdecl (Id x_1
, ConstraintSet x_2
);
1314 ///////////////////////////////////////////////////////////////////////////////
1316 // Class for datatype constructor Decl::SYNTAXdecl
1318 ///////////////////////////////////////////////////////////////////////////////
1319 class Decl_SYNTAXdecl
: public a_Decl
{
1323 Decl_SYNTAXdecl (Id x_1
, GramExp x_2
);
1326 ///////////////////////////////////////////////////////////////////////////////
1328 // Class for datatype constructor Decl::ATTRIBUTEGRAMMARdecl
1330 ///////////////////////////////////////////////////////////////////////////////
1331 class Decl_ATTRIBUTEGRAMMARdecl
: public a_Decl
{
1335 Decl_ATTRIBUTEGRAMMARdecl (Id x_1
, GramExp x_2
);
1338 ///////////////////////////////////////////////////////////////////////////////
1340 // Class for datatype constructor Decl::FUNdecl
1342 ///////////////////////////////////////////////////////////////////////////////
1343 class Decl_FUNdecl
: public a_Decl
{
1347 Decl_FUNdecl (FunDefs x_FUNdecl
);
1350 ///////////////////////////////////////////////////////////////////////////////
1352 // Class for datatype constructor Decl::MATCHdecl
1354 ///////////////////////////////////////////////////////////////////////////////
1355 class Decl_MATCHdecl
: public a_Decl
{
1358 MatchExps _1
; MatchRules _2
; MatchOptions _3
; Ty _4
;
1359 Decl_MATCHdecl (MatchExps x_1
, MatchRules x_2
, MatchOptions x_3
, Ty x_4
);
1362 ///////////////////////////////////////////////////////////////////////////////
1364 // Class for datatype constructor Decl::BITFIELDdecl
1366 ///////////////////////////////////////////////////////////////////////////////
1367 class Decl_BITFIELDdecl
: public a_Decl
{
1370 Id name
; int width
; FieldDefs field_names
; FieldLaws laws
;
1371 Decl_BITFIELDdecl (Id x_name
, int x_width
, FieldDefs x_field_names
, FieldLaws x_laws
);
1374 ///////////////////////////////////////////////////////////////////////////////
1376 // Class for datatype constructor Decl::SETLSTMTdecl
1378 ///////////////////////////////////////////////////////////////////////////////
1379 class Decl_SETLSTMTdecl
: public a_Decl
{
1383 Decl_SETLSTMTdecl (Stmt x_SETLSTMTdecl
);
1386 ///////////////////////////////////////////////////////////////////////////////
1388 // Class for datatype constructor Decl::SETLDEFdecl
1390 ///////////////////////////////////////////////////////////////////////////////
1391 class Decl_SETLDEFdecl
: public a_Decl
{
1395 Decl_SETLDEFdecl (Def x_SETLDEFdecl
);
1398 ///////////////////////////////////////////////////////////////////////////////
1400 // Class for datatype constructor Decl::GRAPHREWRITEdecl
1402 ///////////////////////////////////////////////////////////////////////////////
1403 class Decl_GRAPHREWRITEdecl
: public a_Decl
{
1406 Id name
; LabTys args
; GraphRewritingRules rules
;
1407 Decl_GRAPHREWRITEdecl (Id x_name
, LabTys x_args
, GraphRewritingRules x_rules
);
1410 ///////////////////////////////////////////////////////////////////////////////
1412 // Class for datatype constructor Decl::DATAFLOWdecl
1414 ///////////////////////////////////////////////////////////////////////////////
1415 class Decl_DATAFLOWdecl
: public a_Decl
{
1419 Decl_DATAFLOWdecl (Id x_name
);
1422 ///////////////////////////////////////////////////////////////////////////////
1424 // Class for datatype constructor Decl::CLASSOFdecl
1426 ///////////////////////////////////////////////////////////////////////////////
1427 class Decl_CLASSOFdecl
: public a_Decl
{
1431 Decl_CLASSOFdecl (Id x_CLASSOFdecl
);
1434 ///////////////////////////////////////////////////////////////////////////////
1436 // Class for datatype constructor Decl::TYPEEXPdecl
1438 ///////////////////////////////////////////////////////////////////////////////
1439 class Decl_TYPEEXPdecl
: public a_Decl
{
1443 Decl_TYPEEXPdecl (Ty x_TYPEEXPdecl
);
1446 ///////////////////////////////////////////////////////////////////////////////
1448 // Class for datatype constructor Decl::EXPdecl
1450 ///////////////////////////////////////////////////////////////////////////////
1451 class Decl_EXPdecl
: public a_Decl
{
1454 Exp exp
; char const * prefix
; char const * suffix
;
1455 Decl_EXPdecl (Exp x_exp
, char const * x_prefix
= 0, char const * x_suffix
= 0);
1458 ///////////////////////////////////////////////////////////////////////////////
1460 // Class for datatype constructor Decl::MARKEDdecl
1462 ///////////////////////////////////////////////////////////////////////////////
1463 class Decl_MARKEDdecl
: public a_Decl
{
1467 Decl_MARKEDdecl (Loc x_1
, Decl x_2
);
1470 ///////////////////////////////////////////////////////////////////////////////
1472 // Datatype constructor functions for Decl
1474 ///////////////////////////////////////////////////////////////////////////////
1475 extern a_Decl
* OPAQUEdecl (char const * x_OPAQUEdecl
);
1476 extern a_Decl
* DATATYPEdecl (DatatypeDefs x_1
, ViewDefs x_2
, LawDefs x_3
, TyDefs x_4
);
1477 extern a_Decl
* INSTANTIATEdecl (Bool x_1
, Tys x_2
);
1478 extern a_Decl
* CLASSDEFdecl (ClassDefinition
* x_CLASSDEFdecl
);
1479 extern a_Decl
* INFERENCEdecl (Id x_1
, InferenceRules x_2
);
1480 extern a_Decl
* REWRITEdecl (Id x_1
, RewriteIndexings x_2
, MatchRules x_3
);
1481 extern a_Decl
* REWRITINGdecl (Protocols x_1
, Exp x_2
, Exp x_3
, RewriteIndexings x_4
, MatchRules x_5
, TyQual x_6
);
1482 extern a_Decl
* REPLACEMENTdecl (Exp x_1
, MatchRuleInfo::RewritingMode x_2
);
1483 extern a_Decl
* CUTREWRITEdecl (Exp x_1
, MatchRuleInfo::RewritingMode x_2
);
1484 extern a_Decl
* FAILREWRITEdecl (MatchRuleInfo::RewritingMode x_FAILREWRITEdecl
);
1485 extern a_Decl
* INJECTdecl (int x_node_number
, EntryDirection x_direction
);
1486 extern a_Decl
* GOTOdecl (Id x_GOTOdecl
);
1487 extern a_Decl
* SETSTATEdecl (int x_SETSTATEdecl
);
1488 extern a_Decl
* CONSTRAINTdecl (Id x_1
, ConstraintSet x_2
);
1489 extern a_Decl
* SYNTAXdecl (Id x_1
, GramExp x_2
);
1490 extern a_Decl
* ATTRIBUTEGRAMMARdecl (Id x_1
, GramExp x_2
);
1491 extern a_Decl
* FUNdecl (FunDefs x_FUNdecl
);
1492 extern a_Decl
* MATCHdecl (MatchExps x_1
, MatchRules x_2
, MatchOptions x_3
, Ty x_4
);
1493 extern a_Decl
* BITFIELDdecl (Id x_name
, int x_width
, FieldDefs x_field_names
, FieldLaws x_laws
);
1494 extern a_Decl
* SETLSTMTdecl (Stmt x_SETLSTMTdecl
);
1495 extern a_Decl
* SETLDEFdecl (Def x_SETLDEFdecl
);
1496 extern a_Decl
* GRAPHREWRITEdecl (Id x_name
, LabTys x_args
, GraphRewritingRules x_rules
);
1497 extern a_Decl
* DATAFLOWdecl (Id x_name
);
1498 extern a_Decl
* CLASSOFdecl (Id x_CLASSOFdecl
);
1499 extern a_Decl
* TYPEEXPdecl (Ty x_TYPEEXPdecl
);
1500 extern a_Decl
* EXPdecl (Exp x_exp
, char const * x_prefix
= 0, char const * x_suffix
= 0);
1501 extern a_Decl
* MARKEDdecl (Loc x_1
, Decl x_2
);
1504 ///////////////////////////////////////////////////////////////////////////////
1506 // Class for datatype constructor Protocol::PROTOCOL
1508 ///////////////////////////////////////////////////////////////////////////////
1509 class a_Protocol
: public Loc
{
1512 Ty ty
; Ty inh
; Ty syn
;
1513 a_Protocol (Ty x_ty
, Ty x_inh
, Ty x_syn
);
1515 inline int boxed(const a_Protocol
*) { return 1; }
1516 inline int untag(const a_Protocol
*) { return 0; }
1517 ///////////////////////////////////////////////////////////////////////////////
1519 // Datatype constructor functions for Protocol
1521 ///////////////////////////////////////////////////////////////////////////////
1522 extern a_Protocol
* PROTOCOL (Ty x_ty
, Ty x_inh
, Ty x_syn
);
1524 ///////////////////////////////////////////////////////////////////////////////
1526 // Class for datatype constructor DatatypeDef::DATATYPEdef
1528 ///////////////////////////////////////////////////////////////////////////////
1529 class a_DatatypeDef
: public Loc
{
1532 Id _1
; TyVars _2
; Inherits _3
; TyQual _4
; TermDefs _5
; Decls _6
;
1533 a_DatatypeDef (Id x_1
, TyVars x_2
, Inherits x_3
, TyQual x_4
, TermDefs x_5
, Decls x_6
);
1535 inline int boxed(const a_DatatypeDef
*) { return 1; }
1536 inline int untag(const a_DatatypeDef
*) { return 0; }
1537 ///////////////////////////////////////////////////////////////////////////////
1539 // Datatype constructor functions for DatatypeDef
1541 ///////////////////////////////////////////////////////////////////////////////
1542 extern a_DatatypeDef
* DATATYPEdef (Id x_1
, TyVars x_2
, Inherits x_3
, TyQual x_4
, TermDefs x_5
, Decls x_6
);
1544 ///////////////////////////////////////////////////////////////////////////////
1546 // Class for datatype constructor TermDef::TERMdef
1548 ///////////////////////////////////////////////////////////////////////////////
1549 class a_TermDef
: public Loc
{
1552 Id id
; Ty ty
; Decls decls
; Inherits inherits
; Pat pat
; PrintFormats print_formats
; TyOpt opt
; TyQual qual
; Exp view_predicate
;
1553 a_TermDef (Id x_id
, Ty x_ty
, Decls x_decls
= nil_1_
, Inherits x_inherits
= nil_1_
, Pat x_pat
= NOpat
, PrintFormats x_print_formats
= nil_1_
, TyOpt x_opt
= OPTnone
, TyQual x_qual
= QUALnone
, Exp x_view_predicate
= NOexp
);
1555 inline int boxed(const a_TermDef
*) { return 1; }
1556 inline int untag(const a_TermDef
*) { return 0; }
1557 ///////////////////////////////////////////////////////////////////////////////
1559 // Datatype constructor functions for TermDef
1561 ///////////////////////////////////////////////////////////////////////////////
1562 extern a_TermDef
* TERMdef (Id x_id
, Ty x_ty
, Decls x_decls
= nil_1_
, Inherits x_inherits
= nil_1_
, Pat x_pat
= NOpat
, PrintFormats x_print_formats
= nil_1_
, TyOpt x_opt
= OPTnone
, TyQual x_qual
= QUALnone
, Exp x_view_predicate
= NOexp
);
1564 ///////////////////////////////////////////////////////////////////////////////
1566 // Class for datatype constructor ViewDef::VIEWdef
1568 ///////////////////////////////////////////////////////////////////////////////
1569 class a_ViewDef
: public Loc
{
1572 Pat _1
; Exp _2
; a_List
<LabExp
> * _3
;
1573 a_ViewDef (Pat x_1
, Exp x_2
, a_List
<LabExp
> * x_3
);
1575 inline int boxed(const a_ViewDef
*) { return 1; }
1576 inline int untag(const a_ViewDef
*) { return 0; }
1577 ///////////////////////////////////////////////////////////////////////////////
1579 // Datatype constructor functions for ViewDef
1581 ///////////////////////////////////////////////////////////////////////////////
1582 extern a_ViewDef
* VIEWdef (Pat x_1
, Exp x_2
, a_List
<LabExp
> * x_3
);
1584 ///////////////////////////////////////////////////////////////////////////////
1586 // Class for datatype constructor LawDef::LAWdef
1588 ///////////////////////////////////////////////////////////////////////////////
1589 class a_LawDef
: public Loc
{
1592 Id id
; Ids args
; Exp guard
; Pat pat
; Bool invert
; Ty ty
;
1593 a_LawDef (Id x_id
, Ids x_args
, Exp x_guard
, Pat x_pat
, Bool x_invert
, Ty x_ty
= NOty
);
1595 inline int boxed(const a_LawDef
*) { return 1; }
1596 inline int untag(const a_LawDef
*) { return 0; }
1597 ///////////////////////////////////////////////////////////////////////////////
1599 // Datatype constructor functions for LawDef
1601 ///////////////////////////////////////////////////////////////////////////////
1602 extern a_LawDef
* LAWdef (Id x_id
, Ids x_args
, Exp x_guard
, Pat x_pat
, Bool x_invert
, Ty x_ty
= NOty
);
1604 ///////////////////////////////////////////////////////////////////////////////
1606 // Class for datatype constructor TyDef::TYdef
1608 ///////////////////////////////////////////////////////////////////////////////
1609 class a_TyDef
: public Loc
{
1612 Id _1
; TyVars _2
; Ty _3
; Bool _4
;
1613 a_TyDef (Id x_1
, TyVars x_2
, Ty x_3
, Bool x_4
);
1615 inline int boxed(const a_TyDef
*) { return 1; }
1616 inline int untag(const a_TyDef
*) { return 0; }
1617 ///////////////////////////////////////////////////////////////////////////////
1619 // Datatype constructor functions for TyDef
1621 ///////////////////////////////////////////////////////////////////////////////
1622 extern a_TyDef
* TYdef (Id x_1
, TyVars x_2
, Ty x_3
, Bool x_4
);
1624 ///////////////////////////////////////////////////////////////////////////////
1626 // Class for datatype constructor FunDef::FUNdef
1628 ///////////////////////////////////////////////////////////////////////////////
1629 class a_FunDef
: public Loc
{
1632 QualId _1
; Ty _2
; Ty _3
; MatchRules _4
;
1633 a_FunDef (QualId x_1
, Ty x_2
, Ty x_3
, MatchRules x_4
);
1635 inline int boxed(const a_FunDef
*) { return 1; }
1636 inline int untag(const a_FunDef
*) { return 0; }
1637 ///////////////////////////////////////////////////////////////////////////////
1639 // Datatype constructor functions for FunDef
1641 ///////////////////////////////////////////////////////////////////////////////
1642 extern a_FunDef
* FUNdef (QualId x_1
, Ty x_2
, Ty x_3
, MatchRules x_4
);
1644 ///////////////////////////////////////////////////////////////////////////////
1646 // Base class for datatype QualId
1648 ///////////////////////////////////////////////////////////////////////////////
1649 class a_QualId
: public MEM
{
1652 tag_NESTEDid
= 0, tag_SIMPLEid
= 1
1657 inline int boxed(const a_QualId
*) { return 1; }
1658 ///////////////////////////////////////////////////////////////////////////////
1660 // Embbeded tag extraction functions
1662 ///////////////////////////////////////////////////////////////////////////////
1663 inline int untagp(const a_QualId
* x
)
1664 { return (unsigned long)x
& 3; }
1665 inline a_QualId
* derefp(const a_QualId
* x
)
1666 { return (a_QualId
*)((unsigned long)x
& ~3); }
1667 inline int untag(const a_QualId
* x
) { return untagp(x
); }
1668 ///////////////////////////////////////////////////////////////////////////////
1670 // Class for datatype constructor QualId::NESTEDid
1672 ///////////////////////////////////////////////////////////////////////////////
1673 class QualId_NESTEDid
: public a_QualId
{
1677 QualId_NESTEDid (Ty x_1
, QualId x_2
);
1680 ///////////////////////////////////////////////////////////////////////////////
1682 // Class for datatype constructor QualId::SIMPLEid
1684 ///////////////////////////////////////////////////////////////////////////////
1685 class QualId_SIMPLEid
: public a_QualId
{
1689 QualId_SIMPLEid (Id x_SIMPLEid
);
1692 ///////////////////////////////////////////////////////////////////////////////
1694 // Datatype constructor functions for QualId
1696 ///////////////////////////////////////////////////////////////////////////////
1697 extern a_QualId
* NESTEDid (Ty x_1
, QualId x_2
);
1698 extern a_QualId
* SIMPLEid (Id x_SIMPLEid
);
1700 ///////////////////////////////////////////////////////////////////////////////
1702 // Class for datatype constructor InferenceRule::INFERENCErule
1704 ///////////////////////////////////////////////////////////////////////////////
1705 class a_InferenceRule
: public Loc
{
1708 MatchRules _1
; Exp _2
; Conclusions _3
;
1709 a_InferenceRule (MatchRules x_1
, Exp x_2
, Conclusions x_3
);
1711 inline int boxed(const a_InferenceRule
*) { return 1; }
1712 inline int untag(const a_InferenceRule
*) { return 0; }
1713 ///////////////////////////////////////////////////////////////////////////////
1715 // Datatype constructor functions for InferenceRule
1717 ///////////////////////////////////////////////////////////////////////////////
1718 extern a_InferenceRule
* INFERENCErule (MatchRules x_1
, Exp x_2
, Conclusions x_3
);
1720 ///////////////////////////////////////////////////////////////////////////////
1722 // Base class for datatype Conclusion
1724 ///////////////////////////////////////////////////////////////////////////////
1725 class a_Conclusion
: public Loc
{
1727 enum Tag_Conclusion
{
1728 tag_ASSERTaction
= 0, tag_RETRACTaction
= 1, tag_STMTaction
= 2
1733 inline int boxed(const a_Conclusion
*) { return 1; }
1734 ///////////////////////////////////////////////////////////////////////////////
1736 // Embbeded tag extraction functions
1738 ///////////////////////////////////////////////////////////////////////////////
1739 inline int untagp(const a_Conclusion
* x
)
1740 { return (unsigned long)x
& 3; }
1741 inline a_Conclusion
* derefp(const a_Conclusion
* x
)
1742 { return (a_Conclusion
*)((unsigned long)x
& ~3); }
1743 inline int untag(const a_Conclusion
* x
) { return untagp(x
); }
1744 ///////////////////////////////////////////////////////////////////////////////
1746 // Class for datatype constructor Conclusion::ASSERTaction
1748 ///////////////////////////////////////////////////////////////////////////////
1749 class Conclusion_ASSERTaction
: public a_Conclusion
{
1753 Conclusion_ASSERTaction (Exp x_ASSERTaction
);
1756 ///////////////////////////////////////////////////////////////////////////////
1758 // Class for datatype constructor Conclusion::RETRACTaction
1760 ///////////////////////////////////////////////////////////////////////////////
1761 class Conclusion_RETRACTaction
: public a_Conclusion
{
1765 Conclusion_RETRACTaction (Exp x_RETRACTaction
);
1768 ///////////////////////////////////////////////////////////////////////////////
1770 // Class for datatype constructor Conclusion::STMTaction
1772 ///////////////////////////////////////////////////////////////////////////////
1773 class Conclusion_STMTaction
: public a_Conclusion
{
1777 Conclusion_STMTaction (Decls x_STMTaction
);
1780 ///////////////////////////////////////////////////////////////////////////////
1782 // Datatype constructor functions for Conclusion
1784 ///////////////////////////////////////////////////////////////////////////////
1785 extern a_Conclusion
* ASSERTaction (Exp x_ASSERTaction
);
1786 extern a_Conclusion
* RETRACTaction (Exp x_RETRACTaction
);
1787 extern a_Conclusion
* STMTaction (Decls x_STMTaction
);
1793 ///////////////////////////////////////////////////////////////////////////////
1795 // AST manipulation methods.
1797 ///////////////////////////////////////////////////////////////////////////////
1798 extern Exp
component_exp(Exps
, int);
1799 extern Exp
component_exp(Exps
, Id
);
1800 extern Exp
component_exp(LabExps
, Id
);
1802 ///////////////////////////////////////////////////////////////////////////////
1804 // Pretty printing methods.
1806 ///////////////////////////////////////////////////////////////////////////////
1807 extern std::ostream
& operator << (std::ostream
&, Exp
);
1808 extern std::ostream
& operator << (std::ostream
&,
1813 extern std::ostream
& operator << (std::ostream
&, LabExp
);
1814 extern std::ostream
& operator << (std::ostream
&, a_List
<LabExp
> *
1817 extern std::ostream
& operator << (std::ostream
&, Cost
);
1818 extern std::ostream
& operator << (std::ostream
&, MatchRule
);
1819 extern std::ostream
& operator << (std::ostream
&, QualId
);
1823 ------------------------------- Statistics -------------------------------
1824 Merge matching rules = yes
1825 Number of DFA nodes merged = 0
1826 Number of ifs generated = 0
1827 Number of switches generated = 0
1828 Number of labels = 0
1830 Adaptive matching = enabled
1831 Fast string matching = disabled
1832 Inline downcasts = enabled
1833 --------------------------------------------------------------------------