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,28 +1,34 @@
type main: string -> integer
function entry: main
type rec: [integer: x; integer: y]
type T1: integer -> integer
type T2: rec -> integer
type arr : 1 -> integer
type arr: 1 -> integer
function foo : T1
function bar1 : T2
function bar2 : T2
function foo: T1
function bar1: T2
function bar2: T2
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) := {
return r * s;
return r * s;
}
entry(arg) := {
[ integer: result ; rec: w]
result := foo(5);
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 *)
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;
entry (arg) := {
[ integer: result ; rec: w]
result := foo(5);
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 *)
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;
}