-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathssa.rb
103 lines (91 loc) · 1.3 KB
/
ssa.rb
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
def m b # defines b_0
i = 0 # defines i_0
puts i # reads i_0 (first read)
puts i + 1 # reads i_0 (last read)
if b # reads b_0
i = 1 # defines i_1
puts i # reads i_1 (first read)
puts i + 1 # reads i_1 (last read)
else
i = 2 # defines i_2
puts i # reads i_2 (first read)
puts i + 1 # reads i_2 (last read)
end
# defines i_3 = phi(i_1, i_2)
puts i # reads i3 (first read and last read)
end
def m1 x
while x >= 0
puts x
x -= 1
end
end
def m2 elements
for elem in elements do
puts elem
end
puts elem
end
def m3
[1,2,3].each do |x|
puts x
end
end
def m4
puts m3
m3 = 10
puts m3 + 1
end
def m5 b
x = 0 if b
puts x
end
def m6 (x = (y = 10))
puts y
end
def m7 foo
x = foo.x
puts x
end
def m8
x = 10
x += 10
puts x
end
def m9 a
captured = 10
a.times do |a|
puts a
puts captured
captured += 1
end
puts captured
end
def m10
captured = 0
foo do
bar(baz: captured)
end
end
def m11
captured = 0
foo do
bar do
puts captured
end
end
end
def m12(b1, b2, b3, b4)
x = 0
if (b1) then
puts x
elsif (b2) then
puts x
end
# phi read for x
if (b3) then
puts x
elsif (b4) then
puts x
end
end