summaryrefslogtreecommitdiff
path: root/abstract/nonrelational.ml
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2014-05-14 17:23:57 +0200
committerAlex AUVOLAT <alex.auvolat@ens.fr>2014-05-14 17:23:57 +0200
commit9714afeb275360110161c870b50627128fda75a0 (patch)
treeed9e8b8ff1d3881ec1e16943d07c87b1dd739670 /abstract/nonrelational.ml
parentd4ab85a1a6503cdbcb98c183c3357926d78da8a7 (diff)
downloadSemVerif-Projet-9714afeb275360110161c870b50627128fda75a0.tar.gz
SemVerif-Projet-9714afeb275360110161c870b50627128fda75a0.zip
Many things work!
Diffstat (limited to 'abstract/nonrelational.ml')
-rw-r--r--abstract/nonrelational.ml38
1 files changed, 23 insertions, 15 deletions
diff --git a/abstract/nonrelational.ml b/abstract/nonrelational.ml
index d4118da..7221df1 100644
--- a/abstract/nonrelational.ml
+++ b/abstract/nonrelational.ml
@@ -66,16 +66,25 @@ module NonRelational (V : VALUE_DOMAIN) : ENVIRONMENT_DOMAIN = struct
| AST_identifier(a, _), AST_identifier(b, _) ->
let v1, v2 = get_var env a, get_var env b in
let v1', v2' = V.leq v1 v2 in
- Env (VarMap.add a v1' (VarMap.add b v1' env))
- | AST_identifier(a, _), AST_int_const(s, _) ->
- let v1, v2 = get_var env a, V.const (Z.of_string s) in
- let v1', _ = V.leq v1 v2 in
- Env (VarMap.add a v1' env)
- | AST_int_const(s, _), AST_identifier(b, _) ->
- let v1, v2 = V.const (Z.of_string s), get_var env b in
- let _, v2' = V.leq v1 v2 in
- Env (VarMap.add b v2' env)
- | _ -> Env env)
+ Env (VarMap.add a v1' (VarMap.add b v2' env))
+ | AST_identifier(a, _), _ ->
+ let v1, v2 = get_var env a, eval env e2 in
+ let v1', v2' = V.leq v1 v2 in
+ if V.bottom = v2'
+ then Bot
+ else Env (VarMap.add a v1' env)
+ | _, AST_identifier(b, _) ->
+ let v1, v2 = eval env e1, get_var env b in
+ let v1', v2' = V.leq v1 v2 in
+ if V.bottom = v1'
+ then Bot
+ else Env (VarMap.add b v2' env)
+ | _ ->
+ let v1, v2 = eval env e1, eval env e2 in
+ let v1', v2' = V.leq v1 v2 in
+ if V.bottom = v1' ||V.bottom = v2'
+ then Bot
+ else Env env)
x
let join a b = match a, b with
@@ -106,7 +115,7 @@ module NonRelational (V : VALUE_DOMAIN) : ENVIRONMENT_DOMAIN = struct
(* pretty-printing *)
let var_str env vars =
match env with
- | Bot -> "bot"
+ | Bot -> "bottom"
| Env env ->
let v = List.fold_left
(fun s id ->
@@ -118,8 +127,7 @@ module NonRelational (V : VALUE_DOMAIN) : ENVIRONMENT_DOMAIN = struct
in
"[ " ^ v ^ " ]"
- let all_vars_str env =
- match env with
- | Bot -> "bot"
- | Env map -> var_str env (List.map fst (VarMap.bindings map))
+ let vars env = match env with
+ | Bot -> []
+ | Env env -> List.map fst (VarMap.bindings env)
end