lex yacc ???



%token NUMBER
%token LETTER

%start cmd




%%

cmd: /*Blank*/ {printf("Blank, No command entered ");}
| cmd_name args_list { char str[80];
strcpy (str,$1);
strcat (str,'(');
strcat (str,$2);
strcat (str,')');
$$ = str;
}
;

cmd_name: string { $$ = $1;}
string '.''.' { char str[80];
strcpy (str,$1);
strcat (str,$2);
strcat (str,$3);
$$ = str;}
;


args_list: /*Blank*/
| args args_list { char str[80];
strcpy (str,$1);
strcat (str,' ');
strcat (str,$2);
$$ = str;
}
;

args: int_number {$$ = $1;}
| string {$$ = $1;}
| ip_address {$$ = $1;}
| mac_address {$$ = $1;}
;

int_number: NUMBER {$$ = $1;}
| NUMBER int_number { char str[80];
strcpy (str,$1);
strcat (str,$2);
$$ = str;
}
;

ip_address: int_number '.' int_number '.' int_number '.' int_number
{ char str[80];
strcpy (str,$1);
strcat (str,".");
strcat (str,$3);
strcat (str,".");
strcat (str,$5);
strcat (str,".");
strcat (str,$7);
$$ = str;
}
;

mac_address: int_number ':' int_number ':' int_number ':' int_number
':' int_number ':' int_number { char str[80];
strcpy (str,$1);
strcat (str,":");
strcat (str,$3);
strcat (str,":");
strcat (str,$5);
strcat (str,":");
strcat (str,$7);
strcat (str,":");
strcat (str,$9);
strcat (str,":");
strcat (str,$11);
$$ = str;
}
;

string: LETTER {$$ = $1;}
| LETTER string { char str[80];
strcpy (str,$1);
strcat (str,$2);
$$ =str;
}
;

%%





Hi guys,


I am getting 2 SR conflicts for the code above. Please can someone
help me resolve them..


I know this is not the exact place to post a lex yacc doubt.But I dint
find any other valid avenue.

I ll be really greateful if anyone can solve this .

Thanx

.



Relevant Pages

  • Re: Undeclared identifier error in file "xlocnum"
    ... I had issues with strcat and strcpy in 1975, and nothing in the intervening 30 years has ... you have done something that includes the safe-string library; ... you should not be using sprintf any longer. ...
    (microsoft.public.vc.mfc)
  • Re: Undeclared identifier error in file "xlocnum"
    ... there is still a reason to use those crappy old functions. ... >your code is used on other platforms and by other compilers you will ... >>strcpy or strcat these days, it is better to adopt safe programming practices. ...
    (microsoft.public.vc.mfc)
  • Re: Difference between strcpy() and strcat()?
    ... Leor Zolman wrote in message news:> "strcpy is safer than strcat because it is easier to check programmatically ... > length of the source string. ... With strcat, on the other hand, you have to ...
    (comp.lang.c)
  • Re: Undeclared identifier error in file "xlocnum"
    ... there is still a reason to use those crappy old functions. ... >strcpy or strcat these days, it is better to adopt safe programming practices. ...
    (microsoft.public.vc.mfc)
  • Re: FindFirstFile, how much faster than FindNextFile?
    ... If you want to see really horrible, hair-raising code, open a recent CUJ ... and check how the guy is creating XML request strings. ... if you ever write strcpy or strcat, THINK REAL HARD ABOUT WHY YOU ...
    (microsoft.public.vc.mfc)