To begin with, you must download the files below first(around 400KB in total). All the files should be in the same directory(flex.exe is standalone but bison.exe is not).
Another requirement is that you must have a c/c++ compiler(like Turbo C++ ) installed in your system. I believe everyone who has reached compiler level programming will have a c/c++ compiler installed in their system(duh!).
Now you can start your work.
1. Create a lex program and save it(like ‘x.l’ or ‘x.txt’)
2. Reach your directory through command prompt.
3. Call flex by “flex
” (eg: “flex x.l”)
4. If your lex input file doesnt have any errors, a file name “lex.yy.c” will be generated.
5. I suggest you rename “lex.yy.c” to some other more sensible name like “lex.c”, because double extensions is not a good idea in windows environment. Move the file to the folder of your compiler.
6 . Call the compiler and input lex.c to it (eg: “tcc lex.c”, where tcc is the Turbo C compiler; use any C/C++ compiler you have). If what you have is a more sophisticated environment like visual studio, you have to do the normal procedure to get a program to compile. If you use Turbo C, an object file “lex.obj’ and the executable “lex.exe” will be generated if there are no compilation problems
7. Thats it. Now just run lex.exe. Its your lexical analyser.
For more details Visit https://libinjose.blogspot.com