Files
compiler-the-translators/tests/sprint1/test/sp1_real_alpha_file2.alpha
2025-05-04 16:05:13 -04:00

28 lines
618 B
Plaintext

(* TEST: [-tok] *)
(* Type definitions *)
type string: 1 -> character
type int2int: integer -> integer
type string2int: string -> integer
(* Function prototypes
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) := {
input = 7;
expected = 49;
actual := square(input);
rseult := expected = actual;
return 0;
[ integer: input; integer: expected; integer: actual; boolean: result; string: input ]
}