Mining Patterns in Source Code Using Tree Mining Algorithms
Discovering regularities in source code is of great interest to software engineers, both in academia and in industry, as regularities can provide useful information to help in a variety of tasks such as code comprehension, code refactoring, and fault localisation. However, traditional pattern mining algorithms often find too many patterns of little use and hence are not suitable for discovering useful regularities. In this paper we propose FREQTALS, a new algorithm for mining patterns in source code based on the FREQT tree mining algorithm. First, we introduce several constraints that effectively enable us to find more useful patterns; then, we show how to efficiently include them in FREQT. To illustrate the usefulness of the constraints we carried out a case study in collaboration with software engineers, where we identified a number of interesting patterns in a repository of Java code.
KeywordsPattern mining Frequent tree mining Source code regularities
This work was conducted in the context of an industry-university research project between UCLouvain, Vrije Universiteit Brussel and Raincode Labs, funded by the Belgian Innoviris TeamUp project INTiMALS (2017-TEAM-UP-7).
- 4.Allamanis, M., Sutton, C.: Mining idioms from source code. In: Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 472–483. ACM (2014)Google Scholar
- 6.Tempero, E., et al.: The qualitas corpus: a curated collection of java code for empirical studies. In: 2010 17th AsiaPacific Software Engineering Conference, pp. 336–345. IEEE (2010)Google Scholar
- 8.Mens, K., Tourwé, T.: Delving source code with formal concept analysis. Comput. Lang. Syst. Struct. 31(3–4), 183–197 (2005)Google Scholar
- 9.Lozano, A., Kellens, A., Mens, K., Arevalo, G.: Mining source code for structural regularities. In: Proceedings of the 2010 17th Working Conference on Reverse Engineering, pp. 22–31. IEEE Computer Society (2010)Google Scholar
- 10.Bhatia, S., Singh, R.: Automated correction for syntax errors in programming assignments using recurrent neural networks. arXiv preprint arXiv:1603.06129 (2016)