Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 429 Bytes

README.md

File metadata and controls

18 lines (14 loc) · 429 Bytes

PythonLogicParser

Parses a String to a Logic Abstract Syntax Tree.

from LParser import LogicParser

logic = "(x and (y or x)) or (o or (not (b and (a and a))))"
parser = LogicParser(logic)
tree = parser.tree

This tree has a standard node implementation with Node.node is "or" , "and", "not" or name_of_variable. For testing you could use

from Util import print_level_order
printLevelOrder(tree)