varied字符串c语言,C语言源代码分析建模算法研究.doc

C语言源代码分析建模算法研究

本科学生毕业设计

C语言源代码分析建模算法研究

系部名称: 数学系

专业班级:信息与计算科学B05-75班

学生姓名: 王亚伟

指导教师: 聂大陆

职 称: 副教授

黑 龙 江 工 程 学 院

二○○九年六月

The Graduation Design for Bachelor's Degree

C Language Source Code Analysis Modeling Algorithm

Candidate:Wang Yawei

Specialty:Information and Computing Science

Class:B05-75

Supervisor:Associate Prof. Nie Dalu

Heilongjiang Institute of Technology

2009-06·Harbin

摘  要

本文针对源代码的函数调用关系,结合编译器以及数据结构的技术,提出了将源代码分析与有向图相结合的新思路,并给出了算法及其设计过程。

源代码的分析过程由四部分组成。首先,词法扫描器滤掉其中的空白符和注释,并识别出源代码中的标识符、分号、括号等返回给下一阶段使用。接着,词法分析器运用函数以及定义类型的正规表达式转化成的最小化的确定的有穷自动机对词法扫描器提供的信息进行分析。然后,算法借助栈自动地找到了函数间的调用关系。最后,本文用有向有环图的形式将源代码的函数调用关系表示出来。此过程很好的结合了C语言、编译器以及数据结构的知识,不仅分析源代码比较快,结果比较直观,而且极大的解决了查找源代码函数调用关系的费时问题。

关键词:编译器;函数;有穷自动机;分析;源代码

ABSTRACT

This paper, combining with the data structure and compiler’s technology, makes out a new idea which makes a combination of Source code analysis and directed graph, and gives the algorithm and its design process.

The process of source code analysis includes four parts. First, the lexical scanner overlooks the blanks and remarks of the source code and identifies the source code’s identifier, semicolon, parentheses, etc which will be backed to the next stage. Second, the lexical analyzer uses the minimum of the DFA which transformed from the form regular expressions of the functions’ and definitions’ list to analyze the information provided by the lexical scanner. Third, the algorithm automatically finds the relationship of the function by the use of the stack. Finally, this paper shows the relationship of the source code by the directed cyclic graph. This process combines the kownledge of C language, compiler and data structure very well, it not only makes the source code analysis faster and the final result more intuitive, but also greatly solves the time-consuming issue of finging the relationships of the source code’s functions.

Key words: Compiler; Function; DFA; Analysis; Source code

目  录

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值