Demo wxWidgets Application: wxParserDemo

The wxParserDemo application is a user-friendly graphical user interface to demonstrate the STX Expression Parser's functions.

It is located in the source package beneath the directory wxparserdemo.

The demo allows the user to enter an expression string and press "Evaluate" to run the parser over it. If the expression could be parsed and evaluated correctly, the result's value and type are displayed. Otherwise an error message is shown. The demo also has a data input grid to specify variables, which can be used in the expression.

The demo program uses the cross-platform wxWidgets toolkit and can be compiled on Linux, Windows and MacOSX.

Some binary executables for Linux and Windows can be downloaded from http://idlebox.net/2007/stx-exparser/demo.htt

Short Demo Usage By Example

The demo application has one large expression input field in the upper half of the dialog. The given expression can be parsed and evaluated by pressing "Evaluate". These results are printed in the "Result" tag, which automatically gets activated.

wxparserdemo1.png

The "Result" tab is separated into two parts: the upper group box contains the resulting parse tree converted back to a string; or the syntax error if the expression is invalid. The re-stringified expression usually contains more brackets than your input expression. It is generated by the toString() function of stx::ParseNode or stx::ParseTree.

The lower part of the "Result" tab shows the evaluation result, if it could be computed. Both type and value of the resulting AnyScalar are displayed. If the tree could not be evaluated, e.g. if an undefined variable was used, then the exception message is shown.

wxparserdemo2.png

The "XML Tree" tab contains Boost.Spirit's debug XML output. It shows in detail which Spirit rules are used to compose the parse tree.

wxparserdemo5.png

The demo applications allows input expressions to use variable names. The (non-standard) variables set before evaluating a parse tree are shown in the grid input on the "Variables" tab. They can be set by entering data into the grid. Lines with empty names are ignored.

wxparserdemo3.png
wxparserdemo4.png


Generated on Tue Jul 17 16:51:58 2007 for STX Expression Parser by  doxygen 1.5.2