Metadata-Version: 1.1
Name: ttable
Version: 0.5.0
Summary: A library and command-line tool for working with Boolean expressions
Home-page: http://tt.bwel.ch
Author: Brian Welch
Author-email: welch18@vt.edu
License: MIT
Description: Synopsis

        --------

        

        tt is a Python library and command-line tool for working with Boolean expressions. Please check out the `project site`_ for more information.

        

        Installation

        ------------

        

        tt is tested on CPython 2.7, 3.3, 3.4, 3.5, and 3.6 as well as PyPy. tt is written in pure Python with no dependencies, so it only requires a compatible Python installation to run. You can get the latest release from PyPI with::

        

            pip install ttable

        

        Basic Usage

        -----------

        

        Below are a couple of examples to show you the kind of things tt can do. For more examples and further documentation, take a look at the `project site`_.

        

        As a Library

        ````````````

        

        tt aims to provide a Pythonic interface for working with Boolean expressions. Here are some simple examples from the REPL::

        

            >>> from tt import BooleanExpression, TruthTable

            >>> b = BooleanExpression('A xor (B and 1)')

            >>> b.tokens

            ['A', 'xor', '(', 'B', 'and', '1', ')']

            >>> b.symbols

            ['A', 'B']

            >>> print(b.tree)

            xor

            `----A

            `----and

                 `----B

                 `----1

            >>> b.evaluate(A=True, B=False)

            True

            >>> t = TruthTable(b)

            >>> print(t)

            +---+---+---+

            | A | B |   |

            +---+---+---+

            | 0 | 0 | 0 |

            +---+---+---+

            | 0 | 1 | 1 |

            +---+---+---+

            | 1 | 0 | 1 |

            +---+---+---+

            | 1 | 1 | 0 |

            +---+---+---+

            >>> t = TruthTable('A or B', fill_all=False)

            >>> print(t)

            Empty!

            >>> t.fill(A=0)

            >>> print(t)

            +---+---+---+

            | A | B |   |

            +---+---+---+

            | 0 | 0 | 0 |

            +---+---+---+

            | 0 | 1 | 1 |

            +---+---+---+

            >>> t.fill(A=1)

            >>> print(t)

            +---+---+---+

            | A | B |   |

            +---+---+---+

            | 0 | 0 | 0 |

            +---+---+---+

            | 0 | 1 | 1 |

            +---+---+---+

            | 1 | 0 | 1 |

            +---+---+---+

            | 1 | 1 | 1 |

            +---+---+---+

        

        From the Command Line

        `````````````````````

        

        tt also provides a command-line interface for working with expressions. Here are a couple of examples::

        

            $ tt tokens "(op1 nand op2) xnor op3"

            (

            op1

            nand

            op2

            )

            xnor

            op3

        

            $ tt table A or B

            +---+---+---+

            | A | B |   |

            +---+---+---+

            | 0 | 0 | 0 |

            +---+---+---+

            | 0 | 1 | 1 |

            +---+---+---+

            | 1 | 0 | 1 |

            +---+---+---+

            | 1 | 1 | 1 |

            +---+---+---+

        

            $ tt tree A or or B

            Error! Unexpected binary operator "or":

            A or or B

                 ^

        

        

        License

        -------

        

        tt uses the `MIT License`_.

        

        

        .. _MIT License: https://opensource.org/licenses/MIT

        .. _project site: http://tt.bwel.ch

        
Platform: UNKNOWN
Classifier: Environment :: Console
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Utilities
