- JavaDoc

# JEP

- Introduction
- Basic Usage
- Variables
- Data types
- Operators
- Functions
- BigDecimal
- FAQ
- Migration
- Version History

# Advanced Features

- Manipulating Expressions
- Components
- Configurable Parser
- Serialization
- Grammar

# Version History

## Version 3.2 (released 2008/02/12)

General Changes:

- Added support for expression tree analysis using TreeAnalyser
- Fixed errors in the documentation of the default configuration
- Improved the operator table

Changes to the configurable parser:

- New StandardConfigurableParser class
- Parse error reporting with line and column numbers
- Added support for hexadecimal numbers (e.g. `0x1F`)
- Added support for bitwise operators (bitwise or: `a | b`, bit shifting `a << 2`) in BitwiseOperatorTable
- Added support for `a?b:c`, `x+=1`, `++x` syntax
- Added support for case-insensitive operators
- Added support for multiple expressions separated by semicolons
- Added support for multiple dimensional array access (`a[1][1]` accesses the first element of a two-dimensional array)
- Fixed issues with escape characters
- Fixed power and unary minus precedence to be consistent with the standard parser ("-3^2" should equal -9)

## Version 3.1 (released 2007/09/22)

- Added serialization support
- Fixes bug prohibiting adding alphabetic operators to the configurable parser (such as AND)
- Added short circuit logical operator evaluation for && and || to speed up evaluation
- Added `avg`, `min`, and `max` functions
- Makes use of new Java 1.5 Math functions `log10`, `sinh`, `cosh`, `tanh`, and `hypot`
- Added StrictNaturalLogarithm which returns `NaN` for negative reals rather than complex.
- Fixed mistake in the Basic Usage section of the documentation

## Version 3.0 (released 2007/07/01)

- Added RealEvaluator for fast evaluation of expressions not containing strings, arrays or complex numbers
- Added BigDecComponents for high precision calculations using BigDecimal numbers
- New component architecture (pluggable parser, evaluator, and more)
- Added new configurable parser (allows alternate syntax)
- Added expression printing capabilities to the Jep class
- Added new functions: round, floor, ceil, lg (log base 2)
- Major package restructuring
- No longer available under the GPL license
- Changed error handling from hasError() function to exception throwing
- Switched from JavaCC 3.2 to JavaCC 4.0
- Switched compatibility from Java 1.2 to Java 1.5
- Switched from JUnit 3 to JUnit 4.1
- See Migration on how to smoothly upgrade from a previous version

## Version 2.4.1 (released 2007/04/25)

- Added rounding functions round, ceil, and floor
- Fixed bug [ 1563324 ] getValueAsObject always returns null after an error
- Fixed bug [ 1670974 ] String to double <= comparison message incorrect
- Fixed bug [ 1706295 ] Wrong error output when evaluating variables

## Version 2.4.0 (released 2006/04/01)

- Evaluator now switchable to allow null variable values.
- SymbolTable can now tell java.util.observers when new variables are created.
- Changes in Error handling
- New functions binom(n,i) binomial coeffs, conj(z) - complex conjugate
- Added anti aliasing to Function Plotter applet
- Fixed bug 1177557: log(NaN) returns Complex(NaN,NaN) instead of NaN
- Fixed bug 1061200: Null Pointer in Parser when using non Default constructor

## Version 2.3.1 (released 2006/01/27)

- Fixed bug 1046349: bug in sum()
- Fixed broken links in documentation
- Fixed bug 1051988: JEPTester falsely reports "No errors"
- Fixed documentation error 1358815: if - function is documented wrong
- Added more tests for sum function
- Updated build.xml to work with 1.5 JVMs

## Version 2.3.0 (released 2004/10/03)

- Switched from Java 1.1 compatibility to 1.2 compatibility
- Documentation updates
- Fixed batch script issues from beta 2

## Version 2.3.0 beta 2 (released 2004/09/03)

- 2004/09/11: Renamed angle() function to atan2()
- 2004/04/12: New functions if, str, complex, polar.
- 2004/04/12: The ^ operator is now overloaded to be the cross product for 3D vectors as well as power.
- 2004/04/12: Various changes by Richard Morris (see DJEP Version History)
- 2003/08/15: Added new evaluation method that more than doubles evaluation performance
- 2003/08/15: Renamed addComplexVariable() and addVariableAsObject() to addVariable(). Now all three methods for adding different types of variables are named the same.
- 2003/08/10: Improved error handling and reporting in EvaluatorVisitor.

Known Issues:

- Windows batch scripts for starting the examples are broken. This is due to switching from the MS JVM to the Sun appletviewer. Planned to be fixed for the 2.3.0 release.

## Version 2.24 (released 2002/12/31)

- 2002/12/25: Fixed "not replacing escape sequences in strings" bug

## Version 2.23 (released 2002/08/03)

- 2002/07/01: Started adding Number support to JEP class and functions
- 2002/07/08: Fixed string concatenation bug
- 2002/07/10: Added NumberFactory class and DoubleNumberFactory (with option for custom NumberFactory in JEP constructor)
- 2002/08/02: Added website documents to distribution

## Version 2.22 (released 2002/07/04)

- 2002/06/06: Removed symbol table information from ASTVarNode (making AST nodes into pure data structure elements)
- 2002/06/20: Fixed sum() issue (functions with variable number of parameters)
- 2002/06/24: Rearranged function class structure by letting PostfixMathCommand implement PostfixMathCommandI (no changes to functionality)
- 2002/06/25: Added multiple thread testing classes
- 2002/06/26: Made EvaluatorVisitor non-singleton (was doing more harm than good)
- 2002/06/28: Added Unicode character support for variable names

