编译原理经典算法的可视化实现 - 图文 下载本文

编译原理经典算法的可视化实现 致谢

大学论文我选择的题目是编译原理经典算法的可视化实现。《编译原理》这门课程是计算机专业一门重要的专业基础课,计算机知识通过它相互联系。通过综合运用大学四年的专业知识,实现了编译阶段中的词法分析器和语法分析阶段LL(1)文法中各种算法的可视化。编译原理这门课程本身就比较抽象,所以开发出这样的系统,难度比较大,这就需要有耐心和毅力来学习知识,发现问题并解决问题。有时碰到我不能解决的问题,我就查资料,求助于互联网,当然我也向老师和同学请教。从这次论文设计的东西,相信会对我们日后的学习工作起到很大的指导作用。但也体现了我的种种不足,以后必当再接再厉。大学四年的生活一下子就要过完了,在这里,我感谢每位授课老师,,正是你们孜孜不倦的教诲使我能够顺利完成学业,你们的认真工作的态度是我们意识到人必须要求知欲,做什么事都应认真对待。当然我也要感谢陪伴我四年的同学们,他们给予了我无言的帮助。最后,我要感谢在这次毕业论文对我帮助很大的周书仁老师。周老师在这次毕设中给予我细心的指导,在毕设的每个阶段都监督我们的进度,正是他的这种认真的态度,才使得我们能够顺利完成这次毕业设计。

29

编译原理经典算法的可视化实现

参考文献

[1]蒋立源,席慕宁.编译原理[M].西安:西北工业大学出版社,2005:10-40. [2]陈火旺,等.程序设计语言编译原理[M].北京:国防工业出版社,2000:20-60. [3]蒋秀锋,任志雄.可视编译器的设计与实现[J].计算机与现代化,2010(10),63-70. [4]李冬梅,施海虎.“编译原理”课程的教学研究与探索[J],计算机教育,2008(9):100-130. [5]赵国庆,黄荣怀,陆志坚.知识可视化的理论与方法[J],开发教育研究,2005(14):67-90. [6] JonL.Bentley and BrianW.Kernighan.A System for A lgorithm Animation,Com Puting Systems[C],Vol.4 No.l,Winter 1991.5一30. [7]

Cheng,J.Y.,Shen,Y.Z.,Ding,Z.L.

and

Mai,S.Q.Program

Animation

and

its

ImPlementation[C].Proc.5th National Academic Confereneeon CAD/CAM一Advances in CAD/CAM of China,Oct.1993:474一482.

[8]王强,冯雁.编译原理算法的形象教学[J],计算机教育,2010(17):120-140. [9]蒋秀峰,任志雄.可视编译器的设计与实现[J], 计算机与现代化,2010(11):60-80. [10] : Alfred V. Aho / Monica S.Lam / Ravi Sethi / Jeffrey D. Ullman著,赵建华,郑涛,戴

新宇译,编译原理[M],机械工业出版社,2008.

[11]唐培和,徐奕奕,王日凤.基于可视化运行平台的数据结构课程教学[J],计算机教育,

2012(20):69-72.

[12]孙永新,闫大顺.动画演示与算法教学研究J],现代计算机(专业版),2009(18):89-130.

30

编译原理经典算法的可视化实现 附录 源程序

using System;

using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text;

using System.Threading.Tasks; using System.Windows.Forms; using System.IO;

using System.Threading; namespace hust_liwangpeng {

public partial class mainForm : Form {

public bool flag = true; public int count=0; public int speed = 100; public int i = 1;

private System.Windows.Forms.Timer tm = new System.Windows.Forms.Timer(); AutoResetEvent autoEvent = new AutoResetEvent(false); private void CreateHeadersAndFillListView() {

ColumnHeader colHead;

colHead = new ColumnHeader(); colHead.Text = \单 词\; colHead.Width = 100;

this.listShow.Columns.Add(colHead); colHead = new ColumnHeader(); colHead.Text = \类型码\; colHead.Width = 100;

this.listShow .Columns.Add(colHead); colHead = new ColumnHeader(); colHead.Text = \属性值\; colHead.Width = 100;

this.listShow.Columns.Add(colHead);

31

编译原理经典算法的可视化实现 } public mainForm() { InitializeComponent(); CreateHeadersAndFillListView(); tm.Interval = 1000; tm.Tick += new EventHandler(tm_Tick); } void tm_Tick(object sender, EventArgs e) { autoEvent.Set(); } private void toolClear_Click(object sender, EventArgs e) { this.rtSource.Clear(); listShow.Items.Clear(); this.toolStop.Enabled = false; paint(); this.toolExcute.Enabled = false; this.toolRecovery.Enabled = false;

}

private void toolExit_Click(object sender, EventArgs e) {

System.Diagnostics.Process ps = System.Diagnostics.Process.GetCurrentProcess(); ps.Kill(); }

private void toolInput_Click(object sender, EventArgs e) {

string path = null;

if (openFile.ShowDialog() == DialogResult.OK) {

path = openFile.FileName;

using (StreamReader reader = File.OpenText(path)) {

32