mirror of
https://github.com/ValKmjolnir/Nasal-Interpreter.git
synced 2026-05-24 21:45:44 +08:00
I changed callfv's way of calling a function with arguments in vm_vec. now callfv fetches arguments from val_stack directly,so it runs test/fib.nas from 2.4s to 1.9s. delete operand callf,add operands callfv & callfh. also,i check val_stack's top to make sure there is not a stack overflow.
9 lines
133 B
Plaintext
9 lines
133 B
Plaintext
import("lib.nas");
|
|
var fib=func(x)
|
|
{
|
|
if(x<2) return x;
|
|
return fib(x-1)+fib(x-2);
|
|
}
|
|
for(var i=0;i<31;i+=1)
|
|
print(fib(i),'\n');
|
|
|