I was trying to create a Lex program that does the following:
INPUT
float hey1(int a, int b);
OUTPUT
Function: hey1
it returns: float
Signature:
a - float
b - float
With the current knowledge I have of LEX, I decided to input the test file and output the 1st part to another file, which would become the input for the next part. Kindly guide me forward, as I have come to a dead end, and can't proceed forward.
My attempt :-
%{
   FILE *out;
%}
letter    [A-Za-z0-9]
%%
("float"|"void"|"int")" "{letter}*"("       fprintf(out,"Function: %s", yytext) ;
%%
int main()
{
    yyin = fopen("test.c","r") ;
    out=fopen("out.c","w");
    yylex() ;
    fclose(yyin) ;
}
Thanks