parsed tree sorter