Rule-based assignment of comments to AST nodes in C++ programs

  • Authors:
  • Tamás Cséri;Zalán Szügyi;Zoltán Porkoláb

  • Affiliations:
  • Eötvös Loránd University, Budapest, Hungary;Eötvös Loránd University, Budapest, Hungary;Eötvös Loránd University, Budapest, Hungary

  • Venue:
  • Proceedings of the Fifth Balkan Conference in Informatics
  • Year:
  • 2012

Quantified Score

Hi-index 0.00

Visualization

Abstract

Comments are essential components of programming languages: they preserve the developer's intentions, help the maintainers to understand hidden concepts, and may act as a source of automatic documentation generation. However most of the software maintenance tools (refactorers, slicing and analyser tools) ignore them therefore they lose an important part of information about the software. One of the reasons why tools neglect comments is that there is no single well-defined location in the software's AST where to place them. The relationship between the program's control structure and the comments depend on code conventions and human habits. Our research -- part of a project to develop a software maintenance tool -- focuses on the code comprehension process of large legacy C++ projects and heavily utilize code comments. We evaluated the commenting behaviour used in large projects and categorized the major patterns. We found that these patterns are strongly correlating in a single project. In the paper we present a method to find the correct place of the comments in the AST-based on project-specific rules. We evaluate our method and test it against open source C++ projects.