blob: 45b10402ef705bbdf43a0918f31823b7e82f80ab (
plain)
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
|
looping structures!
<<<
for i uint = 0..10 {
print(i)
}
for x uint = 0, x < 10, x++ {
print(r)
}
var y uint = 0
while y < 10 {
print(y)
y++
}
>>>
(loop for-each (declaration i (type name uint) (initializer (expr (binary .. (expr 0) (expr 10))))) (block
(expr (call (expr (name print)) (arg (expr (name i)))))
))
(loop c-style (declaration x (type name uint) (initializer (expr 0))) (condition (expr (binary < (expr (name x)) (expr 10)))) (iteration (expr (increment/decrement ++ postfix (expr (name x))))) (block
(expr (call (expr (name print)) (arg (expr (name r)))))
))
(variable (declaration y (type name uint) (initializer (expr 0))))
(loop while (condition (expr (binary < (expr (name y)) (expr 10)))) (block
(expr (call (expr (name print)) (arg (expr (name y)))))
(expr (increment/decrement ++ postfix (expr (name y))))
))
|