Skip to content

Commit

Permalink
test names
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcz committed Dec 10, 2023
1 parent ad05058 commit f129ccb
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions tests/Asm/positive/test036.jva
Original file line number Diff line number Diff line change
Expand Up @@ -4,71 +4,71 @@ type stream {
cons : integer -> (unit -> stream) -> stream;
}

function force(unit -> stream) : stream {
function force(f : unit -> stream) : stream {
push unit;
push arg[0];
push f;
tcall $ 1;
}

function filter(integer -> bool, unit -> stream, unit) : stream {
push arg[1];
function filter(f : integer -> bool, s : unit -> stream, unit) : stream {
push s;
call force;
tsave {
push tmp[0].cons[0];
push arg[0];
tsave s1 {
push s1.cons[0];
push f;
call $ 1;
br {
true: {
push tmp[0].cons[1];
push arg[0];
push s1.cons[1];
push f;
calloc filter 2;
push tmp[0].cons[0];
push s1.cons[0];
alloc cons;
ret;
}
false: {
push unit;
push tmp[0].cons[1];
push arg[0];
push s1.cons[1];
push f;
tcall filter;
}
};
};
}

function nth(integer, unit -> stream) : integer {
push arg[1];
function nth(n : integer, s : unit -> stream) : integer {
push s;
call force;
tsave {
push arg[0];
tsave s1 {
push n;
push 0;
eq;
br {
true: { push tmp[0].cons[0]; ret; }
true: { push s1.cons[0]; ret; }
false: {
push tmp[0].cons[1];
push s1.cons[1];
push 1;
push arg[0];
push n;
sub;
tcall nth;
}
};
};
}

function numbers(integer, unit) : stream {
push arg[0];
function numbers(n : integer, unit) : stream {
push n;
push 1;
add;
calloc numbers 1;
push arg[0];
push n;
alloc cons;
ret;
}

function indivisible(integer, integer) : bool {
push arg[0];
push arg[1];
function indivisible(n : integer, m : integer) : bool {
push n;
push m;
mod;
push 0;
eq;
Expand All @@ -78,16 +78,16 @@ function indivisible(integer, integer) : bool {
};
}

function eratostenes(unit -> stream, unit) : stream {
push arg[0];
function eratostenes(s : unit -> stream, unit) : stream {
push s;
call force;
tsave {
push tmp[0].cons[1];
push tmp[0].cons[0];
tsave s1 {
push s1.cons[1];
push s1.cons[0];
calloc indivisible 1;
calloc filter 2;
calloc eratostenes 1;
push tmp[0].cons[0];
push s1.cons[0];
alloc cons;
ret;
};
Expand Down

0 comments on commit f129ccb

Please sign in to comment.