A truth table generator.
cmake . -Bbuild
cmake --build build
To build unit tests, turn on the BUILD_TESTING
option:
cmake . -Bbuild -DBUILD_TESTING=ON
ttgen
reads logical expressions from stdin
and writes corresponding truth tables to stdout
until EOF
. Tokens in the input expressions are case-sensitive. All logical operators should be uppercased. To generate a truth table with more than one expression, enter these expressions on a single line, separating them with ;
. Parentheses can be used to override the default evaluation. Empty input lines are ignored. Multiple whitespace characters are treated as a single one. Leading and trailing whitespaces have no effect.
Operator | Precedence | Arity | Associativity |
---|---|---|---|
NOT | 1 | 1 | right-to-left |
AND | 2 | 2 | left-to-right |
OR | 3 | 2 | left-to-right |
XOR | 4 | 2 | left-to-right |
IMPLY | 5 | 2 | right-to-left |
XNOR | 6 | 2 | right-to-left |