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

Moderator: Mmiscool

User avatar
By cicciocb
#43248 Hi Mike,
I posted a new release under my fork.
This should work better (at least with board manager 2.0.0-rc1, I didn't tested with 2.1.0-rc2).
I uploaded also a version for 1M already compiled.
Hoping you'll have the time to integrate it.
I tried to reduce as less as possible the memory used by the parser as this was the cause of the crashes.
If we stay within 3 levels of recursions, it works properly (at least is what I hope!)
I tested with the following programs without any crash :
-edit-
Good news :
I recompiled also with the 2.1.0-rc2 and works also without any crashes with the same test programs.
By the way there is a big difference in terms of speed (the 2.0.0-rc1 is much faster) and free memory (the 2.0.0-rc1 gives nearly 5Kb more of free memory); so I think that is better to remains with the 2.0.0-rc1.

---- parser1.bas ----
Code: Select allfor i = 0 to 100

serialprintln eval(ip())

serialprintln eval(sin(sin(sin(5))))

let a = "The quick brown fox jumps over the lazy dog"
let b = "_1234567890"
let c = "this is a very very very long message just to test the memory used"

serialprintln eval(a+b)
serialprintln ramfree()

serialprintln eval(sin(sin(5))+cos(cos(10))+rnd(sin(5)))
let z = eval(mid("my name is",1,sin(3.14159265/2)+1))
serialprintln eval("answer: "+z)
next i




---parser2.bas----
Code: Select allmemclear

print eval(replace("abcdef","c","d"))

print eval("Number of wifi avail : "+str(wifi.scan()))

print eval("First Network Available: "+wifi.ssid(1)+" "+wifi.rssi(1))

print eval("What is My IP ? "+ip())

print eval("First part of my IP "+mid(ip(),1,3))

print eval("What is the char 65? :"+chr(65))

print eval("What is the ascii code of the char A? "+str(asc("A")))

let a = 50

for i = 1 to 200
let k = eval(sin(5*sin(i))*cos(5*log(i)))
serialprint k
serialprint "  "
serialprintln ramfree()
'delay(1)
next i
let b = 5
let c = 3
print eval((a+b)*c)
let L = 2048
print eval("Nb of bits for "+str(L)+" :"+str(log(L)/log(2)))

print eval(8<<2)
print eval(255>>3)


---parser3.bas
Code: Select allfor i = 0 to 100

serialprintln eval(ip())

print eval(sin(sin(sin(i))))


let a = "The quick brown fox jumps over the lazy dog"
let b = "_1234567890"
let c = "this is a very very very long message just to test the memory used"

serialprintln eval(a+b)
serialprintln ramfree()

serialprintln eval(sin(sin(5))+cos(cos(10))+rnd(sin(5)))
let z = eval(mid("my name is",1,sin(3.14159265/2)+1))
print eval("answer: "+z)
next i


---math1.bas ----
Code: Select allmemclear
print eval(sin(log(5)))


for i = 0 to 20
let k = eval(sin(5*i)*cos(5*log(i)))
serialprintln eval(str(k)+" "+str(ramfree()))
next i

let i = 20
print eval(i)

let st = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

print eval(sin(rnd(i)))
for i = 0 to 40
serialprintln eval(mid(st+"1234567890",i,3))
next i


let xx = "The Quick Brow Fox Jumps Over The Lazy Dog 1234567890"
let yy = "This is the ESP"
let zz = "BASIC by MMISCOOL"

serialprintln eval("The result is: "+mid(xx+yy+zz,69,5))



Now it's your time to continue ...
Enjoy

CiccioCB