skip to main content
10.1145/2371316.2371381acmotherconferencesArticle/Chapter ViewAbstractPublication PagesbciConference Proceedingsconference-collections
short-paper

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

Published:16 September 2012Publication History

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.

References

  1. Clang. http://clang.llvm.org/.Google ScholarGoogle Scholar
  2. Libre Office. http://www.libreoffice.org/.Google ScholarGoogle Scholar
  3. LLVM. http://llvm.org/.Google ScholarGoogle Scholar
  4. Mozilla Firefox. http://www.mozilla.org/en-US/firefox.Google ScholarGoogle Scholar
  5. V8 JavaScript Engine. http://code.google.com/p/v8/.Google ScholarGoogle Scholar
  6. VirtualBox. https://www.virtualbox.org/.Google ScholarGoogle Scholar
  7. I. F. Darwin. Java Cookbook. O'Reilly, Sebastopol, CA, 2004.Google ScholarGoogle Scholar
  8. A. Köhler. Der C/C++-Projektbegleiter. dpunkt.verlag, 69115 Heidelberg, 2007.Google ScholarGoogle Scholar
  9. E. T. Ray. Learning XML. O'Reilly, Sebastopol, CA, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. P. Sommerlad, G. Zgraggen, T. Corbat, and L. Felber. Retaining comments when refactoring code. In Companion to the 23rd ACM SIGPLAN conference on Object-oriented programming systems languages and applications, OOPSLA Companion '08, pages 653--662, New York, NY, USA, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. G. Sridhara, L. Pollock, and K. Vijay-Shanker. Generating parameter comments and integrating with method summaries. In Program Comprehension (ICPC), 2011 IEEE 19th International Conference on, pages 71--80, june 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. B. Stroustrup. The C++ Programming Language Special Edition. Addison-Wesley, Reading, MA, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. L. Tan, D. Yuan, G. Krishna, and Y. Zhou./* icomment: bugs or bad comments? */. SIGOPS Oper. Syst. Rev., 41:145--158, October 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. L. Tan, Y. Zhou, and Y. Padioleau. acomment: mining annotations from comments and code to detect interrupt related concurrency bugs. In Proceeding of the 33rd International Conference on Software Engineering, ICSE '11, pages 11--20, New York, NY, USA, 2011. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

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

      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
      • Published in

        cover image ACM Other conferences
        BCI '12: Proceedings of the Fifth Balkan Conference in Informatics
        September 2012
        312 pages
        ISBN:9781450312400
        DOI:10.1145/2371316

        Copyright © 2012 ACM

        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 ACM 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: 16 September 2012

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • short-paper

        Acceptance Rates

        Overall Acceptance Rate97of250submissions,39%

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader