1 /*
2 
3     This file is part of the Maude 2 interpreter.
4 
5     Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA.
6 
7     This program is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation; either version 2 of the License, or
10     (at your option) any later version.
11 
12     This program is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
16 
17     You should have received a copy of the GNU General Public License
18     along with this program; if not, write to the Free Software
19     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
20 
21 */
22 
23 //
24 //      Class for symbols for built in branch (if-then-else-fi type) operations.
25 //
26 #ifndef _branchSymbol_hh_
27 #define _branchSymbol_hh_
28 #include "freeSymbol.hh"
29 
30 class BranchSymbol : public FreeSymbol
31 {
32 public:
33   BranchSymbol(int id, int nrArgs);
34   ~BranchSymbol();
35 
36   bool attachData(const Vector<Sort*>& opDeclaration,
37 		  const char* purpose,
38 		  const Vector<const char*>& data);
39   bool attachTerm(const char* purpose, Term* term);
40   void copyAttachments(Symbol* original, SymbolMap* map);
41   void getDataAttachments(const Vector<Sort*>& opDeclaration,
42 			  Vector<const char*>& purposes,
43 			  Vector<Vector<const char*> >& data);
44   void getTermAttachments(Vector<const char*>& purposes,
45 			  Vector<Term*>& terms);
46   //
47   //	Built in equational rewriting semantics and strategy.
48   //
49   bool eqRewrite(DagNode* subject, RewritingContext& context);
50   void stackArguments(DagNode* subject,
51 		      Vector<RedexPosition>& stack,
52 		      int parentIndex);
53   //
54   //	We need to insert some fake declarations to encode our sort
55   //	structure and we disable sort based optimizations.
56   //
57   void compileOpDeclarations();
58   bool rangeSortNeverLeqThan(Sort* sort);
59   bool rangeSortAlwaysLeqThan(Sort* sort);
60   bool domainSortAlwaysLeqThan(Sort* sort, int argNr);
61 
62 private:
63   Vector<Term*> testTerms;
64 };
65 
66 #endif
67