heptagon/test/good/when_merge1.ept

36 lines
777 B
Plaintext
Raw Normal View History

2010-12-14 18:36:54 +01:00
(* pour debugger ../../compiler/hec.byte -i -v -I ../../lib t1.ept *)
(* pour debugger
directory parsing global analysis dataflow sequential sigali simulation translation main
set arguments -v ../test/good/t1.ept *)
type t = A | B
node bool2int(b: bool) returns (o: int)
let
o = merge b (true -> 1) (false -> 0)
tel
node t2bool(x: t) returns (b: bool)
let
b = merge x (A-> true) (B-> false)
tel
2011-05-10 21:55:53 +02:00
node filter(x:int; c:t) returns (y:int on A(c))
2010-12-14 18:36:54 +01:00
let
2011-05-10 21:55:53 +02:00
y = x when A(c)
2010-12-14 18:36:54 +01:00
tel
2011-05-10 21:55:53 +02:00
node fusion(x1:int; x2:int; c:t) returns (y :int)
2010-12-14 18:36:54 +01:00
let
2011-05-10 21:55:53 +02:00
y = merge c (A -> x1) (B -> x2)
2011-05-23 14:04:11 +02:00
tel
2012-07-18 16:54:44 +02:00
node main() returns (y,c':int)
var c:t;x:int;
let
x = 1 fby if x > 10 then 1 else x + 2;
c = A fby B fby c;
y = fusion(filter(x,c),-4,c);
c' = bool2int(t2bool(c));
tel