Flex for Windows-Lex and Yacc(Bison) Installer for Windows 7/8/8.1/XP 32-bit as well as 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 Linux :Β The 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 IDE :Β The 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

Comments

    • says

      inputs can be given through files or through consle as per your wish , the normal method of using fopen(“filename”,”r”); will work, same is the case with outputs , we can write the outputs on the file .

    • says

      and for giving inputs through the console we can directly give the commands after compiling the yacc, then the lex programs , then building using the lex-yacc build , and then by executing it . it would be better if you can share your program then we can guide you on the exact way . Thanks

  1. Shasan says

    mai pehle bohot nirash rehta tha, bohot hatash rehta tha.
    College me ubuntu pe lex and yacc k programs sikha rahe the
    mujhe ubuntu me lex yacc gcc install karne me prob ho rahi thi
    mai dukhi rehne laga.
    mujhe coding karne k kide ne pareshan kar rakha tha
    maine kai upaay apnay par mujhe nirasha hi haath lagi
    maine windows pe flex and bison khud install karne ki sochi
    usme bhi mujhe nakabyabi mili

    Lekin phir mujhe techapple ka single-installer flex mila
    ab mai kya batau mai kitna khush rehne laga hu
    meri to duniya hi badal gai hai
    yacc or lex apne ghar pe bhi run kar paa raha hu
    mera coding ka kida bhi bohot khush hai
    meri girlfriend bhi mujhse bohot khush rehne lagi hai*
    mere nagar sevak bhi mujhse bohot khush hai
    meri gali ka kutta bhi ap mujhpe gusse se nahi bhonkta
    or ye sab techapple ki wajah se hua
    mai apne sab dosto ko ye recommend karunga
    THAANNKK you techapple

    ——
    *girlfriend ki khushi ka kuch or karan hai
    wo isliye khush hai kyu k
    ***censored*** πŸ˜›

  2. Ashmita says

    plz can you elaborate on how to give inputs?where is the exe file stored?
    can you plz giv one demo…plz reply its urgent.

    • says

      Sorry for the delay in my reply πŸ™ , actually the exe d\file is stored in the same folder where the lex and yacc files are stored (the folder in which you are saving the programs) .
      I will be making a demo video soon..
      till then you can read the following quote to execute instructions,–

      “Click on the Execute CMD button in the IDE.
      Compile Yacc file by typing command yacc -dy
      Compile the Lex File by typing the command lex
      .l
      Build the Lex File by gcc/cc command in the CMD e.g gcc lex.yy.c y.tab.c -o
      Execute the program by typing
      .exe
      The -o
      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”

      once you execute the a.exe or program exe through the command prompts you can give input there itself.. in the command prompt window πŸ™‚

      • ashmita says

        i have already tried above steps..
        My lex program was first saved outside the directory so while compiling that using lex filename.l, it use to give an error “lex not recognized as internal or external command”…after this i saved my program inside lex folder where lex is installed…then that error was gone
        but now it gives an error “gcc not recognized as internal or external command” i even tried changing path from “Advance System properties” but still it is giving same error.
        I have given the path where my lex is installed is that correct??

        • says

          Okay. So we need to add the environment variables for gcc and lexx bin folder to path variable,or advanced system properties.. Or I can create an batch file for the same if required..

          • Ashmita says

            i m not able to sort it out…
            i have tried everything..i have even added environment variables for gcc,lex and bison bin folder to path variables.. still it is not working..plz provide me the batch file if possible..plz…

          • says

            Okay , am extremely sorry for the inconvenience caused :(, creating the batch file will upload it by tomorrow evening in this post, thank you for using our product.

          • says

            Can you give us the installation directory where you have installed the package ? we require it for adding it to the batch file, else its already ready to be executed πŸ™‚
            Here’s the alternative solution Please download both these files and extract them to the “C:\” drive
            1st file – http://goo.gl/5RY1nL
            2nd file – http://goo.gl/XcwNi3
            Now after you have extracted please go to c:\flex activator and execute the activator.exe and please do not close the activator window, let it remain open, now execute the flex windows IDE from the Desktop πŸ™‚ It will run without any hiccups πŸ™‚

  3. manisha says

    what you people are talking? By the by, what is lex and yacc?? why it is used? which games are those? i play only throwball.. That also we won because our opponents dint come:-)

  4. manisha says

    even i need free laptops. i like red colour.. so get me red colour laptop ok.. DELL i dont like because battery not good.. ok bye guys.. i have to write assignments.. also i have to write dbms imposition 4 times.. happy dussera to all..

    • Akhilesh Acharya says

      Is HP laptop fine?
      now bye..
      I have to write dbms imposition(5 times) ,OS assignment,SS Assignmeent and SS notes.
      Also FLAT homework….
      Happy dussera to you manisha:)
      going to miss u for next 5 days:(:(

  5. manisha says

    why you want lex and yacc to execute c program.. u r really stupid.. go and download turbo C.. its better than these things..dont disturb me.. i have to prepare presentation on nano technology in mars..

  6. Akhilesh Acharya says

    Forget c program…
    suggest me a seminar topic too….
    if i dont get any topic then i’ll give seminar on Moral values and Professional ethics…
    it feels great to listen to moral science class right?
    By the way my team needs 2 more members….plz give us our ‘lion'(i mean lano) back…

  7. ForgiveUs says

    Dear Chaitanya,

    A sincere sorry for the stupidity shown by the above few people.They didn’t mean to disturb you.
    They were just playing pranks on each other.I hope you didn’t mind it.

    Your software is really a boon for us.

    Thankyou:)

  8. Makhilesh says

    Had a very good time doing vihara in vana at “Vana Vihara” yesterday…….:)
    Feeling very proud of myself for sponsoring laptops….:)
    All thanks to techapple.net:)

  9. says

    Stop calling me an idiot,you silly little..
    I was so happy yesterday at vana vihara yesterday that i wanted to share it…
    by the way why are you concerned????Is it because i am not thanking you???
    Are you jealous:P

  10. manisha says

    full jelos.. who telled u talk rubbish here..? english learn from me. u jealos of suppper english of main(mine).. meen maaruna mone ninna stupid..

  11. Manisha says

    You expect me to learn English from you???
    First learn the spelling of grammer(I mean grammar)..
    suruku ninna mone thula…i hope you have a mirror…

  12. Manisha says

    Its okay….
    Thanks for your comments about Makhilesh…
    I think he deserves it..
    I don’t think he has a mirror(because he lost all his money sponsoring laptops at Vana Vihara)…
    We better gift him one..

  13. mankishaa says

    pehle me bahut kush tha.. baad me techapple pe me ne flex and yacc ki page dekhi.. waha par comment dek kar meri kushi chali gayi. ab aisa lag raha he ki me koi sulsaan shamsaan ke beech ek chudail ke kaala jaadu me band ho gaya hu.. muje koi bacchhhaoo….

    • Manisha says

      kisne kaha tha is page mein comment karne ke..wo bhi class ke waqt…
      chup chap download karke wapas jaana chaiye tha..

  14. Makhilesh says

    Issi liye main tuje “Vana Vihara” mein bhula raha tha….
    bahut hi accha jaga hai…
    hare bhare ped hain,titliyaan hai,aur kya kya nahi …
    phir bhi bore ho gayi tho Windows 98 installed PC hain na…
    usme c program kya ethical hacking aur android app develop bhi kar sakthe hain…

  15. Makhilesh says

    Okay now bye guys…..
    got to sleep…
    have some renovation work at vana vihara tomorrow..so i need to wake up early tomorrow…
    also OS assignment and dbms imposition(only once did i finish,4 more times to write) has to completed you see..
    Once again wish you all a very happy dussera (i mean Dussehra):-)
    Thank you Manisha for correcting me.If I had used this spelling in class then all my freinds would have made fun of me.You know right,I don’t like to be the source of entertainment in class…
    Once again thanks a lot

  16. mankishaa says

    Haste rahiye, muskurate rahiye, aurato ka izzat kariye, praaniyo se pyaar kariye aur dekte rahiye Windows 98 ki jaaadoo!!! πŸ˜‰

      • says

        Dedicated to techapple.net

        Jise zindagi dhoondh rahi hai
        Kya ye woh makaam mera hai
        Yahaan chain se bas ruk jaaun
        Kyun dil ye mujhe kehta hai
        Jazbaat naye se mile hain
        Jaane kya asar ye huaa hai
        Ik aas mili phir mujhko
        Jo qubool kisi ne kiya hai

        Kisi shaayar ki ghazal
        Jo de rooh ko sukoon ke pal
        Koi mujhko yun mila hai
        Jaise banjaare ko ghar
        Naye mausam ki sehar
        Yaa sard mein dopahar
        Koi mujhko yun mila hai
        Jaise banjare ko ghar

        Now don’t that this one is from Ek Villain

    • says

      Sorry… I don’t watch Comedy nights with Kapil…..
      I watch only Shastri Sisters, Pavithra Rishta, Suhani si ek ladki, Is pyaar ko kya naam doon,laut aao trisha and Pyaar ka dard hai…..superb daily soaps…..do watch them….
      Also CID….”Darwaza thod do Daya”

      • says

        I have used -d option while compiling…..but of no use….
        whole page is filled with errors…something like m4_define errors…
        is it necessary to have both yacc.exe and lex.exe in the same folder

        • says

          Nope it isn’t necessary to keep them in the same folder πŸ™ actually it’s because of the program code incompatibility πŸ™ I will highly recommend if you can get the same code running in Linux bison to copy the header file from there or you can try to install lex and yacc on Ubuntu it isn’t a big deal πŸ™‚ for cse guys ”;)

          • says

            Ubuntu par baadh mein try karenge…..
            First say how to solve this problem in Windows 8…..
            If you don’t know seedhe seedhe bhol na πŸ˜›
            Itna bada paragraph likha…..phir bhi solution nahi hai….
            And we know that we are cse guys no need to stress:P

          • says

            Fixed in the new version :), Please uninstall any existing flex version and install the new version from the download links πŸ™‚
            I know but mere exams chal rahe the isliye was trying to postpone the update πŸ˜›

  17. Indhushree K says

    Happy Birthday Makhilesh πŸ™‚

    Words of wisdom:
    “Laugh when you still have teeth”
    πŸ™‚ πŸ™‚ πŸ˜›

  18. Indhushree K says

    Cannot compile yacc programs.
    y.tab.c and y.tab.h file are not created while compiling.
    m4_define errors are obtained.

    • says

      Fixed in the new version :), Please uninstall any existing flex version and install the new version from the download links πŸ™‚ , Thanks for reporting the issue,,

  19. mankishaa says

    i have exams from monday.. but i also have 16 somvaar vrat at siddi vinayaka temple.. wat shud i do?? shud i write exams or shud i go to temple??

  20. Ahmad Kadi says

    I would like to ask the following, please answer me.
    i followed the instruction in case 1
    after i pressed the execute button
    a window like cmd appeared without any characters, where should i insert the input file after that??

    • Ahmad Kadi says

      i solve it thank you
      what i have to do is to write test lexemes
      and the program will recognize it and execute the corresponding action
      and the print action will appear in the window

  21. Paul Yang says

    I like EditPlus IDE. Now I want to recompile source file (flexded.h) to increase variable MAXIMUM_MNS, I would like to get your advice ASAP. I know how to do this in Linux, but not in Windows.

    Thanks.

    Paul

    • says

      Thank you Paul for using the software πŸ™‚ though I haven’t tried it in Windows you can directly edit the header file and recompile it using gcc from mingw in Windows, I will recommend copying the edited header file from Linux into Windows, and the compiling it in Windows .
      thanks
      regards
      Chaitanya

  22. Paul Yang says

    Thank you very much, Chaitanya.

    I downloaded the flex source code from http://gnuwin32.sourceforge.net/packages/flex.htm which has
    file flexdef.h. In Linux, I run “./configure”, “make” and “make install”. The revised variable MAXIMUM_MNS will take effect. But in windows EditPlus IDE, I could not find file flexdef.h. Would you
    please recompile the whole package in your computer, then show me the procedure in details (I don’t
    know how to run command “./configure”, “make” “make install” in Windows.

    Best regards,

    Paul

    • says

      sure, I can show you the complete procedure but its not possible for me until 14th As my exams are going on πŸ™
      in the mean time you can search On Google for running make command On Windows it’s simple!

  23. says

    hi…listen when i want to execute a file it asks me the name of executable filename…where do i find the name..??
    is it the same name as the filename i created..??
    and also i cant use int yywrap function here..??

  24. says

    . When i click lex file compile and lex build , all ok. But unfortunately when i click in “Execute exe directly” cmd is not work and show as this follow. Please help me. What can i repair this error. This need to type scanner.exe,because of my lex file is scanner.l . But i don’t know where i can type this word”scanner.exe”. Please help me anybody.Thanks you .

    Volume in drive C has no label.
    Volume Serial Number is 3B2F-ED60

    Directory of C:\Users\Administrator\Desktop\lex

    01/18/2016 05:17 PM .
    01/18/2016 05:17 PM ..
    01/18/2016 06:05 PM 142,535 lex.yy.c
    01/18/2016 05:15 PM 105 Noname1.cpp
    01/18/2016 05:09 PM 27,338 scanner.l
    3 File(s) 169,978 bytes
    2 Dir(s) 14,670,237,696 bytes free
    .
    .
    Please enter the .exe of the Compiled File Name you want to execute
    .
    C:\Users\Administrator\Desktop\lex\scanner.exe
    ‘explorer.exe’ is not recognized as an internal or external command,
    operable program or batch file.
    Press any key to continue . . .

  25. says

    I’m unable to download the file. Clicking on the download link shows no response. please help me out as soon as possible. I have exams upcoming next week

  26. rupal says

    hello sir
    i download this package n install it successfully
    only problem is that when i follow the steps of execution in case 1 or 2 for CMD, it gives error for last step (i.e. Execute the program by typing .exe)
    the error is p.exe is not recognized as internal or external command, operable program or batch file
    plz help its urgent …..

  27. Nattiya says

    When I try to compile,it says commandprompt.bat is not recognized as an internal and external command, operable program or batch file. I added C:\Windows\System32 as path in my environmental variables. It still says it is not recognized.

    How to sort this out? help please

  28. Rufus says

    Greetings to you all,
    The download link to the application is broken. Is there any way to upload a new link to the IDE or reactivate the current one? Response will be highly appreciated.

    • says

      Hi Rufus,

      Thank you for bringing to our notice , we have fixed the broken links and updated the article with the new ones πŸ™‚ . Please try downloading using the new links. Thanks!

  29. Neelima Lalwani says

    The links that you have uploaded on Dropbox(activator.exe…) to resolve the error ‘Lex’ is not recognised as an internal or external command… , dont work. It directs me to the dropbox page that says the link has been temporarily disabled due to traffic on this account
    Please help.

  30. says

    “URGENT HELP”

    Hi i am trying to compile code from lex and yacc book by John R. Levine
    in the book the instructions for compiling are for unix below

    We called our various lexers chl-N.l, where TVcorresponded to a particular
    lex specification example. Similarly, we called our parsers chl-M.y, where
    again Mis the number of an example. Then, to build the output, we did the
    following in UNIX:

    lex chl- n.l
    yacc -d chl- m.y
    cc -c lex.yy.c y.tab.c
    cc -o example- m. n lex.yy.o y.tab.o -11
    which obviously won’t work.

    The .l file has no main function and .y has main function when i try to compile the .l file it gives error of winmain [email protected] is there any workaround for it using EditPlus IDE??
    please reply soon
    I have windows 10(64-bit) i have installed flex,bison,and trying to compile through ide
    the code link is below
    i am trying to compile files ch1-06.l ch1-06y ch1-06.h in prog.zip provided with book.
    http://examples.oreilly.com/9781565920002/progs.zip

  31. shoeb says

    hello.
    I have problem in execute exe directly.
    it syas ,
    explorer.exe’ is not recognized as an internal or external command,

    how can i solve this.

  32. Marko says

    Hi! I’d like to read an external txt file. How can I do? I ve tried in the yacc file this but it’s not working. Thanks!

    int main(void) {

    extern FILE *yyin;
    yyin = fopen(“file.txt”, “r”);

    if (yyin != NULL) {
    yyparse();
    fclose(yyin);
    } else {
    printf(“Not opened”);
    }
    }

Leave a Reply