Source code

This page briefly describes the contents of the source files.

Parser.java
The class Parser is the core of the expression parser. This class contains the code required for parsing a string containing a mathematical expression, and evaluating the contents. This class contains a main routine, so you can run this class from a command line by entering "java Parser"

Functions.java
These files contain two mathematical functions which are not pre-defined in Java, and therefore had to be written by hand: factorial and sign.

Error.java
When an error occurs when parsing an expression, an error of class Error is thrown. All possible error messages are stored in the class Error, to make it easy to extend the parser to support multiple languages. All errors have a unique number.