Design and Implementation of Lexical and Syntax Analysis Tool CParser for C Language
Shaojun YANG,Xiaohong SU,Tiantian WANG,Peijun MA
DOI: https://doi.org/10.3969/j.issn.2095-2163.2014.05.020
2014-01-01
Abstract:Program analysis techniques contains control flow analysis,data flow analysis,alias analysis,program slicing techniques and program instrumentation,and has important applications in program comprehension,code refactoring,code optimization,automated software debugging and other aspects. Especially,the lexical analysis and syntax analysis technology is the basis for program analysis techniques. This paper designs and implements a new C language syntax analysis tool named CParser,through three steps which are lexical analysis,preprocessing and syntax analysis to achieve the establishment of the abstract syntax tree based on the source code. This tool is easy to use,and can fully support the C99 standard,furtherly can be used to code clone detection and fault localization.