walk and transform ASTs with references to parent nodes