1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-12 14:28:08 +03:00
juvix/tests/Asm/positive/test006.jva
2022-09-29 17:44:55 +02:00

58 lines
724 B
Plaintext

-- IO builtins
function const(*, *) {
push arg[0];
ret;
}
function print(*) : IO {
push arg[0];
alloc write;
ret;
}
function sequence(IO, IO) : IO {
push arg[1];
calloc const 1;
push arg[0];
alloc bind;
ret;
}
function main () {
push "\n";
alloc write;
push 5;
alloc write;
push 4;
alloc write;
call sequence;
push 3;
alloc write;
push 2;
alloc write;
push 1;
alloc write;
call sequence;
call sequence;
call sequence;
call sequence;
calloc print 0;
push "\n";
alloc return;
alloc bind;
calloc print 0;
push 2;
alloc return;
alloc bind;
call sequence;
calloc print 0;
push 1;
alloc return;
alloc bind;
call sequence;
tcall sequence;
}