Type check errors

This commit is contained in:
Scarlett
2025-04-16 16:30:58 -04:00
parent 5a23ef2756
commit c72e7a2a28
6 changed files with 128 additions and 89 deletions

View File

@ -28,7 +28,7 @@ entry (arg) := {
w := reserve w; (* see types.alpha reserve returns a value of type address, which can be assigned to array and record variables*)
w.x := 5;
w.y := 7;
result := bar1(w); (* pass w (a rec type value) to bar1 *)
ressult := bar1(w); (* pass w (a rec type value) to bar1 *)
result := bar2(5,7); (* implicitly build a rec type value, assign 5 and 7 to fields x and y, but call them r and s *)
return 0;
}

View File

@ -14,20 +14,20 @@ function bar2 : T2
function make_list : list
make_list (a) := {
[integer:orig_a; address: ret; address: curr; address: temp]
[integer:orig_a; llnode: ret; llnode: curr; llnode: temp]
if (a < 0 | a = 0) then {
return null;
} else {
ret := reserve llnode;
ret := reserve ret;
ret.prev := null;
ret.next := null;
ret.val := a;
while (0 < a) {
temp := reserve llnode;
temp := reserve temp;
temp.prev := null;
temp.next := null;
temp.val := val;
temp.val := ret.val;
if (a = orig_a) then {
ret.next := temp;
temp.prev := ret;
@ -68,7 +68,6 @@ bar2(r,s) := {
entry (arg) := {
[ integer: result ; rec: w; llnode: li]
li := make_list(6);
result := foo(5);
w := reserve w;