skip to main content
10.1145/2997364.2997374acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article
Open Access

Principled syntactic code completion using placeholders

Published:20 October 2016Publication History

ABSTRACT

Principled syntactic code completion enables developers to change source code by inserting code templates, thus increasing developer efficiency and supporting language exploration. However, existing code completion systems are ad-hoc and neither complete nor sound. They are not complete and only provide few code templates for selected programming languages. They also are not sound and propose code templates that yield invalid programs when inserted.This paper presents a generic framework that automatically derives complete and sound syntactic code completion from the syntax definition of arbitrary languages. A key insight of our work is to provide an explicit syntactic representation for incomplete programs using placeholders. This enables us to address the following challenges for code completion separately: (i) completing incomplete programs by replacing placeholders with code templates, (ii) injecting placeholders into complete programs to make them incomplete, and (iii) introducing lexemes and placeholders into incorrect programs through error-recovery parsing to make them correct so we can apply one of the previous strategies. We formalize our framework and provide an implementation in the Spoofax Language Workbench.

References

  1. S. Amann, S. Proksch, S. Nadi, and M. Mezini. A study of visual studio usage in practice. In SANER, 2016.Google ScholarGoogle ScholarCross RefCross Ref
  2. P. Borras, D. Clément, T. Despeyroux, J. Incerpi, G. Kahn, B. Lang, and V. Pascual. CENTAUR: The system. In Proceedings of the third ACM SIGSOFT/SIGPLAN software engineering symposium on Practical software development environments, pages 14–24, New York, USA, 1988. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. M. de Jonge, L. C. L. Kats, E. Visser, and E. Söderberg. Natural and flexible error recovery for generated modular language environments. ACM Transactions on Programming Languages and Systems, 34(4):15, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. P. Degano and C. Priami. Comparison of syntactic error handling in LR parsers. Software: Practice and Experience, 25(6):657–679, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. S. Efftinge and M. Völter. oAW xText: A framework for textual DSLs. In Workshop on Modeling Symposium at Eclipse Summit, 2006.Google ScholarGoogle Scholar
  6. D. Harkes, D. M. Groenewegen, and E. Visser. IceDust: Incremental and eventual computation of derived values in persistent object graphs. In S. Krishnamurthi and B. S. Lerner, editors, 30th European Conference on Object-Oriented Programming, ECOOP 2016, July 18-22, 2016, Rome, Italy, volume 56 of LIPIcs. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2016.Google ScholarGoogle Scholar
  7. L. C. L. Kats and E. Visser. The Spoofax language workbench: rules for declarative specification of languages and IDEs. In W. R. Cook, S. Clarke, and M. C. Rinard, editors, Proceedings of the 25th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2010, pages 444–463, Reno/Tahoe, Nevada, 2010. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. P. Klint. A meta-environment for generating programming environments. ACM Trans. Softw. Eng. Methodol., 2(2):176– 201, Apr. 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. D. E. Knuth. Semantics of context-free languages. In In Mathematical Systems Theory, pages 127–145, 1968.Google ScholarGoogle ScholarCross RefCross Ref
  10. G. D. P. Konat, L. C. L. Kats, G. Wachsmuth, and E. Visser. Declarative name binding and scope rules. In K. Czarnecki and G. Hedin, editors, Software Language Engineering, 5th International Conference, SLE 2012, Dresden, Germany, September 26-28, 2012, Revised Selected Papers, volume 7745 of Lecture Notes in Computer Science, pages 311–331. Springer, 2012.Google ScholarGoogle Scholar
  11. J. Koorn. GSE: a generic text and structure editor. In University of Amsterdam, pages 168–177, 1992.Google ScholarGoogle Scholar
  12. L. Moonen. Generating robust parsers using island grammars. In WCRE, page 13, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. L. Moonen. Lightweight impact analysis using island grammars. In 10th International Workshop on Program Comprehension (IWPC 2002), 27-29 June 2002, Paris, France, pages 219–228. IEEE Computer Society, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. P. Neron, A. P. Tolmach, E. Visser, and G. Wachsmuth. A theory of name resolution. In J. Vitek, editor, Programming Languages and Systems - 24th European Symposium on Programming, ESOP 2015, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2015, London, UK, April 11-18, 2015. Proceedings, volume 9032 of Lecture Notes in Computer Science, pages 205–231. Springer, 2015.Google ScholarGoogle Scholar
  15. T. Reps and T. Teitelbaum. The synthesizer generator. SIGSOFT Softw. Eng. Notes, 9(3):42–48, Apr. 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. R. Robbes and M. Lanza. How program history can improve code completion. In 23rd IEEE/ACM International Conference on Automated Software Engineering (ASE 2008), 15-19 September 2008, L Aquila, Italy, pages 317–326. IEEE, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. M. M. Schrage. Proxima – a presentation-oriented editor for structured documents. PhD thesis, Utrecht University, The Netherlands, Oct 2004.Google ScholarGoogle Scholar
  18. M. Tomita. Efficient Parsing for Natural Language: A Fast Algorithm for Practical Systems. Kluwer Academic Publishers, Norwell, MA, USA, 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. H. van Antwerpen, P. Neron, A. P. Tolmach, E. Visser, and G. Wachsmuth. A constraint language for static semantic analysis based on scope graphs. In M. Erwig and T. Rompf, editors, Proceedings of the 2016 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, PEPM 2016, St. Petersburg, FL, USA, January 20 - 22, 2016, pages 49–60. ACM, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. E. Visser. Scannerless generalized-LR parsing. Technical Report P9707, Programming Research Group, University of Amsterdam, July 1997.Google ScholarGoogle Scholar
  21. E. Visser. Syntax Definition for Language Prototyping. PhD thesis, University of Amsterdam, September 1997.Google ScholarGoogle Scholar
  22. E. Visser. Program transformation with Stratego/XT: Rules, strategies, tools, and systems in Stratego/XT 0.9. In C. Lengauer, D. S. Batory, C. Consel, and M. Odersky, editors, Domain-Specific Program Generation, International Seminar, Dagstuhl Castle, Germany, March 23-28, 2003, Revised Papers, volume 3016 of Lecture Notes in Computer Science, pages 216–238. Springer, 2003.Google ScholarGoogle Scholar
  23. T. Vollebregt, L. C. L. Kats, and E. Visser. Declarative specification of template-based textual editors. In A. Sloane and S. Andova, editors, International Workshop on Language Descriptions, Tools, and Applications, LDTA ’12, Tallinn, Estonia, March 31 - April 1, 2012, page 8. ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. M. Völter. Language and IDE modularization and composition with MPS. In R. Lämmel, J. Saraiva, and J. Visser, editors, Generative and Transformational Techniques in Software Engineering IV, International Summer School, GTTSE 2011, Braga, Portugal, July 3-9, 2011. Revised Papers, volume 7680 of Lecture Notes in Computer Science, pages 383–430. Springer, 2011.Google ScholarGoogle Scholar
  25. M. Völter, D. Ratiu, B. Kolb, and B. Schaetz. mbeddr: Instantiating a language workbench in the embedded software domain. Journal of Automated Software Engineering, 2013.Google ScholarGoogle ScholarCross RefCross Ref
  26. M. Völter, J. Siegmund, T. Berger, and B. Kolb. Towards userfriendly projectional editors. In B. Combemale, D. J. Pearce, O. Barais, and J. J. Vinju, editors, Software Language Engineering - 7th International Conference, SLE 2014, Västeras, Sweden, September 15-16, 2014. Proceedings, volume 8706 of Lecture Notes in Computer Science, pages 41–61. Springer, 2014.Google ScholarGoogle Scholar

Index Terms

  1. Principled syntactic code completion using placeholders

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader