当我在Ubuntu Linux中运行这个野牛代码时,我得到以下警告:1shift/reduce conflict [-Wconflicts-sr] 2减少/减少冲突[-Wcolficts-sr]
这是一个更清晰的屏幕截图:http: //i.imgur.com/iznzSsn.png
编辑:减少/减少错误在第86行:typos_dedomenwn第101行:typos_synartisis
并且shift/reduce错误位于:第129行:entoli_if
我找不到如何修复它们可以有人帮忙吗?
这是下面的野牛代码:
%{
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int totalerrors=0;
extern int yylex();
extern FILE *yyin;
extern int lineno; //Arithmos grammis pou kanei parse
//error handling
void yyerror(const char *msg) {
}
//filling the error array
void printError(char y[],int x){
//param 1: error string
//param 2: line number
char temp[15];
char temp2[5];
char final[256];
sprintf(temp2,"%d: ",x);
strcpy(temp, "In Line ");
strcat(temp,temp2);
strcpy(final,"");
strcat(final,temp);
strcat(final,y);
printf("%d) %s\n",totalerrors+1,final);
totalerrors++;
} …Run Code Online (Sandbox Code Playgroud)