what should i do? :S

lucasjohnson00

Member
Licensed User
Longtime User
my friend and i are making a programmable calculator that is 100 percent programmable. all the ones on the market suck, so we are making this one. what we have done:

made a form that dynamically increases the number of textboxes according to the number within the database. we are totaly stumped on one thing. the only thing we have left to do is:

come up with a way to input the equation into the database so that will allow us to recall it when the equation is needed.

initially, we were adding an equation one variable and function (plus minus divide multiply) at a time into one field of the database at a time. I figured we could use "if" and "then" statements to make it work. BUT, my partner thinks thats a bad idea. can you help? i also think we could:

input the entire equation into the database as a string.... then when it is pulled out of the database, we could manipulate the string into seperate charactors and from there input each charactor into its corresponding labels and text boxes.

i just need info on the best method to use. and maybe some assistance with the code. I am a VB6 junky, and am very new to B4A. any assistance would be great

thank you


lucas johnson
 

agraham

Expert
Licensed User
Longtime User
It sounds like you want an expression parser but I am not clear why you need to use a database. I've posted an Expression Evaluator library. It's a pretty neat implementation of a recursive descent parser but if you want to roll your own you could take a look at the source and see how its done.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Hi Andrew...

The DataBase is to be used to hold the Formulas themselfs and some additional info, and others stuf...
Thanks for pointing to your parser, I will have a look at it...Seems like the job got easier...
Are there any known limitations to this? like exponents, Brakets, etc?
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Are there any known limitations to this? like exponents, Brakets, etc?
No, it is the parser from my BasicLib interpreter stripped down for arithmetic evaluations. The only limit on the complexity of expression is call stack space which in practice means that you won't find an expression that it can't parse.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
No, it is the parser from my BasicLib interpreter stripped down for arithmetic evaluations. The only limit on the complexity of expression is call stack space which in practice means that you won't find an expression that it can't parse.

SO as long as the formula it sef is correct, as duelly given to the parser, it will evaluate, no matter how complex...NICE!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…