Friday, April 12, 2019

lex program to convert lower case letter of given file to upper case


%{
#include<stdio.h>
%}

%%
 /*** Rules section ***/
[a-z] printf("%c",yytext[0] - ('a' - 'A'));
0 { return 0;}
%%

int main()
{
  FILE *fp;
  fp = fopen("test.txt", "r");
  if (fp == NULL) { printf("File not found"); }
  yyin = fp;

  yylex();
  return 0;
}

ScreenShot:

No comments:

Post a Comment