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