Add visitor callback to AST printing