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.
Setup
- Use
cargo buildto build the project - Use
cargo testto run the tests -To run the project, use the command:
Examples
Roadmap
- Validate brackets
- Validate terms (only numbers, variables, variable with subindex)
- Validate Logical Operators (and, or, not, implies, iff)
- Read a logical proposition
- Tokenize the proposition
- Parse the proposition (validate)
- 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
note for me: use cargo publish to publish the crate