Using obscure graph theory to solve programming languages problems

38 matt_d 4 5/13/2025, 8:09:54 PM reasonablypolymorphic.com ↗

Comments (4)

tekknolagi · 5h ago
This seems, at least upon first read, analogous to global value numbering (GVN). Or, depending on how you look at it, common subexpression elimination (CSE). I am mostly wondering why they are not mentioned in the article.
kldx · 24m ago
Wondered about the same thing. Perhaps the author deals with graphs with no side effects or branches? It would then trivially become CSE on a single basic block.

SSA transformations are essentially equivalent to what the author appears to be doing in terms of let-bindings [0].

[0] https://dl.acm.org/doi/10.1145/278283.278285

j2kun · 3h ago
I came here to mention this as well. If this problem was so critical to the company the author was working at, it seems negligent to spend a _year_ reinventing a solved problem from scratch, especially given the author's apparent history of compiler experience.
georgewsinger · 4h ago
If you like reasoning about a program in terms of expression trees/graphs, I recently discovered that Wolfram Language has built-ins for this:

https://reference.wolfram.com/language/ref/ExpressionTree.ht...