词法剖析器(C#完成)(国外英文资料).docVIP

  • 3
  • 0
  • 约8.83万字
  • 约 19页
  • 2017-06-05 发布于河南
  • 举报

词法剖析器(C#完成)(国外英文资料).doc

词法剖析器(C#完成)(国外英文资料)

词法分析器(C#实现)(国外英文资料) / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * write in the front Before parsing, preprocess the source code, remove the extra space and line and comment * words are best separated from words, or they will be recognized as unknown * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / Using System; Using System. Collections. Generic; Using System.Com ponentModel; Using System. The Data; Using System. Drawing; Using System. The Collections; Using System. The Text; Using System. Windows. Forms; Using System. IO; The namespace lexical analysis { Public partial class Form1: Form { Private static string [] reserved words = { bool , 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 }; Private static string [] operator = { * , /, %, +, -, , , and , = , =, = =, ! = , , ^, |, , | |, ? : , + =, - =, * =, / =, % =, =, | =, ^ =, =, =, =}; Private static string [], , , ; , , , (, ) , :, /, , {} , ,/}; Private static string [] identifier; Private static string [] constant; Private static string [] unknown symbol; Private ArrayList temp = new ArrayList (); Public _click () { InitializeComponent (); } Public int Search_Location (string STR, string [] a) / / lookup character encoding { For (int I = 0; I a.i.ength; I + +) { If (STR = = a [I]) Return the I + 1; } The return - 1; } The public int InsertId (string STRR, ref string [] a) / / identifier inserts the identifier table back to the location { Temp. The Clear (); If (a = = null) Temp. Add

文档评论(0)

1亿VIP精品文档

相关文档