summaryrefslogtreecommitdiff
path: root/interpret
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ansys.com>2014-06-17 17:38:29 +0200
committerAlex Auvolat <alex.auvolat@ansys.com>2014-06-17 17:38:29 +0200
commit2b62d844cc81b60bcbdfc145097139995ea6f3a0 (patch)
tree8c34ecf12daf28569ac8a5364eb0438b9262308c /interpret
parentce4f339ced19e2ff7d79c2c8ec5b3ee478d5d365 (diff)
downloadscade-analyzer-2b62d844cc81b60bcbdfc145097139995ea6f3a0.tar.gz
scade-analyzer-2b62d844cc81b60bcbdfc145097139995ea6f3a0.zip
Some abstract interpretation does something now.
Diffstat (limited to 'interpret')
-rw-r--r--interpret/ast_util.ml4
-rw-r--r--interpret/interpret.ml14
-rw-r--r--interpret/rename.ml4
3 files changed, 11 insertions, 11 deletions
diff --git a/interpret/ast_util.ml b/interpret/ast_util.ml
index f5a1978..9cfe995 100644
--- a/interpret/ast_util.ml
+++ b/interpret/ast_util.ml
@@ -41,7 +41,7 @@ let get_root_scope p root =
(* Utility : find instances declared in an expression *)
(* extract_instances :
- prog -> expr ext -> (id * eqs * (var_def * expr ext) list) list
+ prog -> expr ext -> (id * id * eqs * (var_def * expr ext) list) list
*)
let rec extract_instances p e = match fst e with
| AST_idconst _ | AST_identifier _
@@ -56,7 +56,7 @@ let rec extract_instances p e = match fst e with
let more = List.flatten (List.map (extract_instances p) args) in
let (node, _) = find_node_decl p f in
let args_x = List.map2 (fun id arg -> id, arg) node.args args in
- (id, node.body, args_x)::more
+ (f, id, node.body, args_x)::more
(* Utility : find pre declarations in an expression *)
diff --git a/interpret/interpret.ml b/interpret/interpret.ml
index f28bce0..6f7c90e 100644
--- a/interpret/interpret.ml
+++ b/interpret/interpret.ml
@@ -211,7 +211,7 @@ end = struct
| AST_instance((f, _), args, nid) ->
let (n, _) = find_node_decl env.st.p f in
List.map
- (fun (_, (id, _), _) -> get_var env (node^"/"^nid) id)
+ (fun (_, id, _) -> get_var env (node^"/"^nid) id)
n.ret
(*
@@ -226,7 +226,7 @@ end = struct
Hashtbl.replace env.vars (node^"/"^prefix^"init") (VBool true);
let do_exp e =
List.iter
- (fun (id, eqs, _) -> reset_scope env (node^"/"^id, "", eqs))
+ (fun (_, id, eqs, _) -> reset_scope env (node^"/"^id, "", eqs))
(extract_instances env.st.p e)
in
let do_eq (e, _) = match e with
@@ -259,9 +259,9 @@ end = struct
Hashtbl.replace env.vars (node^"/"^prefix^"act") (VBool true);
let do_expr e =
List.iter
- (fun (id, eqs, args) ->
+ (fun (_, id, eqs, args) ->
activate_scope env (node^"/"^id, "", eqs);
- let do_arg ((_,(name,_),_), expr) =
+ let do_arg ((_,name,_), expr) =
let apath = node^"/"^id^"/"^name in
let calc () =
match eval_expr env (node, prefix) expr with
@@ -329,7 +329,7 @@ end = struct
let rec do_weak_transitions env (node, prefix, eqs) =
let do_expr e =
List.iter
- (fun (id, eqs, args) ->
+ (fun (_, id, eqs, args) ->
do_weak_transitions env (node^"/"^id, "", eqs))
(extract_instances env.st.p e)
in
@@ -404,7 +404,7 @@ end = struct
save (extract_pre e) in
(* Save recursively in sub instances of nodes *)
let save = List.fold_left
- (fun save (n, eqs, _) ->
+ (fun save (_, n, eqs, _) ->
aux (node^"/"^n, "", eqs) save)
save (extract_instances env.st.p e)
in save
@@ -447,7 +447,7 @@ end = struct
p = p;
root_scope = get_root_scope p root;
save = VarMap.empty;
- outputs = (List.map (fun (_,(n,_),_) -> n) n.ret);
+ outputs = (List.map (fun (_,n,_) -> n) n.ret);
} in
let env = { st = st; vars = Hashtbl.create 42 } in
diff --git a/interpret/rename.ml b/interpret/rename.ml
index 46c6f04..654b101 100644
--- a/interpret/rename.ml
+++ b/interpret/rename.ml
@@ -17,7 +17,7 @@ let consts_renaming p =
(* add_var_defs : string -> renaming -> var_def list -> renaming *)
let add_var_defs prefix =
List.fold_left
- (fun rn (_,(n,_),_) -> VarMap.add n (prefix^n, false) rn)
+ (fun rn (_,n,_) -> VarMap.add n (prefix^n, false) rn)
(* rename_expr : expr ext -> renaming -> expr ext *)
let rec rename_expr exp rn =
@@ -50,7 +50,7 @@ let rename_var rn id =
let rename_var_ext rn (id, loc) = (rename_var rn id, loc)
-let rename_var_def rn (p, id, t) = (p, rename_var_ext rn id, t)
+let rename_var_def rn (p, id, t) = (p, rename_var rn id, t)
(* rename_eqn : renaming -> eqn ext -> eqn ext *)
let rec rename_eqn rn e =