GWTJep JavaScript expression parser/evaluator.
GWTJep is the JavaScript version of the Jep mathematical parsing and evaluation library. It is cross-compiled from Java using the Google Web Toolkit (GWT).
With this package you can take formulas as strings, and instantly evaluate them. Many common mathematical functions and constants are built-in and ready to use. But in addition, you can extend GWTJep with your own user defined variables, constants, and functions.
It has most of the features of the main Jep library apart from a small set of changes necessary for JavaScript compatibility.
There are several ways of using GWTJep in a web-page.
GWT applications
GWTApp: Java classes can be written using the Jep library and GWT's set of UI widgets, corresponding to standard HTML elements. The cross-compiled JavaScript can then be included in a web-page with the widgets inserted into the DOM. An example usage is shown
Input | ||
Output |
The usage is described in GWTApp page. In this method the bulk of the code is written in Java with minimal JavaScript and a simple method for including in a web page. Most features of Jep are available in from the Java classes.
Console application
The Console application demonstrates most of the feature of Jep in an interactive console. Other examples include:
- GWTFunctionPlot function plotter on the SingSurf website.
Exposure through JNSI
GWTExpose: exposes a limited set of Jep features so they can be called from JavaScript using the GWT's JavaScript Native Interface.
Exposure through JsInterop
GWTInterop: limited set of classes are exposed to JavaScript which can create Jep instances. This uses the GWT's JsInterop annotations.
Java Doc
Future developments
A number of developments are planned for the next release
- Ability of use functions written in JavaScript to be used as mathematical function in Jep.
- Enhanced set of methods exposed through JSNI/JsInterop:
- Inspect node trees.
- Construct nodes
- Construct custom parsers
- Add custom function
- Add example plotting application
- Add Jep Extensions classes
- Improve functionality of the compatibility classes
Trial version and License
The trial version is limited to 50 calls to the Jep.parse()
method.
As the GWT system effectively requires the source code, the full version require a source code release of
the Jep Java 4.0 Source code + Binary license. See the Jep order page.
Copyright 2022 Singularsys.com