rewrite ast.pr to use range.
ast cloning works