compile an ast to a render function