RPN Interpreter Eval function

Share your advanced PureBasic knowledge/code with the community.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5357
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: RPN Interpreter Eval function

Post by Kwai chang caine »

Hello my friend, i'm happy to read you :D, because it's not the case since a long time :|
Works great here with W10 X86 / v5.70 X86
courageous wrote:varA=Hello
Nearly a begin of JavaScript :wink:
courageous wrote:I wrote it over a few early mornings when I couldn't sleep
Like what the misfortune of some, makes the happiness of others :lol:

Thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
User avatar
idle
Always Here
Always Here
Posts: 5098
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: RPN Interpreter Eval function

Post by idle »

thanks Kcc, I'm still about, just not doing much with PB these days.
Windows 11, Manjaro, Raspberry Pi OS
Image
kinglestat
Enthusiast
Enthusiast
Posts: 732
Joined: Fri Jul 14, 2006 8:53 pm
Location: Malta
Contact:

Re: RPN Interpreter Eval function

Post by kinglestat »

This looks something interesting...and was trying to cannibalize it from my non nefarious reasons.
I was trying to figure out if it "remembers" variables as long lines are something I avoid

Code: Select all

*rpn.IRPN = NewRPN()
Debug *rpn\Eval("a = 5")
This crashes it...and can't see why
I may not help with your coding
Just ask about mental issues!

http://www.lulu.com/spotlight/kingwolf
http://www.sen3.net
User avatar
idle
Always Here
Always Here
Posts: 5098
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: RPN Interpreter Eval function

Post by idle »

It crashed as the stack was empty and there's nothing to evaluate. I added a trap to avoid the crash.
You can build statements up like Statement.s + "a=5 " and then call the eval but it only works on a single input string and it's fiddly. It was just a toy to idle away early mornings when I couldn't sleep and suffered feature creep but with a little care it works.
Windows 11, Manjaro, Raspberry Pi OS
Image
kinglestat
Enthusiast
Enthusiast
Posts: 732
Joined: Fri Jul 14, 2006 8:53 pm
Location: Malta
Contact:

Re: RPN Interpreter Eval function

Post by kinglestat »

I understand insomnia...nice work
I may not help with your coding
Just ask about mental issues!

http://www.lulu.com/spotlight/kingwolf
http://www.sen3.net
Post Reply