Working up tree data structure for string evaluation