Release coccinelle-0.2.0
[bpt/coccinelle.git] / ctl / ast_ctl.ml
1 (*
2 * Copyright 2005-2009, 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 (* ---------------------------------------------------------------------- *)
25 (* Types *)
26 (* ---------------------------------------------------------------------- *)
27
28 type strict = STRICT | NONSTRICT
29
30 type keep_binding = bool (* true = put in witness tree *)
31
32 (* CTL parameterised on basic predicates and metavar's*)
33 type ('pred,'mvar,'anno) generic_ctl =
34 | False
35 | True
36 | Pred of 'pred
37 | Not of (('pred,'mvar,'anno) generic_ctl)
38 | Exists of keep_binding * 'mvar * (('pred,'mvar,'anno) generic_ctl)
39 | And of strict * (('pred,'mvar,'anno) generic_ctl) *
40 (('pred,'mvar,'anno) generic_ctl)
41 | AndAny of direction * strict * (('pred,'mvar,'anno) generic_ctl) *
42 (('pred,'mvar,'anno) generic_ctl)
43 | HackForStmt of direction * strict * (('pred,'mvar,'anno) generic_ctl) *
44 (('pred,'mvar,'anno) generic_ctl)
45 | Or of (('pred,'mvar,'anno) generic_ctl) *
46 (('pred,'mvar,'anno) generic_ctl)
47 | Implies of (('pred,'mvar,'anno) generic_ctl) *
48 (('pred,'mvar,'anno) generic_ctl)
49 | AF of direction * strict * (('pred,'mvar,'anno) generic_ctl)
50 | AX of direction * strict * (('pred,'mvar,'anno) generic_ctl)
51 | AG of direction * strict * (('pred,'mvar,'anno) generic_ctl)
52 | AW of direction * strict *
53 (* versions with exists v *)
54 (('pred,'mvar,'anno) generic_ctl) * (('pred,'mvar,'anno) generic_ctl)
55 | AU of direction * strict *
56 (* versions with exists v *)
57 (('pred,'mvar,'anno) generic_ctl) * (('pred,'mvar,'anno) generic_ctl)
58 | EF of direction * (('pred,'mvar,'anno) generic_ctl)
59 | EX of direction * (('pred,'mvar,'anno) generic_ctl)
60 | EG of direction * (('pred,'mvar,'anno) generic_ctl)
61 | EU of direction * (('pred,'mvar,'anno) generic_ctl) *
62 (('pred,'mvar,'anno) generic_ctl)
63 | Let of string *
64 (('pred,'mvar,'anno) generic_ctl) *
65 (('pred,'mvar,'anno) generic_ctl)
66 | LetR of direction * string * (* evals phi1 wrt reachable states *)
67 (('pred,'mvar,'anno) generic_ctl) *
68 (('pred,'mvar,'anno) generic_ctl)
69 | Ref of string
70 | SeqOr of (('pred,'mvar,'anno) generic_ctl) *
71 (('pred,'mvar,'anno) generic_ctl)
72 | Uncheck of (('pred,'mvar,'anno) generic_ctl)
73 | InnerAnd of (('pred,'mvar,'anno) generic_ctl)
74 | XX of (('pred,'mvar,'anno) generic_ctl) (* fake, used in asttoctl *)
75
76 and direction = FORWARD (* the normal way *) | BACKWARD (* toward the start *)
77
78 let unwrap (ctl,_) = ctl
79 let rewrap (_,model) ctl = (ctl,model)
80 let get_line (_,l) = l
81
82
83 (* NOTE: No explicit representation of the bottom subst., i.e., FALSE *)
84 type ('mvar,'value) generic_subst =
85 | Subst of 'mvar * 'value
86 | NegSubst of 'mvar * 'value
87 type ('mvar,'value) generic_substitution = ('mvar,'value) generic_subst list
88
89 type ('state,'subst,'anno) generic_witnesstree =
90 Wit of
91 'state * 'subst * 'anno * ('state,'subst,'anno) generic_witnesstree list
92 | NegWit of ('state,'subst,'anno) generic_witnesstree
93
94 (* ---------------------------------------------------------------------- *)
95
96 type 'a modif = Modif of 'a | UnModif of 'a | Control
97
98 (* ---------------------------------------------------------------------- *)