计算机科学 ›› 2015, Vol. 42 ›› Issue (Z6): 516-518.

• 软件工程与数据库技术 • 上一篇    下一篇

简化GCC抽象语法树的新型算法

田冰川,孙珂,巢汉青   

  1. 南京航空航天大学计算机科学与技术学院 南京211100,南京航空航天大学计算机科学与技术学院 南京211100,南京航空航天大学计算机科学与技术学院 南京211100
  • 出版日期:2018-11-14 发布日期:2018-11-14
  • 基金资助:
    本文受中央高校基本科研业务费专项资金资助

New Algorithm of Simplifying GCC Syntax Tree

TIAN Bing-chuan, SUN Ke and CHAO Han-qing   

  • Online:2018-11-14 Published:2018-11-14

摘要: 抽象语法树是程序源代码的树状表现形式,在代码分析与特征提取过程中发挥着重要作用。GCC可以导出C语言源程序的抽象语法树文件,但其中包含大量冗余信息与无关信息,不利于上述工作的展开。针对此问题,提出一种简化GCC抽象语法树的算法,在保持语法树基本结构完整的前提下,移除其中与源程序无直接关联的节点,以线性时间复杂度重建语法树文件,达到简化的目的。

Abstract: Abstract syntax tree(AST) is tree representation of program source code,which plays a significant role in code analysis and feature extraction process.GCC can help to export the AST file in the source program of C language,which however contains a large amount of redundant information and irrelevant information that will exert a negative influence on the accomplishment of relevant tasks.To address this problem,a simplified GCC AST algorithm was presented to remove the nodes irrelevant to source program and rebuild AST file by means of linear time complexity based on a complete basic structure of AST for the sake of simplification.

Key words: GCC,Syntax tree,Simplification,Algorithm,C language

[1] 吴楠.基于GCC的缓冲区溢出检测研究[D].哈尔滨:哈尔滨工程大学,2010
[2] 赵彦博.基于抽象语法树的程序代码抄袭检测技术研究[D].呼和浩特:内蒙古师范大学,2010
[3] 张良德,赵彦博.一种基于GCC抽象语法树的程序特征提取方法[J].电子技术与软件工程,2013(20):269-270
[4] 江梦涛,荆琦.C语言静态代码分析中的调用关系提取方法[J].计算机科学,2014,1(6A):442-444
[5] Option Summary[EB/OL].(2013-10-16) [2014-11-10].http://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/Option-Summary.html
[6] 杨昌坤,许庆国.C程序控制流程模型的提取技术与实现[J].计算机科学,2014,1(5):208-214
[7] 李鑫,王甜甜,苏小红,等.消除GCC抽象语法树文本中冗余信息的算法研究[J].计算机科学,2008,5(10):170-172
[8] Deitel P,Deitel H.C语言大学教程(第六版)[M].苏小红,等译.北京:电子工业出版社,2012

No related articles found!
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!