[Lustre -> intermediate] fix for the [pre] construct
This commit is contained in:
parent
77c865e360
commit
aa7f7514d3
@ -14,11 +14,14 @@ let ast_to_intermediate_ast (nodes: t_nodelist) (h: node_states): i_nodelist =
|
|||||||
let ast_to_intermediate_ast_varlist vl = snd vl in
|
let ast_to_intermediate_ast_varlist vl = snd vl in
|
||||||
let rec ast_to_intermediate_ast_expr hloc = function
|
let rec ast_to_intermediate_ast_expr hloc = function
|
||||||
| EVar (_, v) ->
|
| EVar (_, v) ->
|
||||||
begin
|
begin
|
||||||
match Hashtbl.find_opt hloc (Utils.name_of_var v, false) with
|
match Hashtbl.find_opt hloc (Utils.name_of_var v, false) with
|
||||||
| None -> IEVar (CVInput (name_of_var v))
|
| None -> IEVar (CVInput (name_of_var v))
|
||||||
| Some (s, i) -> IEVar (CVStored (s, i))
|
| Some (s, i) -> IEVar (CVStored (s, i))
|
||||||
end
|
end
|
||||||
|
| EMonOp (_, MOp_pre, EVar (_, v)) ->
|
||||||
|
let s, i = Hashtbl.find hloc (Utils.name_of_var v, true) in
|
||||||
|
IEVar (CVStored (s, i))
|
||||||
| EMonOp (_, op, e) -> IEMonOp (op, ast_to_intermediate_ast_expr hloc e)
|
| EMonOp (_, op, e) -> IEMonOp (op, ast_to_intermediate_ast_expr hloc e)
|
||||||
| EBinOp (_, op, e, e') ->
|
| EBinOp (_, op, e, e') ->
|
||||||
IEBinOp (op, ast_to_intermediate_ast_expr hloc e, ast_to_intermediate_ast_expr hloc e')
|
IEBinOp (op, ast_to_intermediate_ast_expr hloc e, ast_to_intermediate_ast_expr hloc e')
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
node n (i: int) returns (o: int);
|
node n (i: int) returns (o: int);
|
||||||
var v, t: int; a, b: bool;
|
var v: int;
|
||||||
let
|
let
|
||||||
a = true -> false;
|
|
||||||
b = a and not (pre a);
|
|
||||||
o = 1;
|
o = 1;
|
||||||
v = pre o;
|
v = pre o;
|
||||||
t = o + pre i;
|
|
||||||
tel
|
tel
|
||||||
|
Loading…
Reference in New Issue
Block a user