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

  1. 1、本文档共55页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
C语言源代码分析建模算法研究

本科学生毕业设计 C语言源代码分析建模算法研究 系部名称: 数学系 专业班级:信息与计算科学B05-75班 学生姓名: 王亚伟 指导教师: 聂大陆 职 称: 副教授 黑 龙 江 工 程 学 院 二○○九年六月 The Graduation Design for Bachelors 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)

yurixiang1314 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档