Tell me what you want, What you really, really want.

Moderator: Mmiscool

User avatar
By Mmiscool
#43019 If there are any loops there run in the code of the library they might be the culprit.

There might have to be some delay(0) put in there.
User avatar
By cicciocb
#43027 Unfortunately this is not the case.
I put delay(0); everywhere in the code but this don't helped.

I'm trying to understand the reasons but it's very very hard to debug without a debugger!
I modified the way the strings are used in the library, now it's better but I'm still not satisfied as I can't go beyond 2 levels of recursion ex. sin(sin(x)) is OK but sin(sin(sin(x))) don't.
Seems a memory problem but It should not be the case.
I'm progressing but very very slow ....

CiccioCB
User avatar
By cicciocb
#43221 Definitively I found the cause of the problem, even if I can't find a real solution.
The recursive method employed into the parser costs a lot in terms of stack memory used.
I'm actually trying to minimize the memory used in each "recursion" in order to permit at least 2 or 3 nested level.
Just to clarify, a nested level means one function of one function as "sin(cos(x))".
After several modifications, I think have reached an "acceptable" status where it seems stable with 2 levels and at the limits with 3.
This means that things like let a = eval(mid("my name is",1,sin(3.14159265/2)+1)) are possible but
let s = eval(sin(sin(cos(x)))) are risky and can crash.
I think it's a limitation that can be accepted at the moment, looking for a better solution.
I'll try to post the files later today.

CiccioCB