def Dump(tree):
    for t in tree:
        DumpNode(t, 0)


def DumpNode(node, indent, drawBranches=1):
    print '%s' % node[0]
    indent = indent + 1
    for child in node[1:]:
        if type(child) == type(()):
            if drawBranches:
                print '|  ' * indent + '+  non-terminal: ',
            else:
                print '  ' * indent + 'non-terminal: ',
            DumpNode(child, indent)
        else:
            if drawBranches:
                print '|  ' * indent + '   terminal: %s' % (repr(child))
            else:
                print '  ' * indent + 'terminal: %s' % (repr(child))

