/** * Read in from the command line and * replace all lowercase letters with uppercase letters * This demonstrates how we can interact with characters as numbers and as characters. * * flex -o upper.yy.c upper.yy * gcc -o upper upper.yy.c -ll */ /* This is a definition.*/ LOWER [a-z] %% {LOWER} printf("%c", yytext[0]+('A'-'a') ); /* we use the definition here for pattern-matching */ . printf("%s", yytext ); /* skip all other input */ %% int main( int argc, char *argv[] ) { yylex(); // a function of flex that read input till it is exhausted return 0; }