Convert AST to a Buffer to allow writing to disk.