Files
compiler-the-translators/tests/given/test/sample.good.alpha
2025-05-04 16:05:13 -04:00

31 lines
615 B
Plaintext

(* TEST: [-asc -tc] *)
(* Type definitions *)
type int2int: integer -> integer
type string2int: string -> integer
(* Function declarations
They use the above type definitions
*)
function square : int2int
function entry : string2int
(* Function definition
Functions must be declared before they are defined
*)
square(x) := {
return x * x;
}
(* Function definition
entry is the first function called
*)
entry(arg) := {
[ integer: input ; integer: expected ; integer: actual ; Boolean: result ]
input := 7;
expected := 49;
actual := square(input);
result := expected = actual;
return 0;
}