1 / 9

MicroScript

MicroScript. 编译原理第 3 组 赵泽屹 5100379007 范鑫鑫 5100379006 方文滔 5100379010. In Pursuit of Absolute Simplicity 求于至简 归于永恒. 本阶段目标. 词法分析 器 语法分析器 图形 界面 快排的汇编 代码转化为汇编的基本方案. 词法分析器. 使用 Javacc ,根据 Microscript 的中的关键字定义正则表达式,并生成 jj 文件。用 StringReader 读入要分析的程序代码,输出词法分析的结果。. 语法分析器. 修改 BNF

helga
Download Presentation

MicroScript

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MicroScript 编译原理第3组 赵泽屹 5100379007 范鑫鑫 5100379006 方文滔 5100379010 In Pursuit of Absolute Simplicity 求于至简 归于永恒

  2. 本阶段目标 • 词法分析器 • 语法分析器 • 图形界面 • 快排的汇编 • 代码转化为汇编的基本方案

  3. 词法分析器 • 使用Javacc,根据Microscript的中的关键字定义正则表达式,并生成jj文件。用StringReader读入要分析的程序代码,输出词法分析的结果。

  4. 语法分析器 • 修改BNF • 消除左递归 • 消除左因子 • 明确所有运算符的优先级 • 根据BNF定义jjt文件,使用Javacc编译得到语法分析器。用StringReader读入要分析的程序代码,并将语法分析的结果以JTree的形式输出。

  5. 语法分析器

  6. 图形界面 • 实现四个阶段独立输出的功能 • 实现打开保存文件的功能 • 实现代码高亮、显示行号的功能

  7. Quicksort汇编代码 • 使用了MASM汇编器。 • 图为Quicksort的部分 • 汇编代码。

  8. 代码转化为汇编的方案 • 下一阶段我们的主要任务是采用编译原理课程中所学的知识将抽象语法树转化为中间代码。 • 我们将以抽象语法树转化成的中间代码作为输入,输出MASM汇编器下的汇编。

  9. MicroScript 编译原理第3组 赵泽屹 5100379007 范鑫鑫 5100379006 方文滔 5100379010 In Pursuit of Absolute Simplicity 求于至简 归于永恒

More Related