Added some notes and fixed the bp
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
34
tests/sprint4/test/sp4_cg_fib.alpha
Normal file
34
tests/sprint4/test/sp4_cg_fib.alpha
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user