N
None
%token NUMBER
%token CD
%token CD..
%token SHOWAVAILABLEINTERFACE
%token LOCKPORT
%token RELEASEPORT
%token LISTSTDPACKET
%token SHOWPACKET
%token MODIFYPACKET
%token LOAD
%token MODIFYTRANSMITNFO
%token SENDPACKET
%token SETCAPTURECOUNT
%token SETCAPTURETIME
%token SETFILTERMAC
%token STARTCAPTURE
%token HELP
%%
cmd: /*Blank*/ {printf("blank command entered ");}
| cmd_name args_list { char str[80];
strcpy (str,$1);
strcat (str,'(');
strcat (str,$2);
strcat (str,')');
$$ = str;
}
;
cmd_name: CD {$$ = $1;}
| CD.. {$$ = $1;}
| SHOWAVAILABLEINTERFACE {$$ = $1;}
| LOCKPORT {$$ = $1;}
| RELEASEPORT {$$ = $1;}
| LISTSTDPACKET {$$ = $1;}
| SHOWPACKET {$$ = $1;}
| MODIFYPACKET {$$ = $1;}
| LOAD {$$ = $1;}
| MODIFYTRANSMITNFO {$$ = $1;}
| SENDPACKET {$$ = $1;}
| SETCAPTURECOUNT {$$ = $1;}
| SETCAPTURETIME {$$ = $1;}
| SETFILTERMAC {$$ = $1;}
| STARTCAPTURE {$$ = $1;}
| HELP {$$ = $1;}
;
args_list: /*Blank*/ {$$= ' ';}
| args args_list { char str[80];
strcpy (str,$1);
strcat (str,',');
strcat (str,$2);
$$ = str;
}
;
args: int_number {$$ = $1;}
| float_number {$$ = $1;}
| ip_address {$$ = $1;}
| mac_address {$$ = $1;}
;
int_number: NUMBER {$$ = $1;}
| NUMBER int_number { char str[80];
strcpy (str,$1);
strcat (str,$2);
$$ = str;
}
;
float_number: int_number'.'int_number { char str[80];
strcpy (str,$1);
strcat (str,".");
strcat (str,$3);
$$ = 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;
}
;
Hey,
I have been stuck on this Grammar for some time..
Can any one please help me remove the S/R conflict???
Also are the strcat and stcpy statements valid???
%token CD
%token CD..
%token SHOWAVAILABLEINTERFACE
%token LOCKPORT
%token RELEASEPORT
%token LISTSTDPACKET
%token SHOWPACKET
%token MODIFYPACKET
%token LOAD
%token MODIFYTRANSMITNFO
%token SENDPACKET
%token SETCAPTURECOUNT
%token SETCAPTURETIME
%token SETFILTERMAC
%token STARTCAPTURE
%token HELP
%%
cmd: /*Blank*/ {printf("blank command entered ");}
| cmd_name args_list { char str[80];
strcpy (str,$1);
strcat (str,'(');
strcat (str,$2);
strcat (str,')');
$$ = str;
}
;
cmd_name: CD {$$ = $1;}
| CD.. {$$ = $1;}
| SHOWAVAILABLEINTERFACE {$$ = $1;}
| LOCKPORT {$$ = $1;}
| RELEASEPORT {$$ = $1;}
| LISTSTDPACKET {$$ = $1;}
| SHOWPACKET {$$ = $1;}
| MODIFYPACKET {$$ = $1;}
| LOAD {$$ = $1;}
| MODIFYTRANSMITNFO {$$ = $1;}
| SENDPACKET {$$ = $1;}
| SETCAPTURECOUNT {$$ = $1;}
| SETCAPTURETIME {$$ = $1;}
| SETFILTERMAC {$$ = $1;}
| STARTCAPTURE {$$ = $1;}
| HELP {$$ = $1;}
;
args_list: /*Blank*/ {$$= ' ';}
| args args_list { char str[80];
strcpy (str,$1);
strcat (str,',');
strcat (str,$2);
$$ = str;
}
;
args: int_number {$$ = $1;}
| float_number {$$ = $1;}
| ip_address {$$ = $1;}
| mac_address {$$ = $1;}
;
int_number: NUMBER {$$ = $1;}
| NUMBER int_number { char str[80];
strcpy (str,$1);
strcat (str,$2);
$$ = str;
}
;
float_number: int_number'.'int_number { char str[80];
strcpy (str,$1);
strcat (str,".");
strcat (str,$3);
$$ = 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;
}
;
Hey,
I have been stuck on this Grammar for some time..
Can any one please help me remove the S/R conflict???
Also are the strcat and stcpy statements valid???