skip to main content
research-article

Synthesizing Java expressions from free-form queries

Published: 23 October 2015 Publication History

Abstract

We present a new code assistance tool for integrated development environments. Our system accepts as input free-form queries containing a mixture of English and Java, and produces Java code expressions that take the query into account and respect syntax, types, and scoping rules of Java, as well as statistical usage patterns. In contrast to solutions based on code search, the results returned by our tool need not directly correspond to any previously seen code fragment. As part of our system we have constructed a probabilistic context free grammar for Java constructs and library invocations, as well as an algorithm that uses a customized natural language processing tool chain to extract information from free-form text queries. We present the results on a number of examples showing that our technique (1) often produces the expected code fragments, (2) tolerates much of the flexibility of natural language, and (3) can repair incorrect Java expressions that use, for example, the wrong syntax or missing arguments.

References

[1]
M. Allamanis and S. Charles. Mining Source Code Repositories at Massive Scale using Language Modeling. In Conf. Mining Software Repositories. IEEE, 2013.
[2]
AnyCode Source Code. https: //github.com/tihomirg/nlpcoder/tree/noola, 2015.
[3]
BitBucket. BitBucket repository hosting service, https://bitbucket.org/, 2015.
[4]
M. Bruch, M. Monperrus, and M. Mezini. Learning from examples to improve code completion systems. In ESEC/SIGSOFT FSE, pages 213–222, 2009.
[5]
R. Burkard, M. Dell’Amico, and S. Martello. Assignment Problems. Society for Industrial and Applied Math., 2009.
[6]
S. Chatterjee, S. Juvekar, and K. Sen. SNIFF: A search engine for java using free-form queries. In FASE, pages 385–400, 2009.
[7]
A. Cozzie and S. T. King. Macho: Writing programs with natural language and examples. Technical report, University of Illinois at Urbana-Champaign, 2012.
[8]
M.-C. de Marneffe, B. MacCartney, and C. D. Manning. Generating typed dependency parses from phrase structure parses. In LREC, pages 449–454, 2006.
[9]
Eclipse Code Recommenders. http://www.eclipse.org/recommenders/, 2015.
[10]
EclipseJDT. EclipseJDT, http://www.eclipse.org/jdt/, 2015.
[11]
C. Fellbaum. WordNet: An Electronic Lexical Database. Bradford Books, 1998.
[12]
J. Galenson, P. Reames, R. Bod´ık, B. Hartmann, and K. Sen. Codehint: Dynamic and interactive synthesis of code snippets. In ICSE, pages 653–663, 2014.
[13]
GitHub. GitHub repository hosting service, https://github.com/, 2015.
[14]
T. Gvero and V. Kuncak. Interactive synthesis using free-form queries. In International Conference on Software Engineering, Demo Papers (ICSE Demo), 2015.
[15]
T. Gvero, V. Kuncak, and R. Piskac. Interactive synthesis of code snippets. In Computer Aided Verification (CAV) Tool Demo, 2011.
[16]
T. Gvero, V. Kuncak, I. Kuraj, and R. Piskac. Complete completion using types and weights. In PLDI, pages 27–38, 2013.
[17]
M. Harman, Y. Jia, and W. B. Langdon. Babel pidgin: SBSE can grow and graft entirely new functionality into a real world system. In SSBSE Challenge Track, 2014.
[18]
R. Holmes and G. C. Murphy. Using structural context to recommend source code examples. In ICSE, 2005.
[19]
D. Jurafsky and J. H. Martin. Speech and Language Processing. Prentice Hall, 2 edition, 2008.
[20]
H. W. Kuhn. The Hungarian method for the assignment problem. Naval Research Logistics Quart., 2:83–97, 1955.
[21]
V. Le, S. Gulwani, and Z. Su. Smartsynth: Synthesizing smartphone automation scripts from natural language. In MobiSys, 2013.
[22]
G. Little and R. C. Miller. Keyword programming in Java. In ASE, pages 84–93, 2007.
[23]
H. Liu and H. Lieberman. Metafor: Visualizing stories as code. In IUI, pages 305–307, 2005.
[24]
C. D. Manning, M. Surdeanu, J. Bauer, J. Finkel, S. J. Bethard, and D. McClosky. The Stanford CoreNLP natural language processing toolkit. In ACL, pages 55–60, 2014.
[25]
A. Mishne, S. Shoham, and E. Yahav. Typestate-based semantic code search over partial programs. In OOPSLA, pages 997–1016, 2012.
[26]
D. Price, E. Riloff, J. L. Zachary, and B. Harvey. NaturalJava: A natural language interface for programming in Java. In IUI, pages 207–211, 2000.
[27]
V. Raychev, M. T. Vechev, and E. Yahav. Code completion with statistical language models. In PLDI, page 44, 2014.
[28]
S. P. Reiss. Semantics-based code search. In ICSE, 2009.
[29]
N. Sahavechaphan and K. Claypool. Xsnippet: mining for sample code. In OOPSLA, 2006.
[30]
SourceForge. SourceForge source code repository, http://sourceforge.net/, 2015.
[31]
K. T. Stolee, S. Elbaum, and D. Dobos. Solving the search for source code. ACM TOSEM, 23:26:1–26:45, June 2014.
[32]
S. Thummalapenta and T. Xie. PARSEWeb: a programmer assistant for reusing open source code on the web. In ASE, 2007.
[33]
K. Toutanova, D. Klein, C. D. Manning, and Y. Singer. Feature-rich part-of-speech tagging with a cyclic dependency network. In HLT-NAACL, 2003.

