Abstract:With the continuous evolution of the C++ language standard, lexical parsing tools such as JavaCC cannot fully support many expanded new features and complex grammatical structures, which may lead to incorrect and incomplete abstract syntax tree generation. Aiming at this problem, a framework for processing errors generated by abstract syntax trees is proposed. First, through the expansion of JavaCC, a set of lexical parsers that can parse C++ language are implemented, generate abstract syntax trees and record error lines; secondly, look for grammatical fragments that are not supported or do not match in the function range according to the error line; finally , By annotating function intervals, skip unsupported or unmatched grammar fragments for error handling and iteratively generate an abstract syntax tree. The experimental results show that the code can be analyzed more comprehensively after the error processing of the abstract syntax tree generation. The abstract syntax tree completion rate increased by 37.8%, and the number of analysis lines increased by 3.9 times.