Welcome to the Parser Webpage!

What is it?

The Parser is a Java class developed by Pavel Safronov at MSTE of UIUC. It is designed to take any string expression ("2+3", "sin(pi/4)", "cos(x^2+y^2)/(x^2+y^2)*10"), and find its value. The Parser supports most commonly used functions and operations and is equipped to solve equations that would otherwise be too tedious, or too numerous, to attempt by hand.

What is it for?

The Parser was made to be used in the 3D Grapher (Under development as of January 30, 2004, completed June 17, 2004), but it can be used in a number of applications. Two such examples are the XY Grapher and the Polar Grapher. These examples are very rough and only up on this site as an example of the Parser's power, and nowhere near an example of what a finished applet is.

How does it work?

The Parser takes an expression that you supply, along with any constants and variables, and breaks it down into Reverse Polish Notation (RPN). While changing the expression into RPN, the Parser replaces all constants with their numeric values. The RPN set of instructions are then stored in a stack. When Evaluate is called, the stack is evaluated. Parsing the expression takes a much longer time than evaluating the RPN stack, since the Parser was designed with a grapher in mind, knowing that the function that explains the graph need only be parsed once and then evaluated a number of times with different variable values, so it is best suited for occasions where speed is imperative and the expressions that need to be evaluated are constant for the time that the Parser is needed.

How do we use it?

You don't. It's not ready yet.

Are there more applets on the way?

The 3D Grapher is now complete.

Here are some screenshots from inside the 3D Grapher.


History

June 17, 2004

3D Grapher applet complete
Website updated. New 3D Grapher pictures.

June 3, 2004

Minor website corrections and additions.

June 2, 2004

Removed the links to downloading the Parser.
Next updates to this site will include a link to an almost-complete version of the 3D Grapher.

Feb. 5, 2004

"Decimal mark" bug fixed. The Parser will accept ".0" or "0." or "0.0", and will return 0, but will return false from the Parse function if it encounters "." All the files on this site (the XY Grapher and the Polar Grapher) have been updated with the new Parser files.

Feb. 3 & 4, 2004

Bug found when trying to Parse/Evaluate an expression that contains lone decimal marks. Bug not yet fixed.
Spherical graphing integrated into the 3D Grapher. More styles on the way.
All Parser.class files on this site are not updated with the latest edition of the Parser. The next update will be after the "decimal mark" bug is fixed.

Feb. 1 & 2, 2004

Added "shortcut" versions of the functions Parse and Evaluate. You are now not required to specify constants, their values, and variables if your expression uses none.
Added quickEvaluate. Parses and evaluates the expression, returning the answer. Does not allow constants or variables. Perfect for quick evaluations inside and outside the Parser class.
Evaluate now allows the string representing the value of a constant to contain a "simple" expression ("2*pi", "sqrt(2)"). A "simple" expression is not allowed to use constants, other than pi and e, or variables, but can otherwise be as complex as necessary. The expression is evaluated using quickEval.
Parse now allows the same use while entering the value of a constant. Once again, only "simple" expressions.
Parser not released to the public, developed and updated while working on the 3D Grapher.

January 31, 2004

No updates to the Parser.
Website updated.

January 30, 2004

Started Parser webpage and history log.
Parser in final stages of development.
Bug with implicit negation fixed.
Added new function:
step(x): 0 if x < 0, 1 otherwise


Webpage last updated: June 17, 2004