AutoCom: Automatic Comment Generation for C Code

Zhikang Tian · Proceedings/Proceedings of the ... International Conference on Software Engineering and Knowledge Engineering · 2021

Code comments improve program comprehension and program maintenance.However, the lack of comments is a common problem in industry.It is time-and manpower-consuming to add comments for large code bases.Thus, it is desirable to develop techniques for automatic comment generation.Previous works for automatic comment generation use deep learning or machine learning techniques.These techniques require a large amount of training data which is often unavailable or hard to acquire.This paper proposes a light-weight approach called AutoCom for automatic comment generation.In AutoCom, we first analyze the source code to extract key information.Then, we use the extracted information to search and filter for appropriate text from a large programming Question and Answer (Q&A) site.Lastly, we use NLP techniques to convert the search result into code comments.In addition to the generated code comment, we also add predefined comments for library function usage in the source code.With AutoCom as the back-end, we built a web service which allows the user to upload source code and get it commented.

Read the paper · More papers on PaperTik