摘要
为了检测出C/C++源代码程序中常见的运行时错误,设计了一个静态检测系统。该系统通过词法分析、语法分析、语义分析来获取程序的语法树。然后系统的检测程序将会分析语法树的每一个结点,判断结点中的属性信息是否存在错误。创新点在于语法树数据结构和检测程序的设计。通过检测程序对结点的属性值的分析,能够检测出C/C++源代码程序中出现的数组越界、指针错误、字符串函数错误,内存泄露等问题。
A static detection system is designed in order to detect C/C++ source codes that probably have several runtime errors.This system will change the source code into an AST through lexical analysis,syntax analysis and semantic analysis,and then the system will check every node of the AST and judge whether there are errors in the nodes.The innovation points are the design of AST date structure and checking program.With checking program's analysis to the values of nodes,it could find out some runtime errors such as array out of bound,storage overflow,memory leak and function errors.
出处
《电子设计工程》
2011年第12期28-31,共4页
Electronic Design Engineering