Flex for Windows- Lex and Yacc(Bison) Installer for Windows 7/8.1/10 32-bit & 64-bit

Hello friends, recently we were introduced to lex and yacc parsers in our syllabus, but the introduction to lex and yacc [flex and bison] was made in linux environment . Personally, I didn’t felt necessary to Install the Complete Linux OS on my Laptop just because to have gcc/lex/yacc libraries which are a mere 30 MB size , and to allocate 10GB Disk Space + RAM[in Virtual Machine] to Linux is something which i am not very Fond of 🙁 . After searching on Sourceforge, I came across the MinGW [ Win 32 Port of cc/gcc/g++] and the GNU-Win32 ports of flex[lex] and bison[yacc] respectively. So in order to make it easy to use and install i Packaged all of them into a single one click installer – Flex for Windows 7/8/10

Contents / Salient Features of Flex Windows

  • In-built GCC/G++/cc Libraries of LinuxThe Flex Windows Package contains inbuilt Gcc And g++ libraries [c and c++ compilers] which are ported to windows officially by MinGW and are actively developed by the Linux Open Source Community
  • Lex and Yacc Package Binaries  :  The package contains the latest updated versions of Lex and yacc binaries [flex and bison] which are developed by their developers . The original binaries are included as-it-is in the package so as to ensure smooth and error free compilation and build of your Programs.
  • Pre-Configured EditPlus IDEThe package also contains EditPlus IDE which contains pre-defined Blank templates for the Lex/Yacc/C/C++/Java Files, thus each time you want to type a program you can simply use the New Lex / New Yacc template, and the basic code will be inserted thus saving your time and efforts to type :P.
  • The EditPlus IDE also contains user Commands for Lex Compile,Yacc Compile,Lex Build , Lex+Yacc Build, Band for Execute. thus, saving your time to type complete commands like “lex abc.l” or cc lex.yy.c  y.tab.c -o <object file>” blah blah..” you can simply click the Buttons according to the function you wanna perform and the command will be executed, the command itself will insert the filename,parameters etc 🙂 Amazing! isn’t it ? And to top it off the IDE will capture the command output , errors if any will be shown in the IDE window itself ,thus you can easily change the code,save and compile in split seconds making it easy and pretty much like Geany/Eclipse/Netbeans 🙂
  • If it still doesn’t impress you , you still can open CMD and compile and build the hard-old-fashioned way 🙂
  • No need to Set PATH variables , the PATH variables , for the gcc/lex/yacc are added by the installer itself, thus saving the efforts required to set PATH 🙂
  • Single installer , works on all version of Windows., here’s a Snapshot of the Flex for Windows in Action

Download : Click here to download Flex for Windows 7/8/8.1/10/XP 32-bit || 64-bit

Download Mirror #1 :  Click here to download Flex for Windows 7/8/8.1/10/XP 32-bit || 64-bit from Mirror # 1

Update : For those who are facing errors with Bison/yacc Package in Flex for Windows can also install Lex/Yacc on Ubuntu/LinuxMint easily by referrig this article.

Cautions/Precautions to be taken :

  • Make Sure you install the Package in any folder except “Program Files” / “Program Files (x86)” The Package won’t work if installed in Program Files.
  • The Windows Lex Version requires “%option noyywrap” ,  Please make sure this option is present , before you compile Programs.
  • The “-ll” and “-ly” arguments won’t work in Windows as they are not required in Windows Environments.
  • If the IDE Lags/Code doesn’t respond on compile command , Please re-run the FlexIDE as “Run as Administrator” .

Method to Run Programs through IDE

  • Some users have reported difficulty using the package for running the programs or giving the inputs, hence we are simplifying the instructions to run the programs below. In some cases you may find that the program terminates after executing after getting inouts from console if compiled and executed through IDE, In such cases the CMD way is recommended for executing .

Case 1 : Only lex Programs need to be run and built and executed

  • Click the compile lex button in the IDE.
  • Click the build lex button.
  • Click on Execute .

Alternate way through CMD 

  • Click on Execute CMD directly button in the IDE.
  • Compile the Lex File by typing the command lex <filename>.l
  • Build the Lex File by gcc/cc command in the CMD e.g gcc lex.yy.c -o <executable name for program>
  • Execute the program by typing <executable name for the program>.exe
  • The -o <executable name for program>  parameter is optional, you can skip the said parameter by directly building by gcc lex.yy.c
    and then directly execute your program by typing a.exe

Case 2 : Both Lex and Yacc Programs together have to be linked and Compiled – Executed

  • Compile the yacc program by the compile yacc button from the IDE.
  • Compile the Lex program by compile lex button.
  • Build the program by clicking the “lex-yacc” build button.
  • Click on Execute button.

Alternate way through CMD

  • Click on the Execute CMD button in the IDE.
  • Compile Yacc file by typing command yacc -dy <filename.y>
  • Compile the Lex File by typing the command lex <filename>.l
  • Build the Lex File by gcc/cc command in the CMD e.g gcc lex.yy.c y.tab.c -o <executable name for program>
  • Execute the program by typing <executable name for the program>.exe
  • The -o <executable name for program>  parameter is optional, you can skip the said parameter by directly building by gcc lex.yy.c y.tab.c
    and then directly execute your program by typing a.exe

The binaries are provided as it is , so they cannot contain any errors, However if you face any errors/problems while installing or running, do comment 🙂 we will try to solve it . If you have any doubts/suggestions do leave them behind in comments 🙂

UPDATE : All yacc fixed in this new version — New Update to sequence for Activations by Maria —

“select the name.l -> click on Lex Compile -> click on Lex Build ->
 
-> select name.y -> click on Yacc Compile – click on Lex + Yacc Build ->
 
-> click Execute exe directly or Open CMD (typing the name)”

9 comments

  1. Good efforts. But I could not run a simple program (given below).
    %option noyywrap
    %{
    #include
    %}

    %%
    “hello” printf(“GOODBYE”);
    . ;
    %%
    int main()
    {

    return 0;
    }
    I can successfully compile, build, and run directly exe file. But I could not give input and see my output.
    My expected input after running a.exe should be as below;
    hello
    GOODBYE

    but the output is nothing (means i could not give “hello” word

  2. there is bug while downloading in mirror link
    automatically ht/ added to url so we have remove it manually then downloading started

Leave a Reply to rida Cancel reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.