Question: how to run lex file?
Answer: Use the lex program to change the specification file into a C language program. The resulting program is in the lex. yy. ... 
Use the cc command with the -ll flag to compile and link the program with a library of lex subroutines. The resulting executable program is in the a.