This repository has been archived by the owner on Jul 10, 2024. It is now read-only.
Releases: leoprover/tptp-parser
Releases · leoprover/tptp-parser
Python3 Release of 0.0.0.2
See README.md
, test_run.py
in tptp-parser-python3-0.0.0.2.zip
for a working example.
The Python3 target of version 0.0.0.2 is supporting:
- simple THF-parsing
ast = tptp_parser.parse(argv[1])
- access childs, print nodes, print node-types:
print(ast)
print(ast[0])
print(ast[0].typeString())
- child iteration:
for n in ast:
print(n)
- a simple parse-tree iteration
for n in tptp_parser.traverse(ast):
do stuff with n
- simple filtered parse-tree iteration
for n in tptp_parser.traverse(ast, filter=tptp_parser.nodetype.thf_binary_formula):
do stuff with n
- render a parse tree
tptp_parser.tree(ast)
- a filtered tree render
tptp_parser.tree(ast, filter=tptp_parser.nodetype.thf_binary_formula)
- modify a specific child of the ast
n[0] = tptp_parser.node('*F')
- modify the ast during traversal
for n in tptp_parser.traverse(ast, filter=tptp_parser.nodetype.thf_binary_formula):
n[0] = tptp_parser.node('*N')
n.addLeft(tptp_parser.node('*F')) # add terminal node at front
n.addChild(1, tptp_parser.node('*P')) # add terminal node at index 1, shift nodes right of the node to the right
n.addRight(tptp_parser.node('*B')) # add terminal node at end
tptp_parser.tree(ast, filter=tptp_parser.nodetype.thf_binary_formula)
Python3 Release of 0.0.0.1
See README.md
, test_run.py
in tptp-parser-python3-0.0.0.1.zip
for a working example.
The Python3 target of version 0.0.0.1 is supporting:
- simple THF-parsing
ast = tptp_parser.parse(argv[1])
- access childs, print nodes, print node-types:
print(ast)
print(ast[0])
print(ast[0].typeString())
- child iteration:
for n in ast:
print(n)
- a simple parse-tree iteration
for n in tptp_parser.traverse(ast):
do stuff with n
- simple filtered parse-tree iteration
for n in tptp_parser.traverse(ast, filter=tptp_parser.nodetype_thf_binary_formula):
do stuff with n
- render a parse tree
tptp_parser.tree(ast)
- a filtered tree render
tptp_parser.tree(ast, filter=tptp_parser.nodetype_thf_binary_formula)