Thursday, 23 January 2014

How to compile LEX/YACC files on Windows?

Instead of using LINUX for compiling LEX/YACC files, we can do the same on WINDOWS 7/8 also....

Its very simple.You need to download two very small files.
You have to download two executable(.exe files) of very small size.

To download them click the links below.

Link 1:  Flex

Link 2: Bison

Save both files in same folder (same as the .l file)

Now, go to the folder and CLICK (shift+ right click) 
And click "Open Command window here" option.

To compile, type command

flex <filename> (example: flex demo.l )  -----> for a file named demo.l

If your program is error free, lex.yy.c will be generated.

We can compile this C file with any C compiler available (Ex: Turbo C/ Dev c++/ Codeblocks)

and generate yy.lex.exe

Now just run yy.lex.exe. Its your lexical analyser..!!!

Dats it.........:D :D
Join me on Facebook