Skip to content

TwoSolutions/PythonLogicParser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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)

Releases

No releases published

Packages

No packages published

Languages