Added some notes and fixed the bp

This commit is contained in:
Meyer Simon
2025-05-05 17:15:52 -04:00
parent 1c5b7de5fd
commit 0446b0ae6b
3 changed files with 88 additions and 47 deletions

View File

@ -12,15 +12,12 @@ bar (r,s) := {
}
entry (arg) := {
[ integer: result ; rec: w]
if ( result = result ) then {
if ( result < w.y ) then {
result := 8;
} else {
result := 9;
}(* *)
[ integer: r ; integer: s; Boolean: x]
x := (r < s) & x;
if ( r < s ) then {
r := 5;
} else {
result := bar('c', 7);
r := 7;
}
return 0;
}

View File

@ -0,0 +1,34 @@
(* TEST: [-asc -tc -cg -ir] *)
#include "std.alpha"
type M : string -> integer
function entry : M
type fib: integer -> integer
function Fib : fib
Fib(i) := {
[ Boolean: a ; Boolean: b ; Boolean: c]
if( i = 0 ) then {
return 7;
} else {
i := i;
}
b := b | (a & c);
b := 2 < 3;
if(i = 1) then {
return 1;
} else {
return i + Fib(i - 1);
}
}
entry (arg) := {
[ integer: x; integer: y ]
x := 2;
x := Fib(2);
y := printInteger(Fib(2));
return 1;
}