mirror of
https://github.com/anoma/juvix.git
synced 2024-12-14 17:32:00 +03:00
25 lines
273 B
Plaintext
25 lines
273 B
Plaintext
-- recursion
|
|
|
|
function sum(integer) : integer {
|
|
push arg[0];
|
|
push 0;
|
|
eq;
|
|
br {
|
|
true: push 0
|
|
false: {
|
|
push 1;
|
|
push arg[0];
|
|
sub;
|
|
call sum;
|
|
push arg[0];
|
|
add;
|
|
}
|
|
};
|
|
ret;
|
|
}
|
|
|
|
function main() {
|
|
push 1000;
|
|
tcall sum;
|
|
}
|