Skip to main content

Using AI-Based Code Completion for Domain-Specific Languages

  • Conference paper
  • First Online:
Product-Focused Software Process Improvement (PROFES 2023)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 14483))

  • 411 Accesses

Abstract

Code completion is a very important feature of modern integrated development environments. Research has been done for years to improve code completion systems for general-purpose languages. However, only little literature can be found for (AI-based) code completion for domain specific languages (DSLs). A DSL is a special-purpose programming language tailored for a specific application domain. In this paper, we investigate whether AI-based state-of-the-art code completion approaches can also be applied for DSLs. This is demonstrated using the domain-specific language TTI (Thermal Text Input). TTI is used for power transformer design specification in an industrial context, where an existing code completion shall be replaced by an advanced machine learning approach. For this purpose, implementations of two code completion systems are adapted to our needs. One of them shows very promising results and achieves a top-5 accuracy of 97%. To evaluate the practical applicability, the approach is integrated into an existing editor of a power transformer manufacturer.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 79.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 99.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    https://www.tabnine.com.

  2. 2.

    https://copilot.github.com.

  3. 3.

    https://github.com/features/copilot.

  4. 4.

    https://www.tabnine.com.

  5. 5.

    https://www.deepmind.com/blog/competitive-programming-with-alphacode.

  6. 6.

    https://aws.amazon.com/de/codewhisperer.

  7. 7.

    https://www.jetbrains.com/mps.

  8. 8.

    https://www.eclipse.org/Xtext.

  9. 9.

    https://www.rascal-mpl.org.

  10. 10.

    https://github.com/software-competence-center-hagenberg/DSL-Code-Completion.

  11. 11.

    https://github.com/motykatomasz/Pythia-AI-code-completion.

  12. 12.

    https://docs.ray.io/en/latest/tune/index.html.

  13. 13.

    https://github.com/Microsoft/onnxruntime.

  14. 14.

    https://github.com/nietras/OnnxSharp.

  15. 15.

    https://www.jetbrains.com/dotmemory.

  16. 16.

    https://www.jetbrains.com/profiler.

