} } }
int main() { int nn = 0; string StrToken = \ fstream file; char ch; int ll; char filename[30]; //
cout <<\请输入源文件名:\cin.getline(filename, 30); file.open(filename, ios::in); if (!file) {
cout <<\文件打开失败!\\n\\n\ exit(0); }
yufa2[nn].l = 0;
cout <<\词法分析------------------------\ch = file.get(); while (!file.eof()) { // // //
if (ch == ' ' || ch == '\\t' || ch == '\\n') //滤掉空白字符 ch = file.get(); ch = file.get(); if (ch == ' ' || ch == '\\t') ch=file.get(); while (ch == '\\n') { ll ++; ch = file.get(); } getsym(file); nn++; yufa2[nn].SYM = yufa1.SYM; yufa2[nn].strToken = yufa1.strToken; yufa2[nn].l = ll;
// // // // // }
// cout.setf(ios::left); cout <<\ \ cout << setw(13) << yufa2[nn].SYM << setw(9) << yufa2[nn].strToken <<\ cout << setw(13) << yufa1.SYM << setw(9) << yufa1.strToken <<\ }
nn++;
yufa2[nn].SYM = \完成 yufa2[nn].strToken = \file.close();
cout <<\语法分析------------------------\yufa0.SYM = yufa2[mm].SYM; yufa0.SYM = yufa1.SYM; prog(); return 0;