STX Expression Parser provides a C++ framework, which can process user-specified expression strings containing program-specific variables. It can be integrated into applications to allow user-customized data selection and filtering.
The expresssion strings are intuitive SQL-like WHERE-clauses and can contain arbitrarily complex arithmetic. At the same time the parse tree evaluation speed is guaranteed to be fast enough to safely iterate over larger data sets. The framework uses the Boost.Spirit parser library combined with a versatile custom scalar value class.
The expression parser can process arbitrarily complex arithmetic expressions like those seen below. To access application-defined data, functions and variables may be included in the expression. An expression can be used as a boolean filter by using comparison and logic operators.
6 + 3 * 12
(a - 28) * (int)(e + 0.4 * 2.5 / (PI() - EXP(-0.644) * 4))
6 * 9 == 42
a >= 5 OR (42