> This set of Java classes allows parsing mathematical expression, that
> may be used from Java programs. Suitable use for this utlity include
> graphing tools, calculators, etc
>
> Download for free at http://www.britishcomputercolleges.com/prog/java/parser2.html
Perhaps I'm just a suspicious sort of person, but I'm not
exactly avid to dump some unknown person's precompiled classes
into my JRE ...
FWIW, I've written a similar sort of thing. It accepts a
wider class of expressions, but has no provision for complex
arithmetic. Also, mine compiles the expression to class byte
codes and loads them, so they're executed directly by the JVM
and are eligible to be JIT-compiled. If anyone's interested,
drop me a note and I'll send back the source.

Signature
Eric.Sosman@sun.com
Dexter - 20 Mar 2008 22:47 GMT
> > This set of Java classes allows parsing mathematical expression, that
> > may be used from Java programs. Suitable use for this utlity include
[quoted text clipped - 15 lines]
> --
> Eric.Sos...@sun.com
Eric! You work at Sun and I work at home mostly killing time.
The programming skill I have may be ranked in minor league
Asad
Stefan Ram - 20 Mar 2008 23:00 GMT
>arithmetic. Also, mine compiles the expression to class byte
With the compiler-tool classes from the JDK, Java expressions
can be compiled at run-time. An example how to do this:
http://www.purl.org/stefan_ram/pub/evaluating-expressions-with-java
Eric Sosman - 21 Mar 2008 02:43 GMT
>> arithmetic. Also, mine compiles the expression to class byte
>
> With the compiler-tool classes from the JDK, Java expressions
> can be compiled at run-time. An example how to do this:
>
> http://www.purl.org/stefan_ram/pub/evaluating-expressions-with-java
Will those classes work if only a JRE (no JDK) is
installed? I skimmed their documentation and it seemed
to me that a pure JRE environment would not support them;
was I wrong? (If so, I expended some needless effort --
but I learned a good deal about bytecode along the way.)

Signature
Eric Sosman
esosman@ieee-dot-org.invalid
Stefan Ram - 21 Mar 2008 03:36 GMT
>>With the compiler-tool classes from the JDK, Java expressions
>>can be compiled at run-time. An example how to do this:
>> http://www.purl.org/stefan_ram/pub/evaluating-expressions-with-java
>Will those classes work if only a JRE (no JDK) is installed?
IIRC, they will not work without a JDK. That's why I wrote
»from the JDK« as quoted above.
This is similar to the SQL implementation.
I am actually saddened by the omission of both features from
the JRE. It would be great if one would be able to rely on an
SQL implementation and a Java compiler everywhere where there
is a JRE.
An SQL implementation would be useful for ... (I do not need
to explain this here).
With a Java compiler, one could use Java for Java scripting.
For example, in a Java editor, power users could write the
Editor's macros in Java itself, being able to use all of Javas
features.
Eric Sosman - 21 Mar 2008 03:40 GMT
>>> With the compiler-tool classes from the JDK, Java expressions
>>> can be compiled at run-time. An example how to do this:
[quoted text clipped - 3 lines]
> IIRC, they will not work without a JDK. That's why I wrote
> »from the JDK« as quoted above.
Thanks; that's what I thought. I wanted a class that
would work with a "no frills" JRE, so I decided not to
rely on the Compiler machinery.
> This is similar to the SQL implementation.
>
> I am actually saddened by the omission of both features from
> the JRE. It would be great if one would be able to rely on an
> SQL implementation and a Java compiler everywhere where there
> is a JRE.
Yes. I imagine it would make the Java download somewhat
larger, but if it's not *too* much larger it would be a
worthwhile addition.

Signature
Eric Sosman
esosman@ieee-dot-org.invalid
Arne Vajhøj - 22 Mar 2008 02:54 GMT
>>>> With the compiler-tool classes from the JDK, Java expressions
>>>> can be compiled at run-time. An example how to do this:
[quoted text clipped - 7 lines]
> would work with a "no frills" JRE, so I decided not to
> rely on the Compiler machinery.
Java 1.6 support the ScriptEngine with JavaScript - JavaScript
has this nice eval function and JavaScript is very inspired by
Java when it comes to math. Very easy solution !
Arne