flow123d / bparser

A C++ library for parsing expressions with Python syntax and using SIMD for repetitive evaluation. Amortization of the interpreter overhead leads to nearly peak CPU performance..
GNU Lesser General Public License v3.0
3 stars 4 forks source link

Chained comparisons #14

Closed jbrezmorf closed 2 years ago

jbrezmorf commented 2 years ago

Implement chained comparisons: 0 < x < 1.

The chained expression

LEFT_OP rel_left MID_OP rel_right RIGHT_OP

is equivalent to:

(LEFT_OP rel_left MID_OP) and (MID_OP rel_right RIGHT_OP)

but the MID_OP has to be evaluated just once.

To implement this we need special support in transformation mechanism from AST to the expression DAG or we need reliable optimization to eliminate duplicate evaluation.

See branch JB_chained.

jbrezmorf commented 2 years ago

Done