- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
可视化语法分析器的设计与实现论文
可视化语法分析器的设计与实现
摘要
编译原理在计算机科学中占有重要地位,所以基本上每个学习计算机科学的人都需要学习它。计算机硬件只懂自己的指令系统,即只能直接执行相应机器语言格式的代码程序,而不能直接执行用高级语言或汇编语言编写的程序。如果一个翻译程序的源语言是某种高级语言,其目标语言是相应于某一计算机的汇编语言或机器语言,则称这种翻译程序为编译程序。[1]
编译过程在任何高级语言中都是不可或缺的,不经过编译系统将无法接受高级语言程序。掌握编译过程对熟悉计算机系统是十分重要的。编译过程中尤以语法分析为重中之重,而可视化可以使得分析过程一目了然,故设计一语法分析器。
可视化语法分析器采用编译技术中最基础、最简单的知识,把C语言文件的编辑、词法分析和语法分析等功能联系起来。词法分析提取源文件中关键字和操作符,语法分析采用LL(1)文法,调用递归下降子程序对源文件进行分析并显示结果。可视化语法分析器能清晰明了地展示程序规约的过程,加深了人们对程序行为的理解,能较好地展示C语言编译的过程。
可视化语法分析器采用windows平台,使用QT5.2.1开发,操作简单便捷。实现了词法分析和语法分析两部分的功能。
关键词: 词法分析;语法分析;LL(1)文法;可视化技术
Design and implementation of a visual syntax analyzer
Abstract
Compilation principle plays an important role in computer science, so basically everyone are supposed to learn it. Computer hardware only understand instruction set of their own, which can only execute the code in machine language format program directly, but cannot perform high-level language or assembly language program in a direct way. If a source language of a translator is some kinds of a high-level language, the target language is corresponding to a computer assembly language or machine language, this translation is called a compiler.
Compilation process in any high-level language is indispensable, not compiled system will not accept a high level language program. It is vital to master compilation process in purpose of being familiar with computer system. Especially during the compiling process, grammatical analysis is the most important. As technology of visualization can make the analysis process clear, so we use it to design a parser.
The Visual Parser using the most basic and simple knowledge of compiler technology, and it can link the C language file editing, lexical analysis and syntax analysis functions together. Lexical analysis is used to extract keywords and operators in the source file. Grammar analysis uses LL(1) grammar, making use of recursive descent subroutine to analyze and display the results. Visual parser enables to show the process of the program cl
文档评论(0)