Cited By

View all
  • (2023)Context-Encoded Code Change Representation for Automated Commit Message GenerationInternational Journal of Software Engineering and Knowledge Engineering10.1142/S021819402350049334:01(185-202)Online publication date: 16-Sep-2023
  • (2023)Learning the Relation Between Code Features and Code Transforms With Structured PredictionIEEE Transactions on Software Engineering10.1109/TSE.2023.327538049:7(3872-3900)Online publication date: 1-Jul-2023
  • (2023)Monolingual, multilingual and cross-lingual code comment classificationEngineering Applications of Artificial Intelligence10.1016/j.engappai.2023.106485124:COnline publication date: 1-Sep-2023
  • Show More Cited By

Index Terms

  1. Synthesizing Java expressions from free-form queries

    Recommendations

    Comments

    Please enable JavaScript to view thecomments powered by Disqus.

    Information & Contributors

    Information

    Published In

    cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 50, Issue 10
    OOPSLA '15
    October 2015
    953 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2858965
    • Editor:
    • Andy Gill
    Issue’s Table of Contents
    • cover image ACM Conferences
      OOPSLA 2015: Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications
      October 2015
      953 pages
      ISBN:9781450336895
      DOI:10.1145/2814270
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 23 October 2015
    Published in SIGPLAN Volume 50, Issue 10

    Check for updates

    Author Tags

    1. Autocompletion
    2. Natural Language Processing
    3. Program Repair
    4. Program Synthesis

    Qualifiers

    • Research-article

    Funding Sources

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)10
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 13 Sep 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2023)Context-Encoded Code Change Representation for Automated Commit Message GenerationInternational Journal of Software Engineering and Knowledge Engineering10.1142/S021819402350049334:01(185-202)Online publication date: 16-Sep-2023
    • (2023)Learning the Relation Between Code Features and Code Transforms With Structured PredictionIEEE Transactions on Software Engineering10.1109/TSE.2023.327538049:7(3872-3900)Online publication date: 1-Jul-2023
    • (2023)Monolingual, multilingual and cross-lingual code comment classificationEngineering Applications of Artificial Intelligence10.1016/j.engappai.2023.106485124:COnline publication date: 1-Sep-2023
    • (2022)Interactive NLU-Powered Ontology-Based Workflow Synthesis for FAIR Support of HPC2022 IEEE/ACM International Workshop on HPC User Support Tools (HUST)10.1109/HUST56722.2022.00009(29-40)Online publication date: Nov-2022
    • (2022)Enabling Near Real-Time NLU-Driven Natural Language Programming through Dynamic Grammar Graph-Based Translation2022 IEEE/ACM International Symposium on Code Generation and Optimization (CGO)10.1109/CGO53902.2022.9741262(278-289)Online publication date: 2-Apr-2022
    • (2021)Deep NLP-based co-evolvement for synthesizing code analysis from natural languageProceedings of the 30th ACM SIGPLAN International Conference on Compiler Construction10.1145/3446804.3446852(141-152)Online publication date: 2-Mar-2021
    • (2021)TransRegexProceedings of the 43rd International Conference on Software Engineering10.1109/ICSE43902.2021.00111(1210-1222)Online publication date: 22-May-2021
    • (2021)Data-Driven Synthesis of Provably Sound Side Channel AnalysesProceedings of the 43rd International Conference on Software Engineering10.1109/ICSE43902.2021.00079(810-822)Online publication date: 22-May-2021
    • (2021)A Context-based Automated Approach for Method Name Consistency Checking and SuggestionProceedings of the 43rd International Conference on Software Engineering10.1109/ICSE43902.2021.00060(574-586)Online publication date: 22-May-2021
    • (2021)The Recurrent Neural Network for Program SynthesisDigital Technologies and Applications10.1007/978-3-030-73882-2_8(77-86)Online publication date: 26-Jun-2021
    • Show More Cited By

    View Options

    Get Access

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media