by MathMonkeyMan · 2y ago · 0 comments
How about we do a similar thing for ASTs? Like a peephole optimizer looking for runs of instructions that could be substituted for simpler alternatives, a tree diff could identify diff patterns that "might be trivial." You have a whole catalog of these patterns, and assign to each a weight. Then the displayed diff is the optimal set of choices "consider different or not?"
You would need some additional ingredient, though; some boundary condition. Otherwise "everything is the same" would always minimize badness.