mirror of
https://github.com/kanaka/mal.git
synced 2024-09-19 01:28:26 +03:00
Merge pull request #383 from asarhaddon/ada2tco-do
ada.2: optimize tail call recursion for last `do` evaluation
This commit is contained in:
commit
7aecf6639a
@ -138,11 +138,12 @@ procedure Step5_Tco is
|
||||
declare
|
||||
Result : Types.T;
|
||||
begin
|
||||
for I in 2 .. Ast.Sequence.all.Length loop
|
||||
for I in 2 .. Ast.Sequence.all.Length - 1 loop
|
||||
Result := Eval (Ast.Sequence.all.Data (I), Env);
|
||||
end loop;
|
||||
return Result;
|
||||
end;
|
||||
Ast := Ast.Sequence.all.Data (Ast.Sequence.all.Length);
|
||||
goto Restart;
|
||||
elsif First.Str.all = "fn*" then
|
||||
Err.Check (Ast.Sequence.all.Length = 3, "expected 2 parameters");
|
||||
declare
|
||||
|
@ -142,11 +142,12 @@ procedure Step6_File is
|
||||
declare
|
||||
Result : Types.T;
|
||||
begin
|
||||
for I in 2 .. Ast.Sequence.all.Length loop
|
||||
for I in 2 .. Ast.Sequence.all.Length - 1 loop
|
||||
Result := Eval (Ast.Sequence.all.Data (I), Env);
|
||||
end loop;
|
||||
return Result;
|
||||
end;
|
||||
Ast := Ast.Sequence.all.Data (Ast.Sequence.all.Length);
|
||||
goto Restart;
|
||||
elsif First.Str.all = "fn*" then
|
||||
Err.Check (Ast.Sequence.all.Length = 3, "expected 2 parameters");
|
||||
declare
|
||||
|
@ -154,11 +154,12 @@ procedure Step7_Quote is
|
||||
declare
|
||||
Result : Types.T;
|
||||
begin
|
||||
for I in 2 .. Ast.Sequence.all.Length loop
|
||||
for I in 2 .. Ast.Sequence.all.Length - 1 loop
|
||||
Result := Eval (Ast.Sequence.all.Data (I), Env);
|
||||
end loop;
|
||||
return Result;
|
||||
end;
|
||||
Ast := Ast.Sequence.all.Data (Ast.Sequence.all.Length);
|
||||
goto Restart;
|
||||
elsif First.Str.all = "fn*" then
|
||||
Err.Check (Ast.Sequence.all.Length = 3, "expected 2 parameters");
|
||||
declare
|
||||
|
@ -168,11 +168,12 @@ procedure Step8_Macros is
|
||||
declare
|
||||
Result : Types.T;
|
||||
begin
|
||||
for I in 2 .. Ast.Sequence.all.Length loop
|
||||
for I in 2 .. Ast.Sequence.all.Length - 1 loop
|
||||
Result := Eval (Ast.Sequence.all.Data (I), Env);
|
||||
end loop;
|
||||
return Result;
|
||||
end;
|
||||
Ast := Ast.Sequence.all.Data (Ast.Sequence.all.Length);
|
||||
goto Restart;
|
||||
elsif First.Str.all = "fn*" then
|
||||
Err.Check (Ast.Sequence.all.Length = 3, "expected 2 parameters");
|
||||
declare
|
||||
|
@ -168,11 +168,12 @@ procedure Step9_Try is
|
||||
declare
|
||||
Result : Types.T;
|
||||
begin
|
||||
for I in 2 .. Ast.Sequence.all.Length loop
|
||||
for I in 2 .. Ast.Sequence.all.Length - 1 loop
|
||||
Result := Eval (Ast.Sequence.all.Data (I), Env);
|
||||
end loop;
|
||||
return Result;
|
||||
end;
|
||||
Ast := Ast.Sequence.all.Data (Ast.Sequence.all.Length);
|
||||
goto Restart;
|
||||
elsif First.Str.all = "fn*" then
|
||||
Err.Check (Ast.Sequence.all.Length = 3, "expected 2 parameters");
|
||||
declare
|
||||
|
@ -169,11 +169,12 @@ procedure StepA_Mal is
|
||||
declare
|
||||
Result : Types.T;
|
||||
begin
|
||||
for I in 2 .. Ast.Sequence.all.Length loop
|
||||
for I in 2 .. Ast.Sequence.all.Length - 1 loop
|
||||
Result := Eval (Ast.Sequence.all.Data (I), Env);
|
||||
end loop;
|
||||
return Result;
|
||||
end;
|
||||
Ast := Ast.Sequence.all.Data (Ast.Sequence.all.Length);
|
||||
goto Restart;
|
||||
elsif First.Str.all = "fn*" then
|
||||
Err.Check (Ast.Sequence.all.Length = 3, "expected 2 parameters");
|
||||
declare
|
||||
|
Loading…
Reference in New Issue
Block a user