摘要
抽象语法树(AST)作为程序的一种中间表示形式,在程序分析等诸多领域有广泛的应用。传统的建立AST的方法是通过词法和语法分析的方法。该文提出了一种利用GCC前端结果建立AST的方法,这种方法将GCC编译源程序产生的AST文件,经过一定的格式转换变为XML文档,然后使用XML文档解析器读取该文档,重新建立AST。
As an intermediate representation of source programs ,abstract syntax trees(AST)has been used widely in many fields,such as programming analysis.Traditionally,AST is built through lexical and syntax analysis.In this paper,a method is presented for building AST through result of GCC's front end.The key technology is translating AST files dumped by GCC into XML documents through some transform,and then paring XML documents by XML parser to re-build AST.
出处
《计算机工程与应用》
CSCD
北大核心
2004年第18期125-128,共4页
Computer Engineering and Applications
基金
国家部委资助项目