B4A Library ExpressionEvaluator library

I've been meaning to do this for my own use for a while and I have finally got a round tuit that allowed me to get on with it. Everyone should have a round tuit - they are so useful! :)

This is the recursive descent parser from my BasicLib library stripped down to deal with arithmetic functions only. Pass it a valid arithmetic expression as a string and it will return the result. Use a help viewer to see what is supported but basically it will evaluate any arithmetic expression that Basic4android can. It also supports variables that may be used to pass values and store intermediate results.


EDIT :- Version 1.1 has improved error reporting. See post #3 for details.
 

Attachments

  • aroundtuit.jpg
    aroundtuit.jpg
    23 KB · Views: 865
  • ExpressionEvaluator1.1.zip
    15.3 KB · Views: 1,633
Last edited:

MaFu

Well-Known Member
Licensed User
Longtime User
So i assume you haven't testet the included demo app yet? :D
Yes, sure. It's already implemented since about two weeks. As i wrote in the pm i sent to you ;)
The function name is "if" not "iif", but this shouldn't be a problem.

Check the demo app, it contains all functions of the math parser. But currently the output goes to the log, no visual output on the device. So it's best to test it with emulator (e.g. Genymotion) or usb connected device.
 

stanmiller

Active Member
Licensed User
Longtime User
Patrick this is a good topic for a new thread: "IIF() - Immediate If support needed in eval library" Then Manfred you could respond with an example using your Math Libraries. Perhaps Agraham would weigh in as well.
 

imbault

Well-Known Member
Licensed User
Longtime User
So i assume you haven't testet the included demo app yet? :D
Yes, sure. It's already implemented since about two weeks. As i wrote in the pm i sent to you ;)
The function name is "if" not "iif", but this shouldn't be a problem.

Check the demo app, it contains all functions of the math parser. But currently the output goes to the log, no visual output on the device. So it's best to test it with emulator (e.g. Genymotion) or usb connected device.
You're right Manfred, I'm in vacations, and I've to refactor my code using your lib, but I will try very very soon
Thanks
 

imbault

Well-Known Member
Licensed User
Longtime User
Patrick this is a good topic for a new thread: "IIF() - Immediate If support needed in eval library" Then Manfred you could respond with an example using your Math Libraries. Perhaps Agraham would weigh in as well.
You're maybe right, I asked Agraham, but no answer, so I believe he doesn't support his lib any more
Patrick
 
Top