bet 0.3.1

Helps parsing and evaluating binary expression trees
Documentation

MIT Latest Version docs Chat on Miaou

A library building and preparing expressions, for example boolean expressions such as (A | B) & !(C | D | E), which can be executed on dynamic contents.

An expression is built by calling the push_operator, open_par, close_par and push_atom functions.

It can then be evaluated with the eval function which takes as parameters

  • a function which gives a value to an atom
  • a function which, given an operator and one or two values, gives a new value
  • a function deciding whether to short-circuit

Normal evaluation order is left to right but is modified with parenthesis.

Defining features:

  • performances
  • ability to separate building, transformations, and evaluation, so that an expression can be efficiently applied on millions of inputs

Usage and documentation: docs.rs/bet

If you wonder whether bet could be applied to your problems, don't hesitate to come and discuss. If you know a documented crate with overlapping use cases, tell me too so that I may list it here as alternative.