用MFC做的一个Pascal词法分析器

时间:2014-04-24 01:39:06
【文件属性】:
文件名称:用MFC做的一个Pascal词法分析器
文件大小:1.82MB
文件格式:RAR
更新时间:2014-04-24 01:39:06
pascal MFC 词法分析器 FILE *outfp; char dir[100000]; char ch; char *keyword[400]={"and","array","begin","case","const","div","do","downto","to","else,","end", "file","for","function","goto","if","in","label","mod","nil","not","of","or","packed", "procedure","program","record","repeat","then","type","until","var","while","with","rewrite", "reset","put","write","writeln","read","readln"}; int begin=0,forward=0; void Keyword(int a) { begin=a; forward=begin; char ss[100]; int k,j=0; int flag=0; while( isalpha(dir[forward])||isdigit(dir[forward]) ) { ss[j]=dir[forward]; forward++; j++; } ss[j]='\0'; for(k=0;k<41;k++) { if( strcmp(ss,keyword[k])==0 ) { flag=1; fwrite(ss,strlen(ss),1,outfp); fwrite("\t [关键字] \n",12,1,outfp); begin=forward; } } if(!flag) { fwrite(ss,strlen(ss),1,outfp); fwrite("\t [标识符] \n",12,1,outfp); begin=forward; } }
【文件预览】:
Pascal
----Pascal.rc(6KB)
----Pascal.clw(1KB)
----out.txt(514B)
----in.txt(102B)
----Pascal.dsw(537B)
----StdAfx.cpp(208B)
----Pascal.opt(54KB)
----resource.h(821B)
----PascalDlg.h(1KB)
----Pascal.ncb(65KB)
----Pascal.plg(246B)
----Pascal.cpp(2KB)
----Pascal.aps(43KB)
----Debug()
--------PascalDlg.obj(51KB)
--------Pascal.obj(13KB)
--------vc60.pdb(356KB)
--------vc60.idb(201KB)
--------Pascal.pdb(361KB)
--------Pascal.exe(120KB)
--------StdAfx.obj(103KB)
--------Pascal.res(11KB)
--------Pascal.pch(5.25MB)
--------Pascal.ilk(248KB)
----ReadMe.txt(3KB)
----StdAfx.h(1KB)
----Pascal.dsp(4KB)
----Pascal.h(1KB)
----res()
--------pascal_logo.BMP(8KB)
--------Pascal.ico(1KB)
--------Pascal.rc2(398B)
----PascalDlg.cpp(11KB)

网友评论

  • 很不错,值得参考