gcc config
[prop.git] / prop-src / grsgen.ph
blobf615015dac928602041fff5e2ca77090309790ec
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 //  This file describes the graph rewriting system compiler.
4 //
5 ///////////////////////////////////////////////////////////////////////////////
6 #ifndef graph_rewriting_system_compiler_h
7 #define graph_rewriting_system_compiler_h
9 #include "basics.ph"
10 #include "codegen.h"
11 #include "matchcom.ph"
13 ///////////////////////////////////////////////////////////////////////////////
15 //  Forward type declarations
17 ///////////////////////////////////////////////////////////////////////////////
18 datatype Pat and Exp and Decl;
20 ///////////////////////////////////////////////////////////////////////////////
22 //  Abstract syntax for graph rewriting rules
24 ///////////////////////////////////////////////////////////////////////////////
25 datatype 
26     GraphRewritingRule : Loc =         // a graph rewriting rule
27        GRSrule { lhs : GRSPat,         // antecedent
28                  rhs : GRSConclusions  // conclusions
29                }
31 and GRSPat : Loc =                 // antecedent of a rule
32        EDGEgpat  (Id, List<Pat>)   // edge pattern, i.e. pattern on a relation 
33     |  GUARDgpat (Exp)             // guard expressions
34     |  NOTgpat   (GRSPat)          // negation
35     |  ANDgpat   (GRSPat, GRSPat)  // conjunction
36     |  ORgpat    (GRSPat, GRSPat)  // disjunction
37     |  FORALLgpat(Id, GRSPat)      // universal quantification
39 and GRSConclusion : Loc = 
40        ADDEDGEaction     (Id, List<Exp>)  // add a new edge
41     |  DELETEEDGEaction  (Id, List<Exp>)  // delete an edge
42     |  ADDNODEaction     (Exp)            // add a node
43     |  DELETENODEaction  (Exp)            // delete a node
44     |  EMBEDDEDaction    (List<Decl>)     // any embedded action
46 where type GRSConclusions = List<GRSConclusion>
49 ///////////////////////////////////////////////////////////////////////////////
51 //  The interface to the graph rewriting system compiler
53 ///////////////////////////////////////////////////////////////////////////////
54 class GraphRewritingCompiler : virtual public CodeGen,
55                                virtual public MatchCompiler
56 {  GraphRewritingCompiler(const GraphRewritingCompiler&);
57    void operator = (const GraphRewritingCompiler&);
58 public:
59    GraphRewritingCompiler();
60   ~GraphRewritingCompiler();
62    void gen_graph_rewriting_system (Id, LabTys, List<GraphRewritingRule>);
65 #endif