bin+lib truthful

A logical expression parser, optimizer and evaluator

2 releases

0.1.1 Dec 17, 2022
0.1.0 Dec 17, 2022

#1172 in Math

MIT/Apache

37KB
1K SLoC

Truthful

crates.io Documentation License

A logical expression parser, optimizer and evaluator.

$ cargo run
welcome! enter ? for help
> a or (a and b)
evaluating "a"
 a  eval
 0   0
 1   1
> !a v b
evaluating (!"a" v "b")
 a  b  eval
 0  0   1
 0  1   1
 1  0   0
 1  1   1
> q
bye!

TODO

  • Grammar operator precedence.
  • Actual optimization (the current one is a bunch of NAND + DeMorgan naive transformations).

Dependencies

~9–19MB
~280K SLoC