Abstract:In the field of software engineering, code completion is one of the most useful technologies in the integrated development environment (IDE). It improves the efficiency of software development and becomes an important technology to accelerate the development of modern software. Prediction of class names, method names, keywords, and so on, through code completion technology, to a certain extent, improves code specifications and reduces the work intensity of programmers. In recent years, the development of artificial intelligence promotes the development of code completion. In general, smart code completion uses the source code training network to learn code characteristics from the corpus, and makes recommendations and predictions based on the context code characteristics of the locations to be completed. Most of the existing code feature representations are based on program grammar and do not reflect the semantic information of the program. The network structure currently used is still not capable of solving long-distance dependency problems when facing long code sequences. Therefore, this study proposes a method to characterize codes based on program control dependency and grammar information, and considers code completion as an abstract grammar tree (AST) node prediction problem based on time convolution network (TCN). This network models can learn the grammar and semantic information of the program better, and can capture longer-range of dependencies. This method has been proven to be about 2.8% more accurate than existing methods.