Java expression parser (extensive)


On this page you find the source code for an expression parser written with Java. It is a console program and supports all common mathematical features. Furthermore, you can assign your own variables and functions. The project is written using Eclipse, the most well known Java IDE. The parser works in two steps: first, the expression string is parsed into an object tree. Next, the object tree is evaluated and the results are returned.

To run the program, you can run one of the provided batch files, or you can enter java -jar Parser.jar on a command line.


The features of the expression parser are:


You can download the source code and binaries below. (133kB)


As Java programs can be run on various platforms, you can execute the program on Windows, Linux, or Macintosh. Here is a screenshot taken on Ubuntu.



Jos de Jong
September 2010