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