%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 .or if u can tell me whr do i get help from.
Thanx