Leveraging Code to Improve In-context Learning for Semantic Parsing