Crate bex

source ·
Expand description

A crate for working with boolean expressions.


  • pub use crate::base::Base;
  • pub use crate::base::GraphViz;
  • pub use crate::nid::NID;
  • pub use crate::nid::I;
  • pub use crate::nid::O;
  • pub use crate::bdd::BddBase;


  • Structure for representing algebraic normal form (xor of ands).
  • Helper routines inspired by the APL family of programming languages.
  • Abstract syntax trees (simple logic combinators).
  • Standard trait for databases of boolean expressions.
  • A module for efficient implementation of binary decision diagrams.
  • Cursors (register + stack and scope) for navigating vhl-graphs (Bdd, Anf, etc)
  • Helpers for working with arrays of bit structures as if they were integers.
  • binary io for hashmap<String,NID> and typed vectors
  • Node IDs (shared by various Base implementations)
  • Tools for constructing boolean expressions using NIDs as logical operations.
  • Registers – arbitrarily large arrays of bits.
  • Simplification rules for simple boolean operations.
  • Solve ast-based expressions by converting to another form.
  • Swap Solver This solver attempts to optimize the BDD concept for substitution solving. It adjusts the input variable ordering by swapping adjacent inputs until the one to be replaced next is at the top of the BDD. The actual replacement work at each step then only involves the top three rows.
  • mini-framework for multicore programming.
  • (Var, Hi, Lo) triples
  • Variable IDs (used interally by Base implementations)
  • Generic Work-in-progress support for VHL graphs.


  • Macro for building complex expressions in a Base. example: expr![base, (x & y) | (y ^ z)]
  • This is a helper macro used by expr!
  • This macro makes it easy to define decorators for Base implementations. Define your decorator as a struct with type parameter T:Base and member base: T, then use this macro to implement the functions you don’t want to manually decorate.
  • This helper macro provides actual implementations for the names passed to inherit!