資源簡介
C語言詞法分析(能夠識別保留字,標識符,字符串等),能夠實現基本的詞法分析功能!
代碼片段和文件信息
#include?
#include?
#include?
char?*key0[]={“?““auto““break““case““char““const““continue““default““do““double““else““enum““extern““float““for““goto““if““int““long““register““return““short““signed““sizeof““static““struct““switch““typedef““_Complex““_Imaginary““union““unsigned““void““volatile““while“};
/*保留字表*/
char?*key1[]={“?““(““)““[““]““{““}““““;““‘“};
/*分隔符表*/
char?*key2[]={“?““+““-““*““/““%““<““>““==““>=““<=““!=““!““&&““||““<<““>>““~““|““^““&““=““?:““->““++““--““.““+=““-=““*=““/=“};
/*運算符表*/
int?xx0[35]xx1[10]xx2[31];
int?temp_key3=0temp_c40=0temp_c41=0temp_c42=0temp_c43=0;
/*******???初始化函數???*******/
void?load()
{
int?mm;
for?(mm=0;mm<=34;mm++)
{
xx0[mm]=0;
}
for?(mm=0;mm<=9;mm++)
{
xx1[mm]=0;
}
for?(mm=0;mm<=30;mm++)
{
xx2[mm]=0;
}
FILE?*floading;
if?((floading=fopen(“key0.txt““w“))==NULL)
{
printf(“Error!?Can‘t?c
- 上一篇:C++ Builder 網絡小游戲 五子棋
- 下一篇:C語言入門經典(第5版)源代碼
評論
共有 條評論