Nice! This is what pulls apart the pre and post filters, right? If I'm reading it correctly, It only traverses through AND conjunctions. I think there are cases of OR which could be handled by pre filters, though. Note that visitors can keep state as they traverse (based on the parameterized type of the visitor class). Also, it's pretty easy to track in the visitor if a node is a top level node - take a look at the ExpressionCompiler#isTopLevel() function and the nodeLevel member variable. That maybe helpful