#include
#include
#include
char prog[80]; //存放所有输入字符
char token[8]; //存放词组
char ch; //单个字符
int syn,p,m,n,i; //syn:种别编码
double sum;
int count;
int isSignal; //是否带正负号(0不带,1负号,2正号)
int isError;
int isDecimal; //是否是小数
double decimal; //小数
int isExp; //是否是指数
int index; //指数幂
int isNegative; //是否带负号
double temp;
int temp2;
int repeat; //是否连续出现+,-
int nextq;
int kk; //临时变量的标号
int ntc,nfc,nnc,nnb,nna;
char*rwtab[9]={"main","int","float","double","char","if","else","do","while"};
struct{
charresult[10]; //字符串(字符数组)
chararg1[10];
charopera[10];
chararg2[10];
}fourCom[20]; //结构体数组
void scanner(); //扫描
void lrparser();
void staBlock(int *nChain); //语句块
void staString(int *nChain); //语句串
void sta(int *nChain); //语句
void fuzhi(); //赋值语句
void tiaojian(int *nChain); //条件语句
void xunhuan(); //循环语句
char* E(); //Expresiion表达式
char* T(); //Term项
char* F(); //Factor因子
char *newTemp(); //自动生成临时变量
void backpatch(int p,int t); //回填
int merge(int p1,int p2); //合并p1和p2
void emit(char *res,char *num1,char*op,char *num2); //生成四元式
void main()
{
p=0;
count=0;
isDecimal=0;
index=0;
repeat=0;
kk=0;
printf("\nPleaseinput your source string:\n");
do{
ch=getchar();
prog[p++]=ch;
}while(ch!='#');
p=0;
isError=0;
scanner();
lrparser();
for(i=1;i
printf("\n%d\t",i);
printf("(%5s%5s %5s \t%5s )\n",fourCom[i].arg1,fourCom[i].opera,fourCom[i].arg2,fourCom[i].result);
}
}
应该就是main函数的问题,怎么改