Hi guys! sa ako ni PL nga class sa laboratory. just want to ask some ideas. we are asked man to make a mini compiler. my analyzer.hÂ* contains all the functions.Â* naa naman ko five functions nga nahimo on isDigit,isAlpha,isIdentifier,isInterger,isOperator . My problem are the functions: isExpression, isDeclaration, and isCType.Â*
Valid tokens for isExpression: identifier= identifier operator identifier semicolon
Â* Â* Â* Â* Â* Â* Â*example: sum= a+b;Â*
int isExpression (char *ch)
{
Â* int flag=0,i;
for(i=0;ch[i]!= '\0';i++){
Â* if(isIdentifier(ch[i])){
/
*dri ko nga part naglibog kung unsa sunod*/
}
int isCType(char *ch)
{
char *str1= "int";
char *str2= "float";
char *str3= "double";
char *str4= "long int";
char *str5= "long float";
char *str6= "long double";
if(strcmp(str1,ch))
Â* return 1;
else if(strcmp(str2,ch))
Â* return 1;
else if(strcmp(str3,ch))
Â* return 1;
.......
.......
......so on and so forth...
}Â* Â* Â*
/*unsa pasabot ani error nga: isCtype in MAINANALYZER.c is duplicated in ANALYZER.H?mao man ako makuha nga error sa ani nga function inig tawag nako sa main*/Â*
ari lang sa ko kutob post..kay maghimo pa pud ko program..hehe..pa-eta ani oy..dok2x jud ko ani maau kay C man gud..
hope anyone could share some ideas...thanks!