rebuild syntax tree for reduction