dcsimg
Equation Parser for Java
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Brett_Thorson
Posted On:   Tuesday, May 22, 2001 07:27 PM

I originally set out to find a tool that will take a string "b = [(w * h) / 3600] ^ (1/2)" and allow java to do a string substitution to throw values in there, and then throw it at a parser to evaluate the statement. A friend told me to go find antlr, as that would be the best solution. I have to say I am new to this and it is getting a little more clear. I found in the examples the exprAST to take the formula and print it out in RPN, at the same time putting it into a binary tree. The problem is that it doesn't support exponentiation, or calculation. Then I saw the calc example, and it works great except it only does addition and multiplication. Before I go re-invent the wheel (i.e. learn how to make my own gramm   More>>

I originally set out to find a tool that will take a string "b = [(w * h) / 3600] ^ (1/2)" and allow java to do a string substitution to throw values in there, and then throw it at a parser to evaluate the statement.

A friend told me to go find antlr, as that would be the best solution. I have to say I am new to this and it is getting a little more clear.

I found in the examples the exprAST to take the formula and print it out in RPN, at the same time putting it into a binary tree. The problem is that it doesn't support exponentiation, or calculation.

Then I saw the calc example, and it works great except it only does addition and multiplication. Before I go re-invent the wheel (i.e. learn how to make my own grammer file?) has someone accomplished the task of evaluating a string representation of a formula in Java yet? Or developed a grammer file to do it?

Thanks for your help, and any advice.

--Brett

   <<Less

Re: Re: Equation Parser for Java

Posted By:   Anonymous  
Posted On:   Thursday, September 13, 2001 06:06 AM

I am very interested in such a parser. Could you send me the package?
Thanks

Re: Equation Parser for Java

Posted By:   jo_desmet  
Posted On:   Thursday, May 24, 2001 11:26 AM

Hi,
Somebody notified me that you were searching for something I already made.
I have developed a package by name JMEP, which is able to evaluate an expression given as a string.
If you e-mail me a can send you the package.
thx (Jo_Desmet@yahoo.com).
About | Sitemap | Contact