java mathematical expression parsers

Discussion in 'Java' started by Jason Quinn, Jan 9, 2007.

  1. Jason Quinn

    Jason Quinn Guest

    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
     
    Jason Quinn, Jan 9, 2007
    #1
    1. Advertising

  2. Jason Quinn wrote:
    > 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

    --
    TechBookReport Java - http://www.techbookreport.com/JavaIndex.html
     
    TechBookReport, Jan 9, 2007
    #2
    1. Advertising

  3. Jason Quinn

    Guest

    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
     
    , Jan 9, 2007
    #3
  4. 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
     
    Patricia Shanahan, Jan 9, 2007
    #4
  5. Patricia Shanahan wrote:
    > 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


    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.

    --
    TechBookReport Java - http://www.techbookreport.com/JavaIndex.html
     
    TechBookReport, Jan 9, 2007
    #5
  6. wrote:
    > 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.
     
    John Ersatznom, Jan 15, 2007
    #6
  7. Jason Quinn

    Jason Quinn Guest

    John Ersatznom wrote:
    > 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
     
    Jason Quinn, Jan 16, 2007
    #7
  8. Jason Quinn

    goodyboo

    Joined:
    Dec 2, 2008
    Messages:
    1
    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.
     
    goodyboo, Dec 2, 2008
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    16
    Views:
    1,024
    Chris Uppal
    Apr 6, 2006
  2. Daniel Bickett
    Replies:
    3
    Views:
    515
    Paul McGuire
    Oct 20, 2004
  3. John Hunter
    Replies:
    0
    Views:
    362
    John Hunter
    Oct 20, 2004
  4. Replies:
    11
    Views:
    814
  5. Romeo Kienzler
    Replies:
    0
    Views:
    520
    Romeo Kienzler
    Jul 30, 2009
Loading...

Share This Page