.\\
{ //WordAnalyse(); termdo(); }
if(sym!=times&&sym!=slash&&sym!=plus&&sym!=minus&&sym!=ident&&sym!=number&&sym!=lparen&&sym!=rparen) { err++; if(err==1) printf(\语法错误: \\n\ printf(\不能识别字符\\n\ }
while ((sym == plus) || (sym == minus)) { WordAnalyse(); if(getsym()==-1) { err++; if(err==1) printf(\语法错误: \\n\ printf(\ 后缺项\\n\ return -1; } termdo(); }
return 0; }
int main(int argc, char* argv[]) {
init(); err=0;
ifstream fin(\ ofstream fout(\ ch=' '; lp=0;
getsymdo; expression();
if(err==0) cout<<\语法正确\ else cout<<\语法错误,错误个数: \
.\\
}
编译基础学习知识原理实验词法语法分析附源代码
.\\{//WordAnalyse();termdo();}if(sym!=times&&sym!=slash&&sym!=plus&&sym!=minus&&sym!=ident&&sym!=number&&sym!=lparen&&sym!=rparen){err++;if(err==1)printf(\语法错误:
推荐度:
点击下载文档文档为doc格式