## Version 2.21 (released 2002/06/04)

- 2002/06/03: Fixed 1.1 compatibility issue in JEP.java (was using add() and clear() which are not included in the 1.1.8 VM).

## Version 2.20 (released 2002/05/31)

- 2002/01/20: Combined multiplication and division to the same precedence level
- 2002/03/10: Added implicit multiplication, allowing expressions like "3x == 3*x"
- 2002/03/14: Improved evaluation performance through creating only one stack for evaluation
- 2002/03/19: Changes to operator precedence (more like C and Java)
- 2002/03/19: Now using JavaCC 2.1
- 2002/03/24: Added a console application to the org.nfunk.jepexamples package
- 2002/03/28: Implemented evaluation using the Visitor design pattern
- 2002/04/13: Added setAllowUndeclared() and setImplicitMul() for control of undeclared variables, and implicit multiplication options
- 2002/04/15: Added getSymbolTable() for obtaining list of variables in the symbol table (e.g. after parsing an expression with allowUndeclared=true)
- 2002/04/17: Prepared directory structure for building with ant
- 2002/04/19: Full transition of build environment to ant
- 2002/04/20: Finally was persuaded to add the sqrt() function to the set of built-ins
- 2002/04/27: Cleaned up error reporting using an error list in the JEP class
- 2002/05/27: New documentation
- 2002/05/30: Modifications to the sample applets

## Version 2.12 (released 2002/02/01)

- 2001/08/31: Made a change to the Complex power function Complex.pow(to avoid problems with applets run in Internet Explorer (Math.exp(-Infinity) was not producing 0.0)
- 2001/09/10: Started working on array type
- 2001/09/20: Allowed variable number of arguments in functions
- 2001/09/20: Fixed undetected syntax error bug involving a comma before a list of function parameters
- 2001/10/17: Changed order of precedence for power and unary signs. Now power is of higher order than unary plus or minus
- 2001/11/10: Tweaked complex power functions
- 2001/11/10: Added error reporting for exceptions that occur while evaluating
- 2001/11/17: Edited the parser class to work without static function and symbol tables
- 2001/12/21: Completed the JEPTester class for verifying correct evaluation
- 2002/01/06: Replaced some Vector operations that relied on AbstractList with Java 1.1 compliant code

## Version 2.11

- 2001/08/26: Substituted the Netlib complex number class with a custom class

## Version 2.10

- 2001/07/07: Finished adding complex numbers, and incorporated complex numbers in nearly all built in functions
- 2001/07/08: Added string handling with concatenation with the + operator and comparison with ==
- 2001/07/16: Renamed the package to org.nfunk.jep
- 2001/08/24: Bugfix - subtraction of complex numbers was not working properly

## Version 2.05

- 2001/03/21: Fixed PostfixMathCommand class to allow inheritance to classes in other packages
- 2001/04/10: Added some error reporting functions to main interface class (Error name and position)
- 2001/06/01: Finished adding hyperbolic trigonometric functions and packaging.

## Version 2.04

- 2001/03/01: Fixed EOF problem (included EOF in grammar)
- 2001/03/16: Removed a few redundant exception classes

## Version 2.03

- 2001/02/17: Corrected order of precedence for logical operators
- 2001/02/17: Added '&&', '||', and '!' operators to extend the logical functionality of the parser
- 2001/02/07: Disabled the default command line output. For debugging purposes, you may want to try to use setTraverse(true)

## Version 2.0

- 2000/10/16: Started rebuilding the whole parser with JavaCC (http://www.webgain.com/products/java_cc/)
- 2000/10/27: Completed restructuring main background parser functions in JavaCC
- 2000/11/17: Created a simple interface class for intuitive interaction
- 2000/12/10: Added a few logical operators
- 2001/01/06: Released the freshly rebuilt parser

## Version 1.1

- 2000/11/30: Changed order of precedence so division occurs before multiplication
- 2000/10/01: Added exponential notation (i.e. 1.23e-3)
- 2000/10/16: Tweaked code here and there
- 2000/10/21: Finished new sample applet
- 2000/10/21: Repackaged and reorganized all source code and classes

## Version 1.0

- 2000/07/03: Added more documentation
- 2000/07/10: Removed all operator nodes such as MulNode or PlusNode, and replaced them by using FunNode nodes with PostfixMathCommands
- 2000/08/07: Considering using JavaCC to recreate the Parser
- 2000/09/01: Fixed multiple subtraction problem. Now 1-2-3 = (1-2)-3 instead of 1-(2-3)

## Version 0.3

- 2000/06/01: Created Web page and posted it
- 2000/06/02: Edited Web page, added one variable field just for integers
- 2000/06/06: Started adding internal code documentation
- 2000/06/09: Figured out how to create objects at run-time with the reflection package. Probably useful for future use of user defined functions
- 2000/06/10: Finished adding capability of parsing standard functions as well as user defined functions (thanks to Ross Bagely)

## Version 0.2

- 2000/06/18: Added SharedConstants class for the parser package
- 2000/06/18: Added InvalidExpressionException class which is thrown inside Parser
- 2000/06/19: Tweaked the error report of Parser
- 2000/06/27: Simplified process of adding user defined functions by adding a parent class PostfixMathCommand, that contains a function for checking the stack passed to the command
- 2000/06/27: Extended the FunNode class to be able to handle functions with multiple arguments, needs to be implemented in the parser yet
- 2000/07/01: Completed expanding parser to handle functions with multiple arguments. Implemented angle function to return the angle whose tangent is equal to the ratio of the arguments x/y (using the Math.atan2 method).