Commit d20a46a6 authored by Laszlo Domoszlai's avatar Laszlo Domoszlai
Browse files

unboxed vars works!

parent 70ebbfda
......@@ -11,6 +11,8 @@
// For compressing the source code a bit
#define instackb(addr) ((char*)addr >= (char*) &stack_b[0] && (char*)addr < (char*) &stack_b[STACK_SIZE_B])
#define follow_thunk(thunk) if (thunk->desc == (Desc*) __FORWARD_PTR__) thunk = thunk->_forward_ptr;
#define forward_thunk(thunk, frame_ptr) \
......@@ -21,15 +23,19 @@
}
#define placeholder() \
push_a(alloc_b()); \
peek_a()->desc = (Desc*) __STACK_PLACEHOLDER__; \
push_a(alloc_b());
#define arg_from_code(descarg, arg) \
if(((FunEntry*) (descarg))->strictness & argmask) \
if(((FunEntry*) (descarg))->boxing & argmask) \
{ \
placeholder(); \
exec(arg, frame_ptr, stack_top_a); \
} \
else if(((FunEntry*) (descarg))->strictness & argmask) \
{ \
push_a(NULL); \
exec(arg, frame_ptr, stack_top_a); \
} \
else \
{ \
push_a(arg->create_thunk(arg, frame_ptr)); \
......@@ -278,7 +284,7 @@ void exec(Code* expr, int frame_ptr, int root_frame_ptr)
case CT_APP_FUN2:
{
Desc* slice = ((AppEntry*) expr)->f;
int argmask = 1;
arg_from_code(slice, ((AppEntry*) expr)->args[0]);
......@@ -309,7 +315,12 @@ void exec(Code* expr, int frame_ptr, int root_frame_ptr)
Thunk* thunk = get_dst(root_frame_ptr);
int newsize = slice->thunk_size;
if (thunk != NULL && thunk->desc->thunk_size < newsize) {
if (thunk == NULL)
{
thunk = (Thunk*) alloc_heap(newsize);
set_return(root_frame_ptr, thunk);
}
else if (newsize < sizeof(Thunk) || thunk->desc->thunk_size < newsize) {
Thunk* target = thunk;
thunk = (Thunk*) alloc_heap(newsize);
target->desc = (Desc*) __FORWARD_PTR__;
......@@ -445,6 +456,8 @@ void exec(Code* expr, int frame_ptr, int root_frame_ptr)
{
Thunk* thunk = local(frame_ptr, ((VarEntry*) expr)->index);
assert(!instackb(thunk));
follow_thunk(thunk);
forward_thunk(thunk, root_frame_ptr);
set_return(root_frame_ptr, thunk);
......@@ -506,8 +519,22 @@ void exec(Code* expr, int frame_ptr, int root_frame_ptr)
case CT_THUNK:
{
Thunk* thunk = &((ThunkEntry*) expr)->thunk;
forward_thunk(thunk, root_frame_ptr);
set_return(root_frame_ptr, thunk);
Thunk* dst = get_dst(root_frame_ptr);
if(dst != NULL)
{
memcpy(dst, thunk, sizeof(Thunk));
if(!instackb(dst))
{
set_return(root_frame_ptr, thunk);
}
}
else
{
set_return(root_frame_ptr, thunk);
}
destroy_stack_frame(root_frame_ptr);
destroy_stack_frame_b(root_frame_ptr_b);
return;
......@@ -553,7 +580,7 @@ void exec(Code* expr, int frame_ptr, int root_frame_ptr)
{
SelectEntry* select = (SelectEntry*) expr;
placeholder();
push_a(NULL);
exec(select->expr, frame_ptr, stack_top_a);
Thunk* cons = pop_a();
......
......@@ -9,8 +9,8 @@
#define follow_thunk(thunk) if (thunk->desc == (Desc*) __FORWARD_PTR__) thunk = thunk->_forward_ptr;
// http://stackoverflow.com/questions/17095324/fastest-way-to-determine-if-an-integer-is-between-two-integers-inclusive-with/17095534#17095534
#define inheap(addr) ((unsigned)((int)addr-(int)heap_base_curr) < HEAP_SIZE)
//#define inheap(addr) ((char*)addr >= heap_base_curr && (char*)addr < (heap_base_curr + HEAP_SIZE))
//#define inheap(addr) ((unsigned)((int)addr-(int)heap_base_curr) < HEAP_SIZE)
#define inheap(addr) ((char*)addr >= heap_base_curr && (char*)addr < (heap_base_curr + HEAP_SIZE))
//#define instackb(addr) ((char*)addr >= (char*) &stack_b[0] && (char*)addr < (char*) &stack_b[STACK_SIZE_B])
int gc_enabled = 1;
......@@ -50,14 +50,16 @@ void gc()
// do not copy forward pointers
// also do it outside, because the final thunk may be out of the heap
//follow_thunk(ptr);
if(!inheap(ptr)) continue;
while (ptr->desc == (Desc*) __FORWARD_PTR__)
{
ptr = ptr->_forward_ptr;
stack_a[i] = ptr;
}
if(inheap(ptr)/*&& ptr->desc != NULL*/)
if(inheap(ptr))
{
if(ptr->desc == NULL)
{
......@@ -87,13 +89,15 @@ void gc()
// do not copy forward pointers
// also do it outside, because the final thunk may be out of the heap
// follow_thunk(arg);
if(!inheap(arg)) continue;
while (arg->desc == (Desc*) __FORWARD_PTR__)
{
arg = arg->_forward_ptr;
ptr->_args[i] = arg;
}
if(inheap(arg) /*&& ptr->desc != NULL*/)
{
if(arg->desc == NULL)
......
......@@ -29,7 +29,7 @@ int main ( int argc, char *argv[] )
init_desc();
init_prim();
char* input = "..\\tests\\matchtest.bsapl";
char* input = "..\\tests\\Adjoxo.bsapl";
if ( argc == 2 )
{
......
......@@ -379,7 +379,9 @@ Code* parseApp(char **ptr, bool dynamic) {
if(desc->type == FT_PRIM1)
{
if(entry->args[0]->type == CT_VAR_STRICT)
int arg0strict = entry->args[0]->type == CT_VAR_STRICT || entry->args[0]->type == CT_VAR_UNBOXED;
if(arg0strict)
{
entry->base.type = CT_APP_PRIM_S;
}
......@@ -390,15 +392,18 @@ Code* parseApp(char **ptr, bool dynamic) {
}
else if(desc->type == FT_PRIM2)
{
if(entry->args[0]->type == CT_VAR_STRICT && entry->args[1]->type == CT_THUNK)
int arg0strict = entry->args[0]->type == CT_VAR_STRICT || entry->args[0]->type == CT_VAR_UNBOXED;
int arg1strict = entry->args[1]->type == CT_VAR_STRICT || entry->args[1]->type == CT_VAR_UNBOXED;
if(arg0strict && entry->args[1]->type == CT_THUNK)
{
entry->base.type = CT_APP_PRIM_ST;
}
else if(entry->args[0]->type == CT_THUNK && entry->args[1]->type == CT_VAR_STRICT)
else if(entry->args[0]->type == CT_THUNK && arg1strict)
{
entry->base.type = CT_APP_PRIM_TS;
}
else if(entry->args[0]->type == CT_VAR_STRICT && entry->args[1]->type == CT_VAR_STRICT)
else if(arg0strict && arg1strict)
{
entry->base.type = CT_APP_PRIM_SS;
}
......@@ -410,11 +415,11 @@ Code* parseApp(char **ptr, bool dynamic) {
{
entry->base.type = CT_APP_PRIM_AT;
}
else if(entry->args[0]->type == CT_VAR_STRICT)
else if(arg0strict)
{
entry->base.type = CT_APP_PRIM_SA;
}
else if(entry->args[1]->type == CT_VAR_STRICT)
else if(arg1strict)
{
entry->base.type = CT_APP_PRIM_AS;
}
......
......@@ -7,37 +7,37 @@
#define arg(idx) stack_a[stack_top_a - idx]
void __add(int dst_idx) {
void __addI(int dst_idx) {
Thunk* target = get_dst(dst_idx);
target->desc = (Desc*) __INT__;
target->_int = readI(arg(2)) + readI(arg(1));
}
void __sub(int dst_idx) {
void __subI(int dst_idx) {
Thunk* target = get_dst(dst_idx);
target->desc = (Desc*) __INT__;
target->_int = readI(arg(2)) - readI(arg(1));
}
void __mult(int dst_idx) {
void __multI(int dst_idx) {
Thunk* target = get_dst(dst_idx);
target->desc = (Desc*) __INT__;
target->_int = readI(arg(2)) * readI(arg(1));
}
void __div(int dst_idx) {
void __divI(int dst_idx) {
Thunk* target = get_dst(dst_idx);
target->desc = (Desc*) __INT__;
target->_int = readI(arg(2)) / readI(arg(1));
}
void __gt(int dst_idx) {
void __gtI(int dst_idx) {
Thunk* target = get_dst(dst_idx);
target->desc = (Desc*) __BOOL__;
target->_bool = readI(arg(2)) > readI(arg(1));
}
void __lt(int dst_idx) {
void __ltI(int dst_idx) {
Thunk* target = get_dst(dst_idx);
target->desc = (Desc*) __BOOL__;
target->_bool = readI(arg(2)) < readI(arg(1));
......@@ -127,13 +127,13 @@ void add_prim(int arity, char* name, void (*exec)(int)) {
}
void init_prim() {
add_prim(2, "add", &__add);
add_prim(2, "sub", &__sub);
add_prim(2, "mult", &__mult);
add_prim(2, "div", &__div);
add_prim(2, "gt", &__gt);
add_prim(2, "addI", &__addI);
add_prim(2, "subI", &__subI);
add_prim(2, "multI", &__multI);
add_prim(2, "divI", &__divI);
add_prim(2, "gtI", &__gtI);
add_prim(2, "geC", &__geC);
add_prim(2, "lt", &__lt);
add_prim(2, "ltI", &__ltI);
add_prim(2, "eqI", &__eqI);
add_prim(2, "neqI", &__neqI);
add_prim(2, "eqB", &__eqB);
......
......@@ -36,7 +36,7 @@ int readB(Thunk* thunk) {
bool is_hnf(Thunk* thunk)
{
return thunk->desc->hnf;
return thunk != NULL && thunk->desc->hnf;
}
void print(bool force) {
......
......@@ -119,7 +119,7 @@ where
sVarApp ctx var a
= case get varName ctx.vars of
(Just (Local i Strict)) = a <++ "VS" <++ sNum i
(Just (Local i UnBoxable)) = a <++ "VS" <++ sNum i
(Just (Local i UnBoxable)) = a <++ "VU" <++ sNum i
(Just (Local i Normal)) = a <++ "VL" <++ sNum i
_ = a <++ "A" <++ sList (sTerm ctx) [] <++ sVar ctx var
where
......
main = Adjoxo.Start
Adjoxo.Start = Adjoxo.adjudicate Flite.Nil Flite.Nil
Adjoxo.Start::C = Adjoxo.adjudicate Flite.Nil Flite.Nil
:: Flite.List = Flite.Nil | Flite.Cons a1 a2
Adjoxo.adjudicate !os_0 !xs_1 = <{Adjoxo._c;88;3_39}> (Adjoxo.cmp_33 (Adjoxo.len os_0) (Adjoxo.len xs_1)) xs_1 os_0
Adjoxo.len !_x_0 = select _x_0 (Flite.Nil -> 0) (Flite.Cons x_1_0 xs_1_1 -> add 1 (Adjoxo.len xs_1_1))
Adjoxo.cmp_33 !a_0 !b_1 = if (eqI a_0 b_1) Flite.EQ (if (<{Adjoxo.<=_30}> a_0 b_1) Flite.LT Flite.GT)
Adjoxo.adjudicate::C !os_0 !xs_1 = <{Adjoxo._c;88;3_39}> (Adjoxo.cmp_32 (Adjoxo.len os_0) (Adjoxo.len xs_1)) xs_1 os_0
Adjoxo.len::I !_x_0 = select _x_0 (Flite.Nil -> 0) (Flite.Cons x_1_0 xs_1_1 -> addI 1 (Adjoxo.len xs_1_1))
Adjoxo.cmp_32 !a_0::I !b_1::I = if (eqI a_0 b_1) Flite.EQ (if (<{Adjoxo.<=_33}> a_0 b_1) Flite.LT Flite.GT)
:: Flite.Ordering = Flite.LT | Flite.EQ | Flite.GT
<{Adjoxo.<=_30}> !x_0 !y_1 = not (lt y_1 x_0)
<{Adjoxo._c;88;3_39}> !_x_0 xs_1 os_2 = select _x_0 (Flite.GT -> Adjoxo.report (Adjoxo.analysis xs_1 os_2) Adjoxo.X) (Flite.EQ -> if (Adjoxo.hasLine xs_1) (Adjoxo.report Adjoxo.Win Adjoxo.X) (if (Adjoxo.hasLine os_2) (Adjoxo.report Adjoxo.Win Adjoxo.O) (Adjoxo.report (Adjoxo.analysis xs_1 os_2) Adjoxo.X))) (Flite.LT -> Adjoxo.report (Adjoxo.analysis os_2 xs_1) Adjoxo.O)
<{Adjoxo.<=_33}>::B !x_0::I !y_1::I = not (ltI y_1 x_0)
<{Adjoxo._c;88;3_39}>::C !_x_0 xs_1 os_2 = select _x_0 (Flite.GT -> Adjoxo.report (Adjoxo.analysis xs_1 os_2) Adjoxo.X) (Flite.EQ -> if (Adjoxo.hasLine xs_1) (Adjoxo.report Adjoxo.Win Adjoxo.X) (if (Adjoxo.hasLine os_2) (Adjoxo.report Adjoxo.Win Adjoxo.O) (Adjoxo.report (Adjoxo.analysis xs_1 os_2) Adjoxo.X))) (Flite.LT -> Adjoxo.report (Adjoxo.analysis os_2 xs_1) Adjoxo.O)
:: Adjoxo.Side = Adjoxo.X | Adjoxo.O
Adjoxo.analysis ap_0 !pp_1 = if (Adjoxo.hasLine pp_1) Adjoxo.Loss (if (Adjoxo.gridFull ap_0 pp_1) Adjoxo.Draw (Adjoxo.foldr1 Adjoxo.bestOf (Adjoxo.map (Adjoxo.moveval ap_0 pp_1) (Adjoxo.diff_32 (Adjoxo.diff_32 (Adjoxo.fromTo 1 9) ap_0) pp_1))))
Adjoxo.fromTo !n_0 !m_1 = if (<{Adjoxo.<=_26}> n_0 m_1) (Flite.Cons n_0 (Adjoxo.fromTo (add n_0 1) m_1)) Flite.Nil
<{Adjoxo.<=_26}> !x_0 !y_1 = not (lt y_1 x_0)
Adjoxo.diff_32 !_x_0 ys_1 = select _x_0 (Flite.Nil -> Flite.Nil) (Flite.Cons x_1_0 xs_1_1 -> select ys_1 (Flite.Nil -> Flite.Cons x_1_0 xs_1_1) (Flite.Cons y_2_0 ys_2_1 -> <{Adjoxo._c;45;3_38}> (Adjoxo.cmp_33 x_1_0 y_2_0) x_1_0 xs_1_1 y_2_0 ys_2_1) )
<{Adjoxo._c;45;3_38}> !_x_0 x_1 xs_2 y_3 ys_4 = select _x_0 (Flite.LT -> Flite.Cons x_1 (Adjoxo.diff_32 xs_2 (Flite.Cons y_3 ys_4))) (Flite.EQ -> Adjoxo.diff_32 xs_2 ys_4) (Flite.GT -> Adjoxo.diff_32 (Flite.Cons x_1 xs_2) ys_4)
Adjoxo.moveval !ap_0 pp_1 !m_2 = Adjoxo.inverse (Adjoxo.analysis pp_1 (Adjoxo.insert_34 m_2 ap_0))
Adjoxo.insert_34 x_0 !_x_1 = select _x_1 (Flite.Nil -> Flite.Cons x_0 Flite.Nil) (Flite.Cons y_1_0 ys_1_1 -> if (<{Adjoxo.<=_35}> x_0 y_1_0) (Flite.Cons x_0 (Flite.Cons y_1_0 ys_1_1)) (Flite.Cons y_1_0 (Adjoxo.insert_34 x_0 ys_1_1)))
<{Adjoxo.<=_35}> !x_0 !y_1 = not (lt y_1 x_0)
Adjoxo.analysis ap_0 !pp_1 = if (Adjoxo.hasLine pp_1) Adjoxo.Loss (if (Adjoxo.gridFull ap_0 pp_1) Adjoxo.Draw (Adjoxo.foldr1 Adjoxo.bestOf (Adjoxo.map (Adjoxo.moveval ap_0 pp_1) (Adjoxo.diff_31 (Adjoxo.diff_31 (Adjoxo.fromTo 1 9) ap_0) pp_1))))
Adjoxo.fromTo !n_0::I !m_1::I = if (<{Adjoxo.<=_26}> n_0 m_1) (Flite.Cons n_0 (Adjoxo.fromTo (addI n_0 1) m_1)) Flite.Nil
<{Adjoxo.<=_26}>::B !x_0::I !y_1::I = not (ltI y_1 x_0)
Adjoxo.diff_31 !_x_0 ys_1 = select _x_0 (Flite.Nil -> Flite.Nil) (Flite.Cons x_1_0 xs_1_1 -> select ys_1 (Flite.Nil -> Flite.Cons x_1_0 xs_1_1) (Flite.Cons y_2_0 ys_2_1 -> <{Adjoxo._c;45;3_38}> (Adjoxo.cmp_32 x_1_0 y_2_0) x_1_0 xs_1_1 y_2_0 ys_2_1) )
<{Adjoxo._c;45;3_38}> !_x_0 x_1::I xs_2 y_3::I ys_4 = select _x_0 (Flite.LT -> Flite.Cons x_1 (Adjoxo.diff_31 xs_2 (Flite.Cons y_3 ys_4))) (Flite.EQ -> Adjoxo.diff_31 xs_2 ys_4) (Flite.GT -> Adjoxo.diff_31 (Flite.Cons x_1 xs_2) ys_4)
Adjoxo.moveval !ap_0 pp_1 !m_2::I = Adjoxo.inverse (Adjoxo.analysis pp_1 (Adjoxo.insert_34 m_2 ap_0))
Adjoxo.insert_34 x_0::I !_x_1 = select _x_1 (Flite.Nil -> Flite.Cons x_0 Flite.Nil) (Flite.Cons y_1_0 ys_1_1 -> if (<{Adjoxo.<=_35}> x_0 y_1_0) (Flite.Cons x_0 (Flite.Cons y_1_0 ys_1_1)) (Flite.Cons y_1_0 (Adjoxo.insert_34 x_0 ys_1_1)))
<{Adjoxo.<=_35}>::B !x_0::I !y_1::I = not (ltI y_1 x_0)
Adjoxo.inverse !_x_0 = select _x_0 (Adjoxo.Loss -> Adjoxo.Win) (Adjoxo.Draw -> Adjoxo.Draw) (Adjoxo.Win -> Adjoxo.Loss)
:: Adjoxo.Result = Adjoxo.Win | Adjoxo.Draw | Adjoxo.Loss
Adjoxo.map f_0 !_x_1 = select _x_1 (Flite.Nil -> Flite.Nil) (Flite.Cons x_1_0 xs_1_1 -> Flite.Cons (f_0 x_1_0) (Adjoxo.map f_0 xs_1_1))
Adjoxo.bestOf !_x_0 v_1 = select _x_0 (Adjoxo.Win -> Adjoxo.Win) (Adjoxo.Loss -> v_1) (Adjoxo.Draw -> select v_1 (Adjoxo.Win -> Adjoxo.Win) (Adjoxo.Draw -> Adjoxo.Draw) (Adjoxo.Loss -> Adjoxo.Draw) )
Adjoxo.foldr1 f_0 !_x_1 = select _x_1 (Flite.Cons x_1_0 _x_1_1 -> select _x_1_1 (Flite.Nil -> x_1_0) (Flite.Cons y_2_0 ys_2_1 -> f_0 x_1_0 (Adjoxo.foldr1 f_0 (Flite.Cons y_2_0 ys_2_1))) )
Adjoxo.gridFull !ap_0 !pp_1 = eqI (add (Adjoxo.len ap_0) (Adjoxo.len pp_1)) 9
Adjoxo.hasLine !p_0 = Adjoxo.or (Adjoxo.subset_31 (Flite.Cons 1 (Flite.Cons 2 (Flite.Cons 3 Flite.Nil))) p_0) (Adjoxo.or (Adjoxo.subset_31 (Flite.Cons 4 (Flite.Cons 5 (Flite.Cons 6 Flite.Nil))) p_0) (Adjoxo.or (Adjoxo.subset_31 (Flite.Cons 7 (Flite.Cons 8 (Flite.Cons 9 Flite.Nil))) p_0) (Adjoxo.or (Adjoxo.subset_31 (Flite.Cons 1 (Flite.Cons 4 (Flite.Cons 7 Flite.Nil))) p_0) (Adjoxo.or (Adjoxo.subset_31 (Flite.Cons 2 (Flite.Cons 5 (Flite.Cons 8 Flite.Nil))) p_0) (Adjoxo.or (Adjoxo.subset_31 (Flite.Cons 3 (Flite.Cons 6 (Flite.Cons 9 Flite.Nil))) p_0) (Adjoxo.or (Adjoxo.subset_31 (Flite.Cons 1 (Flite.Cons 5 (Flite.Cons 9 Flite.Nil))) p_0) (Adjoxo.subset_31 (Flite.Cons 3 (Flite.Cons 5 (Flite.Cons 7 Flite.Nil))) p_0)))))))
Adjoxo.subset_31 !xs_0 ys_1 = Adjoxo.null (Adjoxo.diff_32 xs_0 ys_1)
Adjoxo.null !_x_0 = select _x_0 (Flite.Nil -> True) (Flite.Cons x_1_0 xs_1_1 -> False)
Adjoxo.or !_x_0 x_1 = if _x_0 True x_1
Adjoxo.report !_x_0 s_1 = select _x_0 (Adjoxo.Loss -> Adjoxo.side (Adjoxo.opp s_1)) (Adjoxo.Win -> Adjoxo.side s_1) (Adjoxo.Draw -> 'D')
Adjoxo.side !_x_0 = select _x_0 (Adjoxo.O -> 'O') (Adjoxo.X -> 'X')
Adjoxo.gridFull::B !ap_0 !pp_1 = eqI (addI (Adjoxo.len ap_0) (Adjoxo.len pp_1)) 9
Adjoxo.hasLine::B !p_0 = Adjoxo.or (Adjoxo.subset_30 (Flite.Cons 1 (Flite.Cons 2 (Flite.Cons 3 Flite.Nil))) p_0) (Adjoxo.or (Adjoxo.subset_30 (Flite.Cons 4 (Flite.Cons 5 (Flite.Cons 6 Flite.Nil))) p_0) (Adjoxo.or (Adjoxo.subset_30 (Flite.Cons 7 (Flite.Cons 8 (Flite.Cons 9 Flite.Nil))) p_0) (Adjoxo.or (Adjoxo.subset_30 (Flite.Cons 1 (Flite.Cons 4 (Flite.Cons 7 Flite.Nil))) p_0) (Adjoxo.or (Adjoxo.subset_30 (Flite.Cons 2 (Flite.Cons 5 (Flite.Cons 8 Flite.Nil))) p_0) (Adjoxo.or (Adjoxo.subset_30 (Flite.Cons 3 (Flite.Cons 6 (Flite.Cons 9 Flite.Nil))) p_0) (Adjoxo.or (Adjoxo.subset_30 (Flite.Cons 1 (Flite.Cons 5 (Flite.Cons 9 Flite.Nil))) p_0) (Adjoxo.subset_30 (Flite.Cons 3 (Flite.Cons 5 (Flite.Cons 7 Flite.Nil))) p_0)))))))
Adjoxo.subset_30::B !xs_0 ys_1 = Adjoxo.null (Adjoxo.diff_31 xs_0 ys_1)
Adjoxo.null::B !_x_0 = select _x_0 (Flite.Nil -> True) (Flite.Cons x_1_0 xs_1_1 -> False)
Adjoxo.or::B !_x_0::B x_1::B = if _x_0 True x_1
Adjoxo.report::C !_x_0 s_1 = select _x_0 (Adjoxo.Loss -> Adjoxo.side (Adjoxo.opp s_1)) (Adjoxo.Win -> Adjoxo.side s_1) (Adjoxo.Draw -> 'D')
Adjoxo.side::C !_x_0 = select _x_0 (Adjoxo.O -> 'O') (Adjoxo.X -> 'X')
Adjoxo.opp !_x_0 = select _x_0 (Adjoxo.O -> Adjoxo.X) (Adjoxo.X -> Adjoxo.O)
nomatch not found
[1]
\ No newline at end of file
main = Braun.Start
Braun.Start = Braun.int (Braun.all Braun.prop_17 (Braun.replicate 6000 (Braun.fromTo 0 255)))
Braun.fromTo !n_0 !m_1 = if (<{Braun.<=_16}> n_0 m_1) (Flite.Cons n_0 (Braun.fromTo (add n_0 1) m_1)) Flite.Nil
Braun.Start::I = Braun.int (Braun.all Braun.prop_17 (Braun.replicate 6000 (Braun.fromTo 0 255)))
Braun.fromTo !n_0::I !m_1::I = if (<{Braun.<=_16}> n_0 m_1) (Flite.Cons n_0 (Braun.fromTo (addI n_0 1) m_1)) Flite.Nil
:: Flite.List = Flite.Nil | Flite.Cons a1 a2
<{Braun.<=_16}> !x_0 !y_1 = not (lt y_1 x_0)
Braun.replicate !n_0 x_1 = if (eqI n_0 0) Flite.Nil (Flite.Cons x_1 (Braun.replicate (sub n_0 1) x_1))
Braun.prop_17 !xs_0 = Braun.equal_18 xs_0 (Braun.toList (Braun.fromList xs_0))
<{Braun.<=_16}>::B !x_0::I !y_1::I = not (ltI y_1 x_0)
Braun.replicate !n_0::I x_1 = if (eqI n_0 0) Flite.Nil (Flite.Cons x_1 (Braun.replicate (subI n_0 1) x_1))
Braun.prop_17::B !xs_0 = Braun.equal_18 xs_0 (Braun.toList (Braun.fromList xs_0))
Braun.fromList !_x_0 = select _x_0 (Flite.Nil -> Braun.Empty) (Flite.Cons x_1_0 xs_1_1 -> Braun.insert x_1_0 (Braun.fromList xs_1_1))
Braun.insert x_0 !_x_1 = select _x_1 (Braun.Empty -> Braun.Branch x_0 Braun.Empty Braun.Empty) (Braun.Branch y_1_0 t0_1_1 t1_1_2 -> Braun.Branch x_0 (Braun.insert y_1_0 t1_1_2) t0_1_1)
:: Braun.Tree = Braun.Empty | Braun.Branch a1 a2 a3
Braun.toList !_x_0 = select _x_0 (Braun.Empty -> Flite.Nil) (Braun.Branch x_1_0 t0_1_1 t1_1_2 -> Flite.Cons x_1_0 (Braun.ilv (Braun.toList t0_1_1) (Braun.toList t1_1_2)))
Braun.ilv !_x_0 !ys_1 = select _x_0 (Flite.Nil -> ys_1) (Flite.Cons x_1_0 xs_1_1 -> select ys_1 (Flite.Nil -> Flite.Cons x_1_0 xs_1_1) (Flite.Cons y_2_0 ys_2_1 -> Flite.Cons x_1_0 (Flite.Cons y_2_0 (Braun.ilv xs_1_1 ys_2_1))) )
Braun.equal_18 !_x_0 !_x_1 = select _x_0 (Flite.Nil -> select _x_1 (Flite.Nil -> True) (Flite.Cons y_2_0 ys_2_1 -> False) ) (Flite.Cons x_1_0 xs_1_1 -> select _x_1 (Flite.Nil -> False) (Flite.Cons y_2_0 ys_2_1 -> <{Braun._c;39;3_20}> (eqI x_1_0 y_2_0) xs_1_1 ys_2_1) )
<{Braun._c;39;3_20}> !_x_0 xs_1 ys_2 = if (eqB _x_0 False) False (if (eqB _x_0 True) (Braun.equal_18 xs_1 ys_2) nomatch)
Braun.all p_0 !_x_1 = select _x_1 (Flite.Nil -> True) (Flite.Cons x_1_0 xs_1_1 -> Braun.and (p_0 x_1_0) (Braun.all p_0 xs_1_1))
Braun.and !_x_0 y_1 = if _x_0 y_1 False
Braun.int !_x_0 = if _x_0 1 0
Braun.equal_18::B !_x_0 !_x_1 = select _x_0 (Flite.Nil -> select _x_1 (Flite.Nil -> True) (Flite.Cons y_2_0 ys_2_1 -> False) ) (Flite.Cons x_1_0 xs_1_1 -> select _x_1 (Flite.Nil -> False) (Flite.Cons y_2_0 ys_2_1 -> <{Braun._c;39;3_20}> (eqI x_1_0 y_2_0) xs_1_1 ys_2_1) )
<{Braun._c;39;3_20}>::B !_x_0::B xs_1 ys_2 = select _x_0 (False -> False) (True -> Braun.equal_18 xs_1 ys_2)
Braun.all::B p_0 !_x_1 = select _x_1 (Flite.Nil -> True) (Flite.Cons x_1_0 xs_1_1 -> Braun.and (p_0 x_1_0) (Braun.all p_0 xs_1_1))
Braun.and::B !_x_0::B y_1::B = if _x_0 y_1 False
Braun.int::I !_x_0::B = if _x_0 1 0
......@@ -262,5 +262,5 @@ line15 = ['voorouder(X1,X2) :- ouder(X1,X3),voorouder(X3,X2).']
line16 = ['ouder(siem,nel).']
line17 = ['ouder(cornelia,nel).']
Start = parsetest 20
//Start = msol 500
\ No newline at end of file
//Start = parsetest 10
Start = msol 500
\ No newline at end of file
:: _Tuple2 = T2 a b
tupsels2v0 t = select t (T2 a b -> a)
tupsels2v1 t = select t (T2 a b -> b)
main = Eval.Start
Eval.Start = Eval.domain 100
Eval.domain m_0 = Eval.getNum (Eval.smain m_0)
Eval.smain a_0 = Eval.eval (Eval.App (Eval.App (Eval.Func 14) (Eval.Num a_0)) (Eval.Func 18)) Eval.Empty Eval.funcs
Eval.Start::I = Eval.domain 100
Eval.domain::I m_0::I = Eval.getNum (Eval.smain m_0)
Eval.smain a_0::I = Eval.eval (Eval.App (Eval.App (Eval.Func 14) (Eval.Num a_0)) (Eval.Func 18)) Eval.Empty Eval.funcs
Eval.funcs = Eval.Cons Eval.fneq (Eval.Cons Eval.ftypeof (Eval.Cons Eval.fnrargs (Eval.Cons Eval.fnrapps (Eval.Cons Eval.fstacksize (Eval.Cons Eval.fError (Eval.Cons Eval.fsuc (Eval.Cons Eval.ffac (Eval.Cons Eval.fEmpty (Eval.Cons Eval.fCons (Eval.Cons Eval.ffrom (Eval.Cons Eval.ftake (Eval.Cons Eval.fdrp (Eval.Cons Eval.ffilter (Eval.Cons Eval.fel (Eval.Cons Eval.fcount (Eval.Cons Eval.fmember (Eval.Cons Eval.fnotmodzero (Eval.Cons Eval.fprimes (Eval.Cons Eval.fsieve (Eval.Cons Eval.ftake0 (Eval.Cons Eval.fdrp0 (Eval.Cons Eval.ffilter0 (Eval.Cons Eval.fel0 (Eval.Cons Eval.fcount0 (Eval.Cons Eval.fmember0 (Eval.Cons Eval.fsieve0 Eval.Empty))))))))))))))))))))))))))
:: Eval.MList = Eval.Cons a1 a2 | Eval.Empty
Eval.fsieve0 = Eval.tup 2 (Eval.App (Eval.App (Eval.Func 9) (Eval.Var 0)) (Eval.App (Eval.Func 19) (Eval.App (Eval.App (Eval.Func 13) (Eval.App (Eval.Func 17) (Eval.Var 0))) (Eval.Var 1))))
:: Eval.Expr = Eval.App a1 a2 | Eval.Func a1 | Eval.Var a1 | Eval.Num a1 | Eval.Oper a1 | Eval.Relop a1 | Eval.Boolean a1 | Eval.Error
Eval.tup a_0 b_1 = T2 a_0 b_1
:: Eval.Expr = Eval.App a1 a2 | Eval.Func a1::I | Eval.Var a1::I | Eval.Num a1::I | Eval.Oper a1 | Eval.Relop a1 | Eval.Boolean a1::B | Eval.Error
Eval.tup a_0 b_1 = _Tuple2 a_0 b_1
Eval.fmember0 = Eval.tup 3 (Eval.App (Eval.App (Eval.App (Eval.App (Eval.Relop Eval.eq_54) (Eval.Var 1)) (Eval.Var 0)) (Eval.Boolean True)) (Eval.App (Eval.App (Eval.Func 16) (Eval.Var 2)) (Eval.Var 0)))
Eval.eq_54 !a_0 !b_1 = eqI a_0 b_1
Eval.eq_54::B !a_0::I !b_1::I = eqI a_0 b_1
Eval.fcount0 = Eval.tup 2 (Eval.App (Eval.Func 6) (Eval.App (Eval.Func 15) (Eval.Var 1)))
Eval.fel0 = Eval.tup 3 (Eval.App (Eval.App (Eval.App (Eval.App (Eval.Relop Eval.eq_54) (Eval.Var 0)) (Eval.Num 0)) (Eval.Var 1)) (Eval.App (Eval.App (Eval.Func 14) (Eval.App (Eval.App (Eval.Oper Eval.sub_56) (Eval.Var 0)) (Eval.Num 1))) (Eval.Var 2)))
Eval.sub_56 !a_0 !b_1 = sub a_0 b_1
Eval.sub_56::I !a_0::I !b_1::I = subI a_0 b_1
Eval.ffilter0 = Eval.tup 3 (Eval.App (Eval.App (Eval.App (Eval.Var 0) (Eval.Var 1)) (Eval.App (Eval.App (Eval.Func 9) (Eval.Var 1)) (Eval.App (Eval.App (Eval.Func 13) (Eval.Var 0)) (Eval.Var 2)))) (Eval.App (Eval.App (Eval.Func 13) (Eval.Var 0)) (Eval.Var 2)))
Eval.fdrp0 = Eval.tup 3 (Eval.App (Eval.App (Eval.App (Eval.App (Eval.Relop Eval.eq_54) (Eval.Var 0)) (Eval.Num 0)) (Eval.App (Eval.App (Eval.Func 9) (Eval.Var 1)) (Eval.Var 2))) (Eval.App (Eval.App (Eval.Func 12) (Eval.App (Eval.App (Eval.Oper Eval.sub_56) (Eval.Var 0)) (Eval.Num 1))) (Eval.Var 2)))
Eval.ftake0 = Eval.tup 3 (Eval.App (Eval.App (Eval.App (Eval.App (Eval.Relop Eval.eq_54) (Eval.Var 0)) (Eval.Num 0)) (Eval.Func 8)) (Eval.App (Eval.App (Eval.Func 9) (Eval.Var 1)) (Eval.App (Eval.App (Eval.Func 11) (Eval.App (Eval.App (Eval.Oper Eval.sub_56) (Eval.Var 0)) (Eval.Num 1))) (Eval.Var 2))))
Eval.fsieve = Eval.tup 1 (Eval.App (Eval.App (Eval.Var 0) (Eval.Func 5)) (Eval.Func 26))
Eval.fprimes = Eval.tup 0 (Eval.App (Eval.Func 19) (Eval.App (Eval.Func 10) (Eval.Num 2)))
Eval.fnotmodzero = Eval.tup 2 (Eval.App (Eval.App (Eval.App (Eval.App (Eval.Relop Eval.eq_54) (Eval.App (Eval.App (Eval.Oper Eval.md_57) (Eval.Var 1)) (Eval.Var 0))) (Eval.Num 0)) (Eval.Boolean False)) (Eval.Boolean True))
Eval.md_57 !a_0 !b_1 = mod a_0 b_1
Eval.md_57::I !a_0::I !b_1::I = mod a_0 b_1
Eval.fmember = Eval.tup 2 (Eval.App (Eval.App (Eval.Var 0) (Eval.Boolean False)) (Eval.App (Eval.Func 25) (Eval.Var 1)))
Eval.fcount = Eval.tup 1 (Eval.App (Eval.App (Eval.Var 0) (Eval.Num 0)) (Eval.Func 24))
Eval.fel = Eval.tup 2 (Eval.App (Eval.App (Eval.Var 1) (Eval.Func 5)) (Eval.App (Eval.Func 23) (Eval.Var 0)))
......@@ -35,22 +34,22 @@ Eval.ffrom = Eval.tup 1 (Eval.App (Eval.App (Eval.Func 9) (Eval.Var 0)) (Eval.Ap
Eval.fCons = Eval.tup 4 (Eval.App (Eval.App (Eval.Var 3) (Eval.Var 0)) (Eval.Var 1))
Eval.fEmpty = Eval.tup 2 (Eval.Var 0)
Eval.ffac = Eval.tup 1 (Eval.App (Eval.App (Eval.App (Eval.App (Eval.Relop Eval.eq_54) (Eval.Var 0)) (Eval.Num 0)) (Eval.Num 1)) (Eval.App (Eval.App (Eval.Oper Eval.mult_55) (Eval.Var 0)) (Eval.App (Eval.Func 7) (Eval.App (Eval.App (Eval.Oper Eval.sub_56) (Eval.Var 0)) (Eval.Num 1)))))
Eval.mult_55 = mult
Eval.mult_55 = multI
Eval.fsuc = Eval.tup 1 (Eval.App (Eval.App (Eval.Oper Eval.add_53) (Eval.Var 0)) (Eval.Num 1))
Eval.add_53 = add
Eval.add_53 = addI
Eval.fError = Eval.tup 1 (Eval.Var 0)
Eval.fstacksize = Eval.tup 1 Eval.Error
Eval.fnrapps = Eval.tup 1 Eval.Error
Eval.fnrargs = Eval.tup 1 Eval.Error
Eval.ftypeof = Eval.tup 1 Eval.Error
Eval.fneq = Eval.tup 2 Eval.Error
Eval.eval !_x_0 es_1 fs_2 = select _x_0 (Eval.App l_1_0 r_1_1 -> Eval.eval l_1_0 (Eval.Cons (Eval.eval r_1_1 Eval.Empty fs_2) es_1) fs_2) (Eval.Func f_1_0 -> if (not (lt (Eval.len es_1) (tupsels2v0 (Eval.el f_1_0 fs_2)))) (Eval.eval (Eval.subst (tupsels2v1 (Eval.el f_1_0 fs_2)) es_1) (Eval.drp (tupsels2v0 (Eval.el f_1_0 fs_2)) es_1) fs_2) (Eval.rebuild (Eval.Func f_1_0) es_1)) (Eval.Oper op_1_0 -> Eval.apply op_1_0 (Eval.el 0 es_1) (Eval.el 1 es_1)) (Eval.Relop op_1_0 -> Eval.eval (Eval.apprel op_1_0 (Eval.el 0 es_1) (Eval.el 1 es_1)) (Eval.drp 2 es_1) fs_2) (Eval.Num n_1_0 -> Eval.Num n_1_0) (Eval.Boolean b_1_0 -> if (not (lt (Eval.len es_1) 2)) (Eval.eval (Eval.ifte b_1_0 (Eval.el 0 es_1) (Eval.el 1 es_1)) (Eval.drp 2 es_1) fs_2) (Eval.Boolean b_1_0))
Eval.drp n_0 !_x_1 = select _x_1 (Eval.Empty -> Eval.Empty) (Eval.Cons a_1_0 as_1_1 -> if (eqI n_0 0) (Eval.Cons a_1_0 as_1_1) (Eval.drp (sub n_0 1) as_1_1))
Eval.el !_x_0 !_x_1 = select _x_0 (0 -> select _x_1 (Eval.Cons x_2_0 xs_2_1 -> x_2_0) ) (_ -> select _x_1 (Eval.Cons x_1_0 xs_1_1 -> Eval.el (sub _x_0 1) xs_1_1) )
Eval.ifte !b_0 e_1 t_2 = if b_0 e_1 t_2
Eval.len !_x_0 = select _x_0 (Eval.Empty -> 0) (Eval.Cons x_1_0 xs_1_1 -> add 1 (Eval.len xs_1_1))
Eval.eval !_x_0 es_1 fs_2 = select _x_0 (Eval.App l_1_0 r_1_1 -> Eval.eval l_1_0 (Eval.Cons (Eval.eval r_1_1 Eval.Empty fs_2) es_1) fs_2) (Eval.Func f_1_0 -> if (not (ltI (Eval.len es_1) (tupsels2v0 (Eval.el f_1_0 fs_2)))) (Eval.eval (Eval.subst (tupsels2v1 (Eval.el f_1_0 fs_2)) es_1) (Eval.drp (tupsels2v0 (Eval.el f_1_0 fs_2)) es_1) fs_2) (Eval.rebuild (Eval.Func f_1_0) es_1)) (Eval.Oper op_1_0 -> Eval.apply op_1_0 (Eval.el 0 es_1) (Eval.el 1 es_1)) (Eval.Relop op_1_0 -> Eval.eval (Eval.apprel op_1_0 (Eval.el 0 es_1) (Eval.el 1 es_1)) (Eval.drp 2 es_1) fs_2) (Eval.Num n_1_0 -> Eval.Num n_1_0) (Eval.Boolean b_1_0 -> if (not (ltI (Eval.len es_1) 2)) (Eval.eval (Eval.ifte b_1_0 (Eval.el 0 es_1) (Eval.el 1 es_1)) (Eval.drp 2 es_1) fs_2) (Eval.Boolean b_1_0))
Eval.drp n_0::I !_x_1 = select _x_1 (Eval.Empty -> Eval.Empty) (Eval.Cons a_1_0 as_1_1 -> if (eqI n_0 0) (Eval.Cons a_1_0 as_1_1) (Eval.drp (subI n_0 1) as_1_1))
Eval.el !_x_0::I !_x_1 = select _x_0 (0 -> select _x_1 (Eval.Cons x_2_0 xs_2_1 -> x_2_0) ) (_ -> select _x_1 (Eval.Cons x_1_0 xs_1_1 -> Eval.el (subI _x_0 1) xs_1_1) )
Eval.ifte !b_0::B e_1 t_2 = if b_0 e_1 t_2
Eval.len::I !_x_0 = select _x_0 (Eval.Empty -> 0) (Eval.Cons x_1_0 xs_1_1 -> addI 1 (Eval.len xs_1_1))
Eval.apprel op_0 !_x_1 !_x_2 = select _x_1 (Eval.Num n_1_0 -> select _x_2 (Eval.Num m_2_0 -> Eval.Boolean (op_0 n_1_0 m_2_0)) )
Eval.apply op_0 !_x_1 !_x_2 = select _x_1 (Eval.Num n_1_0 -> select _x_2 (Eval.Num m_2_0 -> Eval.Num (op_0 n_1_0 m_2_0)) )
Eval.rebuild e_0 !_x_1 = select _x_1 (Eval.Empty -> e_0) (Eval.Cons x_1_0 xs_1_1 -> Eval.rebuild (Eval.App e_0 x_1_0) xs_1_1)
Eval.subst !_x_0 es_1 = select _x_0 (Eval.App l_1_0 r_1_1 -> Eval.App (Eval.subst l_1_0 es_1) (Eval.subst r_1_1 es_1)) (Eval.Var n_1_0 -> Eval.el n_1_0 es_1) (_ -> _x_0)
Eval.getNum !_x_0 = select _x_0 (Eval.Num n_1_0 -> n_1_0)
Eval.getNum::I !_x_0 = select _x_0 (Eval.Num n_1_0 -> n_1_0)
main = MSS.Start
MSS.Start = add (sub (MSS.mss (MSS.fromTo (sub 0 160) 160)) (MSS.mss (MSS.fromTo (sub 0 150) 150))) (sub (MSS.mss (MSS.fromTo (sub 0 161) 161)) (MSS.mss (MSS.fromTo (sub 0 151) 151)))
MSS.fromTo !n_0 !m_1 = if (<{MSS.<=_20}> n_0 m_1) (Flite.Cons n_0 (MSS.fromTo (add n_0 1) m_1)) Flite.Nil
MSS.Start::I = addI (subI (MSS.mss (MSS.fromTo (subI 0 160) 160)) (MSS.mss (MSS.fromTo (subI 0 150) 150))) (subI (MSS.mss (MSS.fromTo (subI 0 161) 161)) (MSS.mss (MSS.fromTo (subI 0 151) 151)))
MSS.fromTo !n_0::I !m_1::I = if (<{MSS.<=_20}> n_0 m_1) (Flite.Cons n_0 (MSS.fromTo (addI n_0 1) m_1)) Flite.Nil
:: Flite.List = Flite.Nil | Flite.Cons a1 a2
<{MSS.<=_20}> !x_0 !y_1 = not (lt y_1 x_0)
MSS.mss !xs_0 = MSS.maximum_17 (MSS.map MSS.sum (MSS.segments xs_0))
<{MSS.<=_20}>::B !x_0::I !y_1::I = not (ltI y_1 x_0)
MSS.mss::I !xs_0 = MSS.maximum_17 (MSS.map MSS.sum (MSS.segments xs_0))
MSS.segments !xs_0 = MSS.concatMap MSS.tails (MSS.inits xs_0)
MSS.inits !xs_0 = <{MSS._c;8;12_21}> xs_0
<{MSS._c;8;12_21}> !xs_0 = select xs_0 (Flite.Nil -> Flite.Cons Flite.Nil Flite.Nil) (Flite.Cons y_1_0 ys_1_1 -> Flite.Cons xs_0 (MSS.inits (MSS.init xs_0)))
......@@ -11,9 +11,9 @@ MSS.init !_x_0 = select _x_0 (Flite.Cons x_1_0 _x_1_1 -> select _x_1_1 (Flite.Ni
MSS.tails !_x_0 = select _x_0 (Flite.Nil -> Flite.Nil) (Flite.Cons x_1_0 xs_1_1 -> Flite.Cons (Flite.Cons x_1_0 xs_1_1) (MSS.tails xs_1_1))
MSS.concatMap f_0 !_x_1 = select _x_1 (Flite.Nil -> Flite.Nil) (Flite.Cons x_1_0 xs_1_1 -> MSS.append (f_0 x_1_0) (MSS.concatMap f_0 xs_1_1))
MSS.append !_x_0 ys_1 = select _x_0 (Flite.Nil -> ys_1) (Flite.Cons x_1_0 xs_1_1 -> Flite.Cons x_1_0 (MSS.append xs_1_1 ys_1))
MSS.sum !xs_0 = MSS.sumAcc_16 0 xs_0
MSS.sumAcc_16 !acc_0 !_x_1 = select _x_1 (Flite.Nil -> acc_0) (Flite.Cons x_1_0 xs_1_1 -> MSS.sumAcc_16 (add acc_0 x_1_0) xs_1_1)
MSS.sum::I !xs_0 = MSS.sumAcc_16 0 xs_0
MSS.sumAcc_16::I !acc_0::I !_x_1 = select _x_1 (Flite.Nil -> acc_0) (Flite.Cons x_1_0 xs_1_1 -> MSS.sumAcc_16 (addI acc_0 x_1_0) xs_1_1)
MSS.map f_0 !_x_1 = select _x_1 (Flite.Nil -> Flite.Nil) (Flite.Cons x_1_0 xs_1_1 -> Flite.Cons (f_0 x_1_0) (MSS.map f_0 xs_1_1))
MSS.maximum_17 !_x_0 = select _x_0 (Flite.Cons x_1_0 xs_1_1 -> MSS.maxi_18 x_1_0 xs_1_1)
MSS.maxi_18 !m_0 !_x_1 = select _x_1 (Flite.Nil -> m_0) (Flite.Cons x_1_0 xs_1_1 -> if (<{MSS.<=_19}> m_0 x_1_0) (MSS.maxi_18 x_1_0 xs_1_1) (MSS.maxi_18 m_0 xs_1_1))
<{MSS.<=_19}> !x_0 !y_1 = not (lt y_1 x_0)
MSS.maximum_17::I !_x_0 = select _x_0 (Flite.Cons x_1_0 xs_1_1 -> MSS.maxi_18 x_1_0 xs_1_1)
MSS.maxi_18::I !m_0::I !_x_1 = select _x_1 (Flite.Nil -> m_0) (Flite.Cons x_1_0 xs_1_1 -> if (<{MSS.<=_19}> m_0 x_1_0) (MSS.maxi_18 x_1_0 xs_1_1) (MSS.maxi_18 m_0 xs_1_1))
<{MSS.<=_19}>::B !x_0::I !y_1::I = not (ltI y_1 x_0)
main = example.Start
example.Start = example.fib 35
example.fib !n_0 = if (lt n_0 2) 1 (add (example.fib (sub n_0 1)) (example.fib (sub n_0 2)))
example.fib !n_0::I = if (ltI n_0 2) 1 (addI (example.fib (subI n_0 1)) (example.fib (subI n_0 2)))
main = example.Start
example.Start = example.g (example.f_50 8) 9
example.f_50 !a_0 !b_1 = add a_0 b_1
example.f_50 !a_0 !b_1 = addI a_0 b_1
example.g !f_0 b_1 = f_0 b_1
main = Benchmarks.Start
Benchmarks.Start = Benchmarks.hd1 (Benchmarks.knights1 5)
Benchmarks.knights1 !n_0 = Benchmarks.doknights1 n_0 (Benchmarks.Cons (Benchmarks.Tup 1 1) Benchmarks.Nill)
Benchmarks.knights1 !n_0::I = Benchmarks.doknights1 n_0 (Benchmarks.Cons (Benchmarks.Tup 1 1) Benchmarks.Nill)
:: Benchmarks.List1 = Benchmarks.Nill | Benchmarks.Cons a1 a2
:: Benchmarks.Tuptype = Benchmarks.Tup a1 a2
Benchmarks.doknights1 !n_0 !_x_1 = select _x_1 (Benchmarks.Cons p_1_0 ps_1_1 -> if (eqI (add (Benchmarks.length1 ps_1_1) 1) (mult n_0 n_0)) (Benchmarks.Cons (Benchmarks.Cons p_1_0 ps_1_1) Benchmarks.Nill) (Benchmarks.conc (Benchmarks.map1 (Benchmarks.anon_78 n_0 p_1_0 ps_1_1) (Benchmarks.moves1 n_0 ps_1_1 p_1_0))))
Benchmarks.moves1 n_0 as_1 !_x_2 = select _x_2 (Benchmarks.Tup p_1_0 q_1_1 -> Benchmarks.filter1 (Benchmarks.legal1 n_0 as_1) (Benchmarks.Cons (Benchmarks.Tup (add p_1_0 1) (add q_1_1 2)) (Benchmarks.Cons (Benchmarks.Tup (add p_1_0 1) (sub q_1_1 2)) (Benchmarks.Cons (Benchmarks.Tup (sub p_1_0 1) (add q_1_1 2)) (Benchmarks.Cons (Benchmarks.Tup (sub p_1_0 1) (sub q_1_1 2)) (Benchmarks.Cons (Benchmarks.Tup (add p_1_0 2) (add q_1_1 1)) (Benchmarks.Cons (Benchmarks.Tup (add p_1_0 2) (sub q_1_1 1)) (Benchmarks.Cons (Benchmarks.Tup (sub p_1_0 2) (add q_1_1 1)) (Benchmarks.Cons (Benchmarks.Tup (sub p_1_0 2) (sub q_1_1 1)) Benchmarks.Nill)))))))))
Benchmarks.legal1 n_0 as_1 !_x_2 = select _x_2 (Benchmarks.Tup p_1_0 q_1_1 -> if (not (lt p_1_0 1)) (if (not (lt n_0 p_1_0)) (if (not (lt q_1_1 1)) (if (not (lt n_0 q_1_1)) (Benchmarks.notmemb_102 as_1 (Benchmarks.Tup p_1_0 q_1_1)) False) False) False) False)
Benchmarks.notmemb_102 !_x_0 a_1 = select _x_0 (Benchmarks.Nill -> True) (Benchmarks.Cons x_1_0 xs_1_1 -> if (Benchmarks.neqtup_103 a_1 x_1_0) (Benchmarks.notmemb_102 xs_1_1 a_1) False)
Benchmarks.neqtup_103 !_x_0 !_x_1 = select _x_0 (Benchmarks.Tup a_1_0 b_1_1 -> select _x_1 (Benchmarks.Tup c_2_0 d_2_1 -> if (neqI a_1_0 c_2_0) True (neqI b_1_1 d_2_1)) )
Benchmarks.doknights1 !n_0::I !_x_1 = select _x_1 (Benchmarks.Cons p_1_0 ps_1_1 -> if (eqI (addI (Benchmarks.length1 ps_1_1) 1) (multI n_0 n_0)) (Benchmarks.Cons (Benchmarks.Cons p_1_0 ps_1_1) Benchmarks.Nill) (Benchmarks.conc (Benchmarks.map1 (Benchmarks.anon_78 n_0 p_1_0 ps_1_1) (Benchmarks.moves1 n_0 ps_1_1 p_1_0))))
Benchmarks.moves1 n_0::I as_1 !_x_2 = select _x_2 (Benchmarks.Tup p_1_0 q_1_1 -> Benchmarks.filter1 (Benchmarks.legal1 n_0 as_1) (Benchmarks.Cons (Benchmarks.Tup (addI p_1_0 1) (addI q_1_1 2)) (Benchmarks.Cons (Benchmarks.Tup (addI p_1_0 1) (subI q_1_1 2)) (Benchmarks.Cons (Benchmarks.Tup (subI p_1_0 1) (addI q_1_1 2)) (Benchmarks.Cons (Benchmarks.Tup (subI p_1_0 1) (subI q_1_1 2)) (Benchmarks.Cons (Benchmarks.Tup (addI p_1_0 2) (addI q_1_1 1)) (Benchmarks.Cons (Benchmarks.Tup (addI p_1_0 2) (subI q_1_1 1)) (Benchmarks.Cons (Benchmarks.Tup (subI p_1_0 2) (addI q_1_1 1)) (Benchmarks.Cons (Benchmarks.Tup (subI p_1_0 2) (subI q_1_1 1)) Benchmarks.Nill)))))))))
Benchmarks.legal1::B n_0::I as_1 !_x_2 = select _x_2 (Benchmarks.Tup p_1_0 q_1_1 -> if (not (ltI p_1_0 1)) (if (not (ltI n_0 p_1_0)) (if (not (ltI q_1_1 1)) (if (not (ltI n_0 q_1_1)) (Benchmarks.notmemb_102 as_1 (Benchmarks.Tup p_1_0 q_1_1)) False) False) False) False)
Benchmarks.notmemb_102::B !_x_0 a_1 = select _x_0 (Benchmarks.Nill -> True) (Benchmarks.Cons x_1_0 xs_1_1 -> if (Benchmarks.neqtup_103 a_1 x_1_0) (Benchmarks.notmemb_102 xs_1_1 a_1) False)
Benchmarks.neqtup_103::B !_x_0 !_x_1 = select _x_0 (Benchmarks.Tup a_1_0 b_1_1 -> select _x_1 (Benchmarks.Tup c_2_0 d_2_1 -> if (not (eqI a_1_0 c_2_0)) True (not (eqI b_1_1 d_2_1))) )
Benchmarks.filter1 f_0 !_x_1 = select _x_1 (Benchmarks.Nill -> Benchmarks.Nill) (Benchmarks.Cons x_1_0 xs_1_1 -> if (f_0 x_1_0) (Benchmarks.Cons x_1_0 (Benchmarks.filter1 f_0 xs_1_1)) (Benchmarks.filter1 f_0 xs_1_1))
Benchmarks.anon_78 !n_0 p_1 !ps_2 q_3 = Benchmarks.doknights1 n_0 (Benchmarks.Cons q_3 (Benchmarks.Cons p_1 ps_2))
Benchmarks.anon_78 !n_0::I p_1 !ps_2 q_3 = Benchmarks.doknights1 n_0 (Benchmarks.Cons q_3 (Benchmarks.Cons p_1 ps_2))
Benchmarks.map1 f_0 !_x_1 = select _x_1 (Benchmarks.Nill -> Benchmarks.Nill) (Benchmarks.Cons x_1_0 xs_1_1 -> Benchmarks.Cons (f_0 x_1_0) (Benchmarks.map1 f_0 xs_1_1))
Benchmarks.conc !_x_0 = select _x_0 (Benchmarks.Nill -> Benchmarks.Nill) (Benchmarks.Cons _x_1_0 yss_1_1 -> select _x_1_0 (Benchmarks.Nill -> Benchmarks.conc yss_1_1) (Benchmarks.Cons z_2_0 zs_2_1 -> Benchmarks.Cons z_2_0 (Benchmarks.conc (Benchmarks.Cons zs_2_1 yss_1_1))) )
Benchmarks.length1 !_x_0 = select _x_0 (Benchmarks.Nill -> 0) (Benchmarks.Cons x_1_0 xs_1_1 -> add 1 (Benchmarks.length1 xs_1_1))
Benchmarks.length1::I !_x_0 = select _x_0 (Benchmarks.Nill -> 0) (Benchmarks.Cons x_1_0 xs_1_1 -> addI 1 (Benchmarks.length1 xs_1_1))
Benchmarks.hd1 !_x_0 = select _x_0 (Benchmarks.Cons x_1_0 xs_1_1 -> x_1_0)
main = example.Start
example.Start = StdList.map example.inc (_predefined._Cons 1 (_predefined._Cons 2 (_predefined._Cons 3 (_predefined._Cons 4 _predefined._Nil))))
:: _predefined._List = _predefined._Cons a1 a2 | _predefined._Nil
example.inc !a_0 = add a_0 1
example.inc !a_0 = addI a_0 1
StdList.map f_0 !_x_1 = select _x_1 (_predefined._Cons a_1_0 x_1_1 -> _predefined._Cons (f_0 a_1_0) (StdList.map f_0 x_1_1)) (_predefined._Nil -> _predefined._Nil)
main = Benchmarks.Start
Benchmarks.Start = Benchmarks.matchtest 2000
Benchmarks.matchtest !n_0 = Benchmarks.sum1 (Benchmarks.map1 Benchmarks.mtest (Benchmarks.fromto 1 n_0))
Benchmarks.fromto !n_0 !m_1 = Benchmarks.take1 (add (sub m_1 n_0) 1) (Benchmarks.fr n_0)
Benchmarks.fr n_0 = Benchmarks.Cons n_0 (Benchmarks.fr (add n_0 1))
Benchmarks.Start::I = Benchmarks.matchtest 2000
Benchmarks.matchtest::I !n_0::I = Benchmarks.sum1 (Benchmarks.map1 Benchmarks.mtest (Benchmarks.fromto 1 n_0))
Benchmarks.fromto !n_0::I !m_1::I = Benchmarks.take1 (addI (subI m_1 n_0) 1) (Benchmarks.fr n_0)
Benchmarks.fr n_0::I = Benchmarks.Cons n_0 (Benchmarks.fr (addI n_0 1))
:: Benchmarks.List1 = Benchmarks.Nill | Benchmarks.Cons a1 a2
Benchmarks.take1 n_0 !_x_1 = select _x_1 (Benchmarks.Nill -> Benchmarks.Nill) (Benchmarks.Cons x_1_0 xs_1_1 -> if (eqI n_0 0) Benchmarks.Nill (Benchmarks.Cons x_1_0 (Benchmarks.take1 (sub n_0 1) xs_1_1)))
Benchmarks.mtest !n_0 = Benchmarks.sum1 (Benchmarks.map1 Benchmarks.anon_71 (Benchmarks.fromto 1 n_0))
Benchmarks.anon_71 !m_0 = Benchmarks.cm (Benchmarks.fromto 1 (mod m_0 10))
Benchmarks.cm !_x_0 = select _x_0 (Benchmarks.Nill -> 0) (Benchmarks.Cons a_1_0 _x_1_1 -> select _x_1_1 (Benchmarks.Nill -> a_1_0) (Benchmarks.Cons b_2_0 _x_2_1 -> select _x_2_1 (Benchmarks.Nill -> add a_1_0 b_2_0) (Benchmarks.Cons c_3_0 _x_3_1 -> select _x_3_1 (Benchmarks.Nill -> add (add a_1_0 b_2_0) c_3_0) (Benchmarks.Cons d_4_0 _x_4_1 -> select _x_4_1 (Benchmarks.Nill -> add (add (add a_1_0 b_2_0) c_3_0) d_4_0) (_ -> add (add (add (add a_1_0 b_2_0) c_3_0) d_4_0) (Benchmarks.length1 _x_4_1))) ) ) )
Benchmarks.length1 !_x_0 = select _x_0 (Benchmarks.Nill -> 0) (Benchmarks.Cons x_1_0 xs_1_1 -> add 1 (Benchmarks.length1 xs_1_1))
Benchmarks.take1 n_0::I !_x_1 = select _x_1 (Benchmarks.Nill -> Benchmarks.Nill) (Benchmarks.Cons x_1_0 xs_1_1 -> if (eqI n_0 0) Benchmarks.Nill (Benchmarks.Cons x_1_0 (Benchmarks.take1 (subI n_0 1) xs_1_1)))
Benchmarks.mtest::I !n_0::I = Benchmarks.sum1 (Benchmarks.map1 Benchmarks.anon_71 (Benchmarks.fromto 1 n_0))
Benchmarks.anon_71::I !m_0::I = Benchmarks.cm (Benchmarks.fromto 1 (mod m_0 10))
Benchmarks.cm::I !_x_0 = select _x_0 (Benchmarks.Nill -> 0) (Benchmarks.Cons a_1_0 _x_1_1 -> select _x_1_1 (Benchmarks.Nill -> a_1_0) (Benchmarks.Cons b_2_0 _x_2_1 -> select _x_2_1 (Benchmarks.Nill -> addI a_1_0 b_2_0) (Benchmarks.Cons c_3_0 _x_3_1 -> select _x_3_1 (Benchmarks.Nill -> addI (addI a_1_0 b_2_0) c_3_0) (Benchmarks.Cons d_4_0 _x_4_1 -> select _x_4_1 (Benchmarks.Nill -> addI (addI (addI a_1_0 b_2_0) c_3_0) d_4_0) (_ -> addI (addI (addI (addI a_1_0 b_2_0) c_3_0) d_4_0) (Benchmarks.length1 _x_4_1))) ) ) )
Benchmarks.length1::I !_x_0 = select _x_0 (Benchmarks.Nill -> 0) (Benchmarks.Cons x_1_0 xs_1_1 -> addI 1 (Benchmarks.length1 xs_1_1))
Benchmarks.map1 f_0 !_x_1 = select _x_1 (Benchmarks.Nill -> Benchmarks.Nill) (Benchmarks.Cons x_1_0 xs_1_1 -> Benchmarks.Cons (f_0 x_1_0) (Benchmarks.map1 f_0 xs_1_1))
Benchmarks.sum1 !_x_0 = select _x_0 (Benchmarks.Nill -> 0) (Benchmarks.Cons x_1_0 xs_1_1 -> add x_1_0 (Benchmarks.sum1 xs_1_1))
Benchmarks.sum1::I !_x_0 = select _x_0 (Benchmarks.Nill -> 0) (Benchmarks.Cons x_1_0 xs_1_1 -> addI x_1_0 (Benchmarks.sum1 xs_1_1))
main = example.Start
example.Start = example.nfib 30
example.nfib !n_0 = if (lt n_0 2) 1 (add 1 (add (example.nfib (sub n_0 1)) (example.nfib (sub n_0 2))))
example.nfib !n_0::I = if (ltI n_0 2) 1 (addI 1 (addI (example.nfib (subI n_0 1)) (example.nfib (subI n_0 2))))
main = primes.Start
primes.Start = primes.el 5000 primes.pr
primes.Start::I = primes.el 5000 primes.pr
primes.pr = primes.s (primes.fr 2)
primes.fr n_0 = primes.Cons n_0 (primes.fr (add n_0 1))
primes.fr n_0::I = primes.Cons n_0 (primes.fr (addI n_0 1))
:: primes.Mylist = primes.Cons a1 a2 | primes.Empty
primes.s !_x_0 = select _x_0 (primes.Cons x_1_0 xs_1_1 -> primes.Cons x_1_0 (primes.s (primes.filt (primes.nmz x_1_0) xs_1_1)))
primes.nmz !x_0 !y_1 = neqI (mod y_1 x_0) 0
primes.nmz::B !x_0::I !y_1::I = neqI (mod y_1 x_0) 0
primes.filt p_0 !_x_1 = select _x_1 (primes.Empty -> primes.Empty) (primes.Cons x_1_0 xs_1_1 -> if (p_0 x_1_0) (primes.Cons x_1_0 (primes.filt p_0 xs_1_1)) (primes.filt p_0 xs_1_1))
primes.el !_x_0 !_x_1 = select _x_0 (0 -> select _x_1 (primes.Cons x_2_0 xs_2_1 -> x_2_0) ) (_ -> select _x_1 (primes.Cons x_1_0 xs_1_1 -> primes.el (sub _x_0 1) xs_1_1) )
primes.el !_x_0::I !_x_1 = select _x_0 (0 -> select _x_1 (primes.Cons x_2_0 xs_2_1 -> x_2_0) ) (_ -> select _x_1 (primes.Cons x_1_0 xs_1_1 -> primes.el (subI _x_0 1) xs_1_1) )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment