Pragmatic Apparatus – Pragmatic Code Autocomplete

Cited by Lee Sonogan


Abstract by Gabriel Poesia, Noah Goodman

Human language is ambiguous, with intended meanings re- covered via pragmatic reasoning in context. Such reliance on context is essential for the efficiency of human communica-tion. Programming languages, in stark contrast, are defined by unambiguous grammars. In this work, we aim to make pro-gramming languages more concise by allowing programmers to utilize a controlled level of ambiguity. Specifically, we al-low single-character abbreviations for common keywords and identifiers. Our system first proposes a set of strings that can be abbreviated by the user. Using only 100 abbreviations, we observe that a corpus of Python code can be compressed by 15%, a number that can be improved even further by special-izing the abbreviations to a particular code base. We then use a contextualized sequence-to-sequence model to rank poten-tial expansions of inputs that include abbreviations. In an of-fline reconstruction task our model achieves accuracies rang-ing from 93% to 99%, depending on the programming lan-guage and user settings. The model is small enough to run
on a commodity CPU in real-time. We evaluate the usability of our system in a user study, integrating it in Microsoft VS-Code, a popular code text editor. We observe that our system performs well and is complementary to traditional autocom-plete features.

Publication: Department of Computer Science, Stanford University

Pub Date: 2021 Doi:

Keywords: Pragmatic Code, Autocomplete (Plenty more sections and references in this article)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.