ready for merge!

This commit is contained in:
Scarlett
2025-04-04 18:08:59 -04:00
parent 1c805cbe3f
commit 376dfdf53d
32 changed files with 564 additions and 134 deletions

View File

@ -1,3 +1,6 @@
type main: string -> integer
function entry: main
type rec: [integer: x; integer: y]
type T1: integer -> integer
type T2: rec -> integer
@ -10,66 +13,69 @@ function bar1 : T2
function bar2 : T2
function make_list : list
make_list(a) := {
[integer:orig_a; address: ret; address: curr; address: temp]
if (a < 0 | a = 0) then {
return null;
} else {
ret := reserve llnode;
ret.prev := null;
ret.next := null;
ret.val := a;
while (0 < a) {
temp := reserve llnode;
temp.prev := null;
temp.next := null;
temp.val := val;
if (a = orig_a) then {
ret.next := temp;
temp.prev := ret;
curr := temp;
} else {
curr.next := temp;
temp.prev := curr;
curr := temp;
}
a := a - 1;
}
return ret;
make_list (a) := {
[integer:orig_a; address: ret; address: curr; address: temp]
if (a < 0 | a = 0) then {
return null;
} else {
ret := reserve llnode;
ret.prev := null;
ret.next := null;
ret.val := a;
while (0 < a) {
temp := reserve llnode;
temp.prev := null;
temp.next := null;
temp.val := val;
if (a = orig_a) then {
ret.next := temp;
temp.prev := ret;
curr := temp;
} else {
curr.next := temp;
temp.prev := curr;
curr := temp;
}
a := a - 1;
}
return ret;
}
}
foo (x) := {
return x * x;
}
foo(x) := {
return x * x;
}
bar1(a) := {
return a.x * a.y;
}
bar1 (a) := {
return a.x * a.y;
}
bar2 as (r,s) := {
if (r < s) then {
while (!(r < s)) {
r := r + 1;
}
} else {
[integer: x]
x := 0;
while (x < 10) {
r := r + s;
}
if (r < s) then {
while (!(r < s)) {
r := r + 1;
}
return r * s;
}
entry(arg) := {
[ integer: result ; rec: w; llnode: li]
li := make_list(6);
result := foo(5);
w := reserve w;
w.x := 5;
w.y := 7;
result := bar1(w);
result := bar2(5,7);
return 0;
} else {
[integer: x]
x := 0;
while (x < 10) {
r := r + s;
}
}
return r * s;
}
entry (arg) := {
[ integer: result ; rec: w; llnode: li]
li := make_list(6);
result := foo(5);
w := reserve w;
w.x := 5;
w.y := 7;
result := bar1(w);
result := bar2(5,7);
return 0;
}