Expression
This is a simple recursive parser for Expressions. It tries to
follow the standards of gnu expr, but does not understand regular
expressions. I found it usefull to have a lightwight replacement for
the gnu.expr.Parser to use with java code.
The code is free
software. Its easy use from java code: Just call: public
static synchronized boolean
de.herberlin.util.Expr.parse(java.lang.String) throws
de.herberlin.util.ExprException. The parser returns true if the
given expression results to true, else false, and throws exception if
it can't be parsed.
A main() - method is implemented so you can use the parser at the
command line or within stream, althought you might find better things
for that. Example: echo 3*3==9 | java -jar Expr.jar
returns true.
This is a little applet that shows how the parser works:
Expression is part of herberlin Bremsserver.
|