Intuitive Interface
NexCode is a conversational and visual interface for generating source code, authoring it, and deploying it to a cloud service. Generated programs are expected to respect a “realistic” relationship between programs and labels, as exemplified by a corpus of labeled programs available during training. Two challenges in such conditional program generation are that generated programs must satisfy a rich set of syntactic and semantic constraints and that source code contains many low-level features that impede learning. We address these issues by training a neural generator not on code but on program sketches, or patterns of program syntax that abstract names and operations that do not generalize across programs. During generation, we infer a posterior distribution over the sketches, and then concretize samples from this distribution into type-safe programs using combinatorial techniques. We implement our ideas in a system for generating API-rich Java or Python code and show that it can often predict the entire body of a method given only a few API calls or data types that appear in the method.