blob: f43d7ba20f4705a1516ab20c5410da6a5ee3c3e8 (
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
32
33
34
|
#include "std/io.toc";
addmul ::= fn (x:=0, y:=0) add := x+y, mul := x*y {
};
do_foo ::= fn (x := 3) y := x {
y *= 12;
y += x;
};
main ::= fn() {
a, m := addmul();
puti(a); puti(m);
a, m = addmul(7,3);
puti(a); puti(m);
a, m = addmul(5);
puti(a); puti(m);
a, m = addmul(y = 17);
puti(a); puti(m);
c, d ::= addmul();
puti(c); puti(d);
e, f ::= addmul(y = 3, x = 7);
puti(e); puti(f);
z := do_foo();
puti(z);
z = do_foo(-1);
puti(z);
z = do_foo(x = -1);
puti(z);
};
|