java mathematical expression parsers

J

Jason Quinn

I'm writing a program that needs a good mathematical expression parser.
I've found JEP, JEPLite, and Jbcparser. I'm still trying to figure out
what is the best one to use. Which note-worthy ones have I missed? It
seems that JEP has as of Nov 2006 closed its source. I'm concerned that
there appears to have been no work on JEPLite in several years. JEPLite
is appealing because the claimed speed increases would be important to
me. I'm very tempted to use JbcParser but there's a fee (pretty darn
small though... finally software that fits my shoe-strings-are-luxuries
budget).

Could somebody with experience give me their thoughts and wisdom about
which is the best and why? Perhaps some comments about their licenses
too. I plan to give away my application for free (under GPL?). This is
will be my first program that's useful enough for me to have to start
worrying about license stuff but I'm still trying to digest what I've
learned so far about GPL and so forth but I just started basically
today.

Thanks in advance,
Jason Quinn
 
T

TechBookReport

Jason said:
I'm writing a program that needs a good mathematical expression parser.
I've found JEP, JEPLite, and Jbcparser. I'm still trying to figure out
what is the best one to use. Which note-worthy ones have I missed? It
seems that JEP has as of Nov 2006 closed its source. I'm concerned that
there appears to have been no work on JEPLite in several years. JEPLite
is appealing because the claimed speed increases would be important to
me. I'm very tempted to use JbcParser but there's a fee (pretty darn
small though... finally software that fits my shoe-strings-are-luxuries
budget).

Could somebody with experience give me their thoughts and wisdom about
which is the best and why? Perhaps some comments about their licenses
too. I plan to give away my application for free (under GPL?). This is
will be my first program that's useful enough for me to have to start
worrying about license stuff but I'm still trying to digest what I've
learned so far about GPL and so forth but I just started basically
today.

Thanks in advance,
Jason Quinn
I've only ever used JEP so can't comment on the other ones. This was a
couple of years ago when it was still open source. Presumably older
versions released under the GPL can still be used or distributed.

The project had a high computational load (genetic algorithms) but
performance with JEP was heavily optimised by writing a caching layer
for intermediate results. This made an enormous difference and meant
that there was no need to consider JEPlite.

Have you considered using a scripting language such as JRuby, Jython or
one of the others now supported by the JVM? The only other alternative I
explored was JNI, writing a recursive descent parser in C isn't that
difficult, but as I said, by decomposing the problem and making use of
caching any performance issues were sidestepped completely.

HTH
 
P

pascal.lecointe

Jason Quinn a écrit :
I'm writing a program that needs a good mathematical expression parser.
I've found JEP, JEPLite, and Jbcparser. I'm still trying to figure out
what is the best one to use. Which note-worthy ones have I missed? It
seems that JEP has as of Nov 2006 closed its source. I'm concerned that
there appears to have been no work on JEPLite in several years. JEPLite
is appealing because the claimed speed increases would be important to
me. I'm very tempted to use JbcParser but there's a fee (pretty darn
small though... finally software that fits my shoe-strings-are-luxuries
budget).

Could somebody with experience give me their thoughts and wisdom about
which is the best and why? Perhaps some comments about their licenses
too. I plan to give away my application for free (under GPL?). This is
will be my first program that's useful enough for me to have to start
worrying about license stuff but I'm still trying to digest what I've
learned so far about GPL and so forth but I just started basically
today.

Thanks in advance,
Jason Quinn

You can also use ANTLR, which is a Java tool to create lexers, parsers,
with AST (Abstract Syntax Tree)

Easy to use to create your grammar, but you have to code your evaluator
after.

Greetings,

Pascal
 
P

Patricia Shanahan

TechBookReport wrote:
....
Have you considered using a scripting language such as JRuby, Jython or
one of the others now supported by the JVM? The only other alternative I
explored was JNI, writing a recursive descent parser in C isn't that
difficult, but as I said, by decomposing the problem and making use of
caching any performance issues were sidestepped completely.

If you are going to write your own parser, why go out of your way to use
C rather than Java?

Patricia
 
T

TechBookReport

Patricia said:
TechBookReport wrote:
...

If you are going to write your own parser, why go out of your way to use
C rather than Java?

Patricia

It was a parser and execution engine - the intention was to improve
performance. This was abandoned once I'd put in the caching layer for
storing intermediate results from JEP.
 
J

John Ersatznom

You can also use ANTLR, which is a Java tool to create lexers, parsers,
with AST (Abstract Syntax Tree)

Easy to use to create your grammar, but you have to code your evaluator
after.

My own recommendation would be: if there's no free-as-in-speech library
to do what you want, roll your own. In this instance, you may be able to
use existing FOSS parsing libraries to make a mathematical expression
parser instead of doing so from scratch, but it sounds like all of the
canned math parsers you know of are non-starters.
 
J

Jason Quinn

John said:
My own recommendation would be: if there's no free-as-in-speech library
to do what you want, roll your own. In this instance, you may be able to
use existing FOSS parsing libraries to make a mathematical expression
parser instead of doing so from scratch, but it sounds like all of the
canned math parsers you know of are non-starters.

Thanks everybody. I'm considering taking this route. I've been
reading about lexers and parsers lately and thinking it might not be so
hard to write my own parser using javacc. We'll see.

Jason Quinn
 
Joined
Dec 2, 2008
Messages
1
Reaction score
0
JbcParser Math Parser is a good choice.

For commercial software, JbcParser is good. It's simple, it does the job and has been around for a long time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top