panthema / 2007 / stx-exparser / demo
Thumbnail of the wxParserDemo program

wxParserDemo - STX Expression Parser Demo Program


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

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.

Download Binaries

Pick the binary built on the operating system closest to your running system. Beware that the dynamically linked Linux binaries will only work on distributions with similar library naming rules.

wxParserDemo - STX Expression Parser Demo Program Version 0.7 (current) released 2007-07-17
Dynamically linked binary for
Download (964kb)
MD5: a744de14c8a5782df273bec1d8c43988
Dynamically linked binary built with g++ 4.1 for
Debian Linux 4.0 (Etch)
Ubuntu Linux 7.04 (Feisty Fawn)
and some recent RedHat and SuSE
Download stx-wxparserdemo-0.7-debian-etch-dynamic.tar.bz2 (978kb)
MD5: e5e8fbdc30ee9bd12052c43731829855
Dynamically linked binary built with g++ 3.3 for
Debian Linux 3.1 (Sarge)
and some older RedHat and SuSE
Download stx-wxparserdemo-0.7-debian-sarge-dynamic.tar.bz2 (1220kb)
MD5: bc8ef0da375f91df4f3d275440c5e0c4
Statically linked binary for
Debian Linux 3.1 (Sarge) with gtk+ 1.2
Download stx-wxparserdemo-0.7-debian-sarge-gtk1-static.tar.bz2 (2144kb)
MD5: a6a39feb251dc482fa2f579a650adb2d

The complete source code is released under the GNU General Public License v2 (GPL). It is included in the source tarball of the STX Expression Parser Framework.


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.

Thumbnail 1 of wxParserDemo

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.

Thumbnail 2 of wxParserDemo

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.

Thumbnail 5 of wxParserDemo

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.

Screenshot 3 of wxParserDemo Screenshot 4 of wxParserDemo