apply node-rewriting in repn()