-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhello.ceu
65 lines (60 loc) · 1.34 KB
/
hello.ceu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
native/nohold _printf;
native/pre do
##include <stdio.h> // include the relevant header for "printf"
end
input int I;
output int O;
// _printf("Boot reaction\n");
// This is probably bad style - leaning on the order of execution to communicate "side band" information from one trail to another.
var bool unhandled = true;
par/or do
loop do
await I;
// _printf("Control flow always reaches here immediately after an I event.\n");
unhandled = true;
end
with
par/and do
var int a;
loop do
a = await I;
if a % 3 == 0 then
break;
end
end
// _printf("Control flow only reaches here after an I event containing a multiple of 3.\n");
emit O(-1);
unhandled = false;
with
var int b;
loop do
b = await I;
if b % 5 == 0 then
break;
end
end
// _printf("Control flow only reaches here after an I event containing a multiple of 5.\n");
emit O(-2);
unhandled = false;
end
with
loop do
var int c;
loop do
c = await I;
if unhandled then
break;
end
end
// _printf("Control flow only reaches here after an I event was not handled by the 3 or 5 previous trails.\n");
emit O(c);
end
with
loop do
await I;
// _printf("Control flow reaches here after an I event.\n");
emit O(-3);
end
end
emit O(-3);
escape 0;