Release coccinelle-0.2.3rc1
[bpt/coccinelle.git] / ctl / ast_ctl.ml
1 (*
2 * Copyright 2005-2010, Ecole des Mines de Nantes, University of Copenhagen
3 * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
4 * This file is part of Coccinelle.
5 *
6 * Coccinelle is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, according to version 2 of the License.
9 *
10 * Coccinelle is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * The authors reserve the right to distribute this or future versions of
19 * Coccinelle under other licenses.
20 *)
21
22
23 (*
24 * Copyright 2005-2010, Ecole des Mines de Nantes, University of Copenhagen
25 * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
26 * This file is part of Coccinelle.
27 *
28 * Coccinelle is free software: you can redistribute it and/or modify
29 * it under the terms of the GNU General Public License as published by
30 * the Free Software Foundation, according to version 2 of the License.
31 *
32 * Coccinelle is distributed in the hope that it will be useful,
33 * but WITHOUT ANY WARRANTY; without even the implied warranty of
34 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35 * GNU General Public License for more details.
36 *
37 * You should have received a copy of the GNU General Public License
38 * along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
39 *
40 * The authors reserve the right to distribute this or future versions of
41 * Coccinelle under other licenses.
42 *)
43
44
45
46 (* ---------------------------------------------------------------------- *)
47 (* Types *)
48 (* ---------------------------------------------------------------------- *)
49
50 type strict = STRICT | NONSTRICT
51
52 type keep_binding = bool (* true = put in witness tree *)
53
54 (* CTL parameterised on basic predicates and metavar's*)
55 type ('pred,'mvar,'anno) generic_ctl =
56 | False
57 | True
58 | Pred of 'pred
59 | Not of (('pred,'mvar,'anno) generic_ctl)
60 | Exists of keep_binding * 'mvar * (('pred,'mvar,'anno) generic_ctl)
61 | And of strict * (('pred,'mvar,'anno) generic_ctl) *
62 (('pred,'mvar,'anno) generic_ctl)
63 | AndAny of direction * strict * (('pred,'mvar,'anno) generic_ctl) *
64 (('pred,'mvar,'anno) generic_ctl)
65 | HackForStmt of direction * strict * (('pred,'mvar,'anno) generic_ctl) *
66 (('pred,'mvar,'anno) generic_ctl)
67 | Or of (('pred,'mvar,'anno) generic_ctl) *
68 (('pred,'mvar,'anno) generic_ctl)
69 | Implies of (('pred,'mvar,'anno) generic_ctl) *
70 (('pred,'mvar,'anno) generic_ctl)
71 | AF of direction * strict * (('pred,'mvar,'anno) generic_ctl)
72 | AX of direction * strict * (('pred,'mvar,'anno) generic_ctl)
73 | AG of direction * strict * (('pred,'mvar,'anno) generic_ctl)
74 | AW of direction * strict *
75 (* versions with exists v *)
76 (('pred,'mvar,'anno) generic_ctl) * (('pred,'mvar,'anno) generic_ctl)
77 | AU of direction * strict *
78 (* versions with exists v *)
79 (('pred,'mvar,'anno) generic_ctl) * (('pred,'mvar,'anno) generic_ctl)
80 | EF of direction * (('pred,'mvar,'anno) generic_ctl)
81 | EX of direction * (('pred,'mvar,'anno) generic_ctl)
82 | EG of direction * (('pred,'mvar,'anno) generic_ctl)
83 | EU of direction * (('pred,'mvar,'anno) generic_ctl) *
84 (('pred,'mvar,'anno) generic_ctl)
85 | Let of string *
86 (('pred,'mvar,'anno) generic_ctl) *
87 (('pred,'mvar,'anno) generic_ctl)
88 | LetR of direction * string * (* evals phi1 wrt reachable states *)
89 (('pred,'mvar,'anno) generic_ctl) *
90 (('pred,'mvar,'anno) generic_ctl)
91 | Ref of string
92 | SeqOr of (('pred,'mvar,'anno) generic_ctl) *
93 (('pred,'mvar,'anno) generic_ctl)
94 | Uncheck of (('pred,'mvar,'anno) generic_ctl)
95 | InnerAnd of (('pred,'mvar,'anno) generic_ctl)
96 | XX of (('pred,'mvar,'anno) generic_ctl) (* fake, used in asttoctl *)
97
98 and direction = FORWARD (* the normal way *) | BACKWARD (* toward the start *)
99
100 let unwrap (ctl,_) = ctl
101 let rewrap (_,model) ctl = (ctl,model)
102 let get_line (_,l) = l
103
104
105 (* NOTE: No explicit representation of the bottom subst., i.e., FALSE *)
106 type ('mvar,'value) generic_subst =
107 | Subst of 'mvar * 'value
108 | NegSubst of 'mvar * 'value
109 type ('mvar,'value) generic_substitution = ('mvar,'value) generic_subst list
110
111 type ('state,'subst,'anno) generic_witnesstree =
112 Wit of
113 'state * 'subst * 'anno * ('state,'subst,'anno) generic_witnesstree list
114 | NegWit of ('state,'subst,'anno) generic_witnesstree
115
116 (* ---------------------------------------------------------------------- *)
117
118 type 'a modif = Modif of 'a | UnModif of 'a | Control
119
120 (* ---------------------------------------------------------------------- *)