Skip to content
Snippets Groups Projects
Commit 67bd8962 authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Fix a bug in the fresh var names generation : I was suffixing a var name by an incremented integer.

E.g., when creating a fresh var using the name of "L1", I was creating a var names "_L11", and then
"_L12", and so on. But if a var is named "L11", "_L111" is created. If if "L1" is used to generate
11 frash vart names, the name "_L111" clashes !!!

The fix contist in adding an underscore before : "L1" produces "_L1_1", "_L1_2", ..., and "_L1_11".

nb : the naming scheme is still wrong for other reasons... Next fix.
parent 6feb4b76
No related branches found
No related tags found
No related merge requests found
(** Time-stamp: <modified the 09/12/2008 (at 17:49) by Erwan Jahier> *) (** Time-stamp: <modified the 20/01/2010 (at 11:24) by Erwan Jahier> *)
(* maps node_key to a string that won't clash *) (* maps node_key to a string that won't clash *)
...@@ -59,11 +58,11 @@ let (new_local_var : string -> string) = ...@@ -59,11 +58,11 @@ let (new_local_var : string -> string) =
try try
let cpt = Hashtbl.find local_var_tbl prefix in let cpt = Hashtbl.find local_var_tbl prefix in
Hashtbl.replace local_var_tbl prefix (cpt+1); Hashtbl.replace local_var_tbl prefix (cpt+1);
"_" ^ prefix ^ (string_of_int cpt) "_" ^ prefix ^"_"^ (string_of_int cpt)
with with
Not_found -> Not_found ->
Hashtbl.add local_var_tbl prefix 2; Hashtbl.add local_var_tbl prefix 2;
"_" ^ prefix ^ "1" "_" ^ prefix ^ "_1"
(********************************************************************************) (********************************************************************************)
......
node n1(n1e1,n1e2:bool) returns (n1s:bool);
var n1b1:bool;
n1b2:bool;
let
n1b1 = n1e1 or n1e2 ;
n1b2 = n1e1 and n1e2 ;
n1s = (n1b1 or n1b2);
tel
node fn (b:bool) returns (res:bool);
var _n1e1_1:bool;
let
_n1e1_1 = not b;
res = n1(b, _n1e1_1);
tel
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment