It's not necessary to write your own parser.
Java 6 has a scripting API, which you could use for this, as long as the expression is valid JavaScript (or any other supported scripting language). Example:
If you are not using Java 6, have a look at
BeanShell.