summaryrefslogtreecommitdiff
path: root/prolog/parser.py
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2015-11-04 13:31:15 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2015-12-10 14:10:04 +0100
commitc3955d1ea0d0ad83baad6d4911e21ed4fc3be701 (patch)
tree335f69dd084b41be0bd05e6b82f2656ed6fb6a34 /prolog/parser.py
parentc7ce88a12ad4469642aaad0a4ad675769d6aa591 (diff)
Support Tree objects in python.util.stringify
Diffstat (limited to 'prolog/parser.py')
-rw-r--r--prolog/parser.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/prolog/parser.py b/prolog/parser.py
index 4e52a35..0c539d5 100644
--- a/prolog/parser.py
+++ b/prolog/parser.py
@@ -16,7 +16,7 @@
from nltk import Tree
import ply.yacc as yacc
-from .lexer import operators, tokens
+from .lexer import tokens
from .util import Token
# PARSER
@@ -183,6 +183,7 @@ def p_error(t):
parser = yacc.yacc(debug=False)
if __name__ == '__main__':
+ from .util import stringify
while True:
try:
s = input('> ')
@@ -191,4 +192,4 @@ if __name__ == '__main__':
if not s:
continue
ast = parser.parse(s)
- print(repr(ast))
+ print(stringify(ast))