Release coccinelle-0.2.3rc1
[bpt/coccinelle.git] / ctl / ast_ctl.ml
CommitLineData
5636bb2c
C
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
9f8e26f4 23(*
ae4735db 24 * Copyright 2005-2010, Ecole des Mines de Nantes, University of Copenhagen
9f8e26f4
C
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
34e49164
C
45
46(* ---------------------------------------------------------------------- *)
47(* Types *)
48(* ---------------------------------------------------------------------- *)
49
50type strict = STRICT | NONSTRICT
51
52type keep_binding = bool (* true = put in witness tree *)
53
54(* CTL parameterised on basic predicates and metavar's*)
ae4735db 55type ('pred,'mvar,'anno) generic_ctl =
34e49164
C
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)
ae4735db 61 | And of strict * (('pred,'mvar,'anno) generic_ctl) *
34e49164 62 (('pred,'mvar,'anno) generic_ctl)
ae4735db 63 | AndAny of direction * strict * (('pred,'mvar,'anno) generic_ctl) *
34e49164 64 (('pred,'mvar,'anno) generic_ctl)
ae4735db 65 | HackForStmt of direction * strict * (('pred,'mvar,'anno) generic_ctl) *
34e49164 66 (('pred,'mvar,'anno) generic_ctl)
ae4735db 67 | Or of (('pred,'mvar,'anno) generic_ctl) *
34e49164 68 (('pred,'mvar,'anno) generic_ctl)
ae4735db 69 | Implies of (('pred,'mvar,'anno) generic_ctl) *
34e49164
C
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)
ae4735db 83 | EU of direction * (('pred,'mvar,'anno) generic_ctl) *
34e49164 84 (('pred,'mvar,'anno) generic_ctl)
ae4735db
C
85 | Let of string *
86 (('pred,'mvar,'anno) generic_ctl) *
34e49164
C
87 (('pred,'mvar,'anno) generic_ctl)
88 | LetR of direction * string * (* evals phi1 wrt reachable states *)
ae4735db 89 (('pred,'mvar,'anno) generic_ctl) *
34e49164
C
90 (('pred,'mvar,'anno) generic_ctl)
91 | Ref of string
ae4735db 92 | SeqOr of (('pred,'mvar,'anno) generic_ctl) *
34e49164
C
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
98and direction = FORWARD (* the normal way *) | BACKWARD (* toward the start *)
99
100let unwrap (ctl,_) = ctl
101let rewrap (_,model) ctl = (ctl,model)
102let get_line (_,l) = l
103
104
105(* NOTE: No explicit representation of the bottom subst., i.e., FALSE *)
ae4735db 106type ('mvar,'value) generic_subst =
34e49164
C
107 | Subst of 'mvar * 'value
108 | NegSubst of 'mvar * 'value
109type ('mvar,'value) generic_substitution = ('mvar,'value) generic_subst list
110
111type ('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
118type 'a modif = Modif of 'a | UnModif of 'a | Control
119
120(* ---------------------------------------------------------------------- *)