Crate prec

Source
Expand description

A crate to enable easy use of the precedence climbing algorithm. You plug your own handler function, token struct, and operator enum, and this crate provides the algorithm.

Because the crate is sufficiently generic, It’s possible to add very complex behavior without having to roll your own algorith. the int_math example demonstrates adding parenteses that respect ordering.

The relationships between the required structures you provide are enforced by std library traits, which will let your structures play well with your existing code base.

Structs§

Climber
A struct containing the order of operations rules and a pointer to a handler function.
Expression
A faithful, always-valid representation of an expression.
Rule
A single operator and an Assoc

Enums§

Assoc
Used within a Rule to indicate the left/right association of an operator.

Traits§

Token