❯ A Python-based parser for Well-Formed Formulas (WFF) in propositional logic.
The WFFParser is a Python-based parser designed to analyze and evaluate well-formed formulas (WFF) in propositional logic. It utilizes a tree structure to represent logical expressions, enabling straightforward evaluation and validation.
- Parsing Logic: Parses logical expressions, including unary (¬) and binary (∧, ∨, ⇒, ⇔) operations.
- Tree Representation: Represents parsed expressions as a tree, allowing for easy traversal and evaluation.
- Validity Checking: Determines if the given logical formula is valid, satisfiable, or unsatisfiable.
- Truth Table Generation: Generates a truth table for the evaluated formula.
- User-Friendly Output: Provides clear console outputs during parsing and evaluation to assist users in understanding the process.
WFFParser/
├── LICENSE
├── README.md
├── ShuntingYard.py
├── formula_converter.py
├── lexer.py
├── math.py
├── predicate.py
├── resolver.py
└── wff.pyBefore getting started with WFFParser, ensure your runtime environment meets the following requirements:
- Programming Language: Python 3.x
- Dependencies:
anytree,itertools,ply
Install WFFParser using one of the following methods:
Build from source:
-
Clone the WFFParser repository:
❯ git clone https://github.com/Tudor230/WFFParser
-
Navigate to the project directory:
❯ cd WFFParser -
Install the project dependencies (use pip):
❯ pip install anytree ❯ pip install ply
For propositional logic:
- Run the
wff.pyfile. - Choose an option by entering the corresponding number and follow the on-screen prompts to input logical formulas.
For predicate logic:
- Modify the data variable to test different logical or mathematical expressions.
- Run the
math.pyfile.
This project is protected under the MIT License. For more details, refer to the LICENSE file.
- Thanks to the developers of
anytreefor providing a robust tree structure implementation.