Associative/list nodes for SymbolLang #130
Replies: 2 comments 2 replies
-
This would definitely make the users life easier, but it makes the e-matcher's life much harder. Consider you have a bunch of pluses somewhere in the egraph: I totally agree that this is a great feature, but baking in associativity is hard. It turns E-matching into AE-matching (A=associativity, E=equality). People have also done research on ACE-matching (C=commutativity). My current understanding is that these are really hard, but I'd love it if we could figure them out in an efficient way! |
Beta Was this translation helpful? Give feedback.
-
This all makes sense. For posterity, my current solution is to explicitly add associativity with rules, and rely on the
And it works well enough so far. |
Beta Was this translation helpful? Give feedback.
-
It would be very nice if SymbolLang's patterns supported nodes with varying arity, which represent associative operators in the abstract syntax. It would remove the need for rules which re-associate parentheses, and make peephole optimizers a little simpler.
I imagine that the main reason to not bother doing this is that it has roughly the same computational cost as explicit parenthesis management rules.
Beta Was this translation helpful? Give feedback.
All reactions