%{
/* LEX program to convert uppercase to
lowercase except inside comments
*/
#include <stdio.h>
#include <stdlib.h>
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
%}
%option noyywrap
%%
[A-Z] {
putchar(tolower(yytext[0]));
/* yytext[0] is the single
uppercase char found */
}
"/*" {
char c;
int done = FALSE;
ECHO;
do {
while ((c = input()) != '*')
putchar(c);
putchar(c);
while ((c = input()) == '*')
putchar(c);
putchar(c);
if (c == '/') done = TRUE;
} while (!done);
}
%%
int main() { yylex(); return 0; }
Pretty simple code. Thanks!
ReplyDeleteThe programming doesn't run has many errors. Don't waste your time...!
ReplyDeletereally best code
ReplyDeleteTHANKS ALOT
ReplyDelete