Skip to content

Tudor230/WFFParser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


WFFPARSER

❯ A Python-based parser for Well-Formed Formulas (WFF) in propositional logic.

license last-commit repo-top-language repo-language-count


Table of Contents


Overview

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.


Features

  • 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.

Project Structure

WFFParser/
	├── LICENSE
	├── README.md
	├── ShuntingYard.py
	├── formula_converter.py
	├── lexer.py
	├── math.py
	├── predicate.py
	├── resolver.py
	└── wff.py

Getting Started

Prerequisites

Before getting started with WFFParser, ensure your runtime environment meets the following requirements:

  • Programming Language: Python 3.x
  • Dependencies: anytree, itertools, ply

Installation

Install WFFParser using one of the following methods:

Build from source:

  1. Clone the WFFParser repository:

    ❯ git clone https://github.com/Tudor230/WFFParser
  2. Navigate to the project directory:

    cd WFFParser
  3. Install the project dependencies (use pip):

    ❯ pip install anytree
    ❯ pip install ply

Usage

For propositional logic:

  1. Run the wff.py file.
  2. Choose an option by entering the corresponding number and follow the on-screen prompts to input logical formulas.

For predicate logic:

  1. Modify the data variable to test different logical or mathematical expressions.
  2. Run the math.py file.

License

This project is protected under the MIT License. For more details, refer to the LICENSE file.


Acknowledgments

  • Thanks to the developers of anytree for providing a robust tree structure implementation.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages