My Code:
%{
#include<stdio.h>
%}
%%
"int"|"char"|"double"|"void"|"main" {printf("\n%s is a keyword",yytext);}
^[a - z A - Z _][a - z A - Z 0 - 9 _] * {printf("\n%s is an identifier",yytext);}
^[-+]?[0-9]* {printf(}\n%s is an integer",yytext);}
^[-+]?[0-9]*[.][0-9]+$ {printf("\n%s is a floating number",yytext);}
"+"|"-"|"*"|"/"|"%"|"//" {printf("\n%s is an arithmetic operator",yytext);}
">"|"<"|">="|"<="|"="|"=="|"<>" {printf("\n%s is a relational operator",yytext);}
.;
%%
int yywrap()
{
return 1;
}
main()
{
printf("Enter a String:\n");
yylex();
}
This is the Code I've written. I'm getting an error while compiling it and I'm not sure what it is. Can you please take a look at it and say how to fix it. Thank you.