Friday, April 12, 2019

Demonstrate the use of lex predefined variables (yytext, yyleng, yyin) with the help of program


%{
#include<stdio.h>
%}
%%
[a-z]* printf("matched string %s and length is %d",yytext,yyleng);
.* printf("%s invalid",yytext);
%%
int yywrap()
{
return 1;
}
int main()
{
yylex();
return 0;
}


ScreenShot:

No comments:

Post a Comment