Memory Augmented Policy Optimization for Program Synthesis and Semantic Parsing