编译原理词法分析程序不要C语言的,是C++版的,
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/21 01:34:11
xSn@a8 q6(?dTgl͌ UT $H# B
#eQ$~_0I`l̽3fQ+.O^gx'G$
ūQ~l'O.ه}Sf/G4n`PPnp1V?4r27=)e{DDKY/$'vEsܑO$i(
*%Nodv^~c
0I Z+wi *DƜNU2IYyqH=\XgSVr"(>7a/foFN=THёM>P0hM/66#0R [Z&K8I`Kl* ]hCN@k /> PQfqϺW3Wɵ*5+-:˧|19\d-nW+*mwt(m˽T
`VMֲ+ѧ"/v9-7zZ&mu|_K
编译原理词法分析程序不要C语言的,是C++版的,
编译原理词法分析程序
不要C语言的,是C++版的,
编译原理词法分析程序不要C语言的,是C++版的,
#include
#include
#include
#include
#include
using namespace std;
ifstream fp("source.txt",ios::in);
char cbuffer;
char *key[13]={"if","else","for","while","do","return","break","continue","int","void"
,"main","const","printf"}; //关键字
char *border[7]={ "," ,";" ,"{" ,"}" ,"(" ,")" ,"//"}; //分界符
char *arithmetic[6]={"+" ,"-" ,"*" ,"/" ,"++" ,"--"}; //运算符
char *relation[7]={"=" ,"==" ,"!="}; //关系运算符
char *lableconst[80]; //标识符
int constnum=40;
int lableconstnum=0;
int linenum=1; //统计常数和标识符数量
int search(char searchchar[],int wordtype)
{
int i=0,t=0;
switch (wordtype)
{
case 1:
{ for (i=0;i