词法分析器(c#实现)

词法分析器(c#实现)

ID:1975475

大小:47.00 KB

页数:7页

时间:2017-11-14

词法分析器(c#实现)_第1页
词法分析器(c#实现)_第2页
词法分析器(c#实现)_第3页
词法分析器(c#实现)_第4页
词法分析器(c#实现)_第5页
资源描述:

《词法分析器(c#实现)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、/**********************************************************************************************************************写在最前面*词法分析前先将源码预处理,去掉多余的空格和换行以及注释*单词与单词之间最好用空格隔开,否则将被识别为未知符号******************************************************************************************************

2、****************/usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Collections;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.IO;namespace词法分析{publicpartialclassForm1:Form{privatestaticstring[]保留字={"bool

3、","break","case","char","do","double","else","false","float","for","if","int","long","main","new","null","private","protected","public","static","true","try","typeof","unit","void","while","return","short","sizeof","switch"};privatestaticstring[]运算符={"*","/","%","+","-","<<",">>",

4、"<",">","<=",">=","==","!=","&","^","

5、","&&","

6、

7、","?:","+=","-=","*=","/=","%=","&=","

8、=","^=","<<=",">>=","="};privatestaticstring[]界符={",",";",".","'","(",")",":","[","]","{","}","/"};privatestaticstring[]标识符;privatestaticstring[]常数;privatestaticstring[]未知符号;privateArrayListtemp

9、=newArrayList();publicForm1(){InitializeComponent();}publicintSearch_Location(stringstr,string[]a)//查找字符编码{for(inti=0;i

10、i

11、.Length;i++){if(str[i].Contains("//")){string[]strr=str[i].Split('/');str[i]=strr[0];}}for(inti=0;i

12、place("/n","");if(str1.Contains("

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。