Path context augmented statement and network for learning programs

Published: 01 Jan 2022, Last Modified: 13 Nov 2024Empir. Softw. Eng. 2022EveryoneRevisionsBibTeXCC BY-SA 4.0
Abstract: Applying machine learning techniques in program analysis has attracted much attention. Recent research efforts in detecting code clones and classifying code have shown that neural models based on abstract syntax trees (ASTs) can better represent source code than other approaches. However, existing AST-based approaches do not take into account contextual information of a program, like statement context. To address this issue, we propose a novel approach path context to capture the context of statements, and a path context augmented network (PCAN) to learn a program. We evaluate PCAN on code clone detection, source code classification, and method naming. The results show that compared to state-of-the-art approaches, PCAN performs the best on code clone detection and has comparable performance on code classification and method naming.
Loading