This commit is contained in:
Scarlett
2025-04-15 14:46:00 -04:00
parent 8057060f26
commit c091927fe7
34 changed files with 730 additions and 0 deletions

View File

@ -0,0 +1,29 @@
(* 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;
}