Logic Traces is a simple crate that reads a logical proposition and interprets it to build the truth table and the AST of the proposition.
Makes use of regular expressions are used to validate the input and to tokenize the proposition.
Also implements the Shunting Yard Algorithm (not yet) to build the AST.
s
Examples
Check the examples direcotry to see how to use the crate.
Roadmap
- Validate Input Tokens (only valid tokens)
- Variables (only letters)
- Logical Operators (and, or, not, implies, iff)
- Mathematical Operators (add, sub, mul, div, pow)
- Terms (only numbers, variables, variable with subindex)
- Read a logical proposition
- Tokenize the proposition
- Parse the proposition (make sure it is valid)
- Build the AST (Shunting Yard Algorithm) (use postfix notation)
- Solve proposition (evaluate the AST)
- Add good looking output (truth table, ast, function, etc.)
- Reduce a proposition to its simplest form (boolean algebra)
Bonus (if I have time)
- Validate mathematical operators (add, sub, mul, div, pow)
- Add MathPropositions support (examples, tests, etc.)
License
This project is licensed under the terms of the MIT license