References

  1. Bahdanau, D., Cho, K., Bengio, Y.: Neural machine translation by jointly learning to align and translate. arXiv, Computation and Language 1409 (2014)

    Google Scholar 

  2. Bruch, M., Monperrus, M., Mezini, M.: Learning from examples to improve code completion systems. In: Proceedings of the 7th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on The Foundations of Software Engineering, ESEC/FSE 2009, pp. 213–222. Association for Computing Machinery, New York (2009). https://doi.org/10.1145/1595696.1595728

  3. Chung, J., Gulcehre, C., Cho, K., Bengio, Y.: Empirical evaluation of gated recurrent neural networks on sequence modeling. In: NIPS 2014 Workshop on Deep Learning (2014)

    Google Scholar 

  4. Erdweg, S., et al.: The state of the art in language workbenches. In: Erwig, M., Paige, R.F., Van Wyk, E. (eds.) SLE 2013. LNCS, vol. 8225, pp. 197–217. Springer, Cham (2013). https://doi.org/10.1007/978-3-319-02654-1_11

    Chapter  Google Scholar 

  5. Franks, C., Tu, Z., Devanbu, P., Hellendoorn, V.: Cacheca: a cache language model based code suggestion tool. In: Proceedings of the 37th International Conference on Software Engineering, ICSE 2015, vol. 2, pp. 705–708. IEEE Press (2015). https://dl.acm.org/doi/10.5555/2819009.2819143

  6. Goodfellow, I.J., et al.: Generative adversarial nets. In: NIPS 2014, pp. 2672–2680. MIT Press, Cambridge (2014)

    Google Scholar 

  7. Hou, D., Pletcher, D.: Towards a better code completion system by API grouping, filtering, and popularity-based ranking. In: Proceedings of the 2nd International Workshop on Recommendation Systems for Software Engineering, RSSE 2010, pp. 26–30. Association for Computing Machinery, New York (2010)

    Google Scholar 

  8. Husain, H., Wu, H.H., Gazit, T., Allamanis, M., Brockschmidt, M.: CodeSearchNet challenge: evaluating the state of semantic code search. arXiv preprint arXiv:1909.09436 (2019)

  9. Jurafsky, D., Martin, J.H.: N-gram language models. In: Speech and Language Processing. Prentice-Hall Inc., Upper Saddle River (2009). https://web.stanford.edu/jurafsky/slp3/3.pdf. Accessed 08 Oct 2023

  10. Li, J., Wang, Y., King, I., Lyu, M.R.: Code completion with neural attention and pointer networks. In: Proceedings of the 27th International Joint Conference on Artificial Intelligence, IJCAI 2018, pp. 4159–4165. AAAI Press (2018). https://dl.acm.org/doi/10.5555/3304222.3304348

  11. Liaw, R., Liang, E., Nishihara, R., Moritz, P., Gonzalez, J.E., Stoica, I.: Tune: a research platform for distributed model selection and training. arXiv preprint arXiv:1807.05118 (2018)

  12. Mernik, M., Heering, J., Sloane, A.M.: When and how to develop domain-specific languages. ACM Comput. Surv. 37(4), 316–344 (2005). https://doi.org/10.1145/1118890.1118892

    Article  Google Scholar 

  13. Moritz, P., et al.: Ray: a distributed framework for emerging AI applications. In: Proceedings of the 13th USENIX Conference on Operating Systems Design and Implementation, OSDI 2018, pp. 561–577. USENIX Association, USA (2018). https://dl.acm.org/doi/10.5555/3291168.3291210

  14. Oriol Vinyals, M.F., Jaitly, N.: Pointer networks. In: Proceedings of the 28th International Conference on Neural Information Processing Systems, NIPS 2015, pp. 2692–2700. MIT Press, Cambridge (2015)

    Google Scholar 

  15. Pfeiffer, M., Pichler, J.: A comparison of tool support for textual domain-specific languages. In: Proceedings of the 8th OOPSLA Workshop on Domain-Specific Modeling, pp. 1–7. Citeseer (2008)

    Google Scholar 

  16. Pletcher, D.M., Hou, D.: BCC: enhancing code completion for better API usability. In: 2009 IEEE International Conference on Software Maintenance, pp. 393–394. IEEE (2009). https://doi.org/10.1109/ICSM.2009.5306289

  17. Raychev, V., Vechev, M., Yahav, E.: Code completion with statistical language models. In: ACM SIGPLAN Notices, PLDI 2014, vol. 49, pp. 419–428. Association for Computing Machinery, New York (2014). https://doi.org/10.1145/2666356.2594321

  18. Robbes, R., Lanza, M.: How program history can improve code completion. In: 2008 23rd IEEE/ACM International Conference on Automated Software Engineering, ASE 2008, pp. 317–326. IEEE Computer Society, USA (2008). https://doi.org/10.1109/ASE.2008.42

  19. Svyatkovskiy, A., Zhao, Y., Fu, S., Sundaresan, N.: Pythia: AI-assisted code completion system. In: Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, KDD 2019, pp. 2727–2735. Association for Computing Machinery, New York (2019). https://doi.org/10.1145/3292500.3330699

  20. Ziegler, A., et al.: Productivity assessment of neural code completion. In: Proceedings of the 6th ACM SIGPLAN International Symposium on Machine Programming, MAPS 2022, pp. 21–29. Association for Computing Machinery, New York (2022). https://doi.org/10.1145/3520312.3534864

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Christina Piereder .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2024 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Piereder, C., Fleck, G., Geist, V., Moser, M., Pichler, J. (2024). Using AI-Based Code Completion for Domain-Specific Languages. In: Kadgien, R., Jedlitschka, A., Janes, A., Lenarduzzi, V., Li, X. (eds) Product-Focused Software Process Improvement. PROFES 2023. Lecture Notes in Computer Science, vol 14483. Springer, Cham. https://doi.org/10.1007/978-3-031-49266-2_16

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-49266-2_16

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-49265-5

  • Online ISBN: 978-3-031-49266-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics