Pages

Friday, November 18

Lex and Yacc in Windows 7 - Compile and Run


Hi Friend,
I was in search for a long time to get a platform in windows-7 to run lex and Yacc ,for academic purposes. Many of my friends also had the same problem and often forced to choose Linux only for merely executing Lex & Yacc programs..!!!

At last, I found one solution and its my pleasure to share it with all of you.!!  :)

Its very simple.You need to download two very small files.
You have to download two executable( i.e.,   .exe files). In total,its size may have about 370KB.

To download them click the links below.

Link 1:   Flex

Link 2:  Bison

Save both files in same place. ( I did in D: --> Flex)
Keep the lex program to be compiled also in same place.


Now open command prompt--> reach your directory through command prompt.

To compile, type command 
                flex <filename> (eg:- flex myflex.l)

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


We can compile this C file with any C compiler available (eg: Turbo C)

and generate yy.lex.exe

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




I hope this post was useful for you.!!
Please comment your feedback here.!!
Thank You.!!  :)








23 comments:

  1. There are fresh versions of Flex and Bison for windows platform at http://sourceforge.net/projects/winflexbison/ You can try it.

    ReplyDelete
  2. @Arjun
    thank u Arjun..!! I hope it was useful 4 u..!!

    ReplyDelete
  3. thanks for the information. it helps :)

    ReplyDelete
  4. Hello sir,
    ur blog is really very helpful...!!!
    sir am working on Parallelization in C compiler which uses lex and yacc...!!
    so need some little help from ur side..... would be very nice of u...!!

    ReplyDelete
  5. i'm not able to compile the lex.yy.c file...it is showing some warnings....what should i do nw?,...

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. having linker error while trying to execute the c file using tc

    ReplyDelete
  8. hey!when i execute counter.l cmd is showing
    D:\flex\flex counter.l
    flex:can't open ounter.l

    ReplyDelete
  9. Linker error..................

    ReplyDelete
  10. how to generate lex.yy.exe ??

    ReplyDelete
  11. Wow! I was searching for this of software to run yacc programs at home.

    ReplyDelete
  12. Please update your link for FLEX and BISON.Now,longer it is not available. After opening the link,webpage says "Object not Found!!!"
    Update your blog details ASAP..

    ReplyDelete
  13. how to compile and run yacc program in telnet?

    ReplyDelete
  14. hmm.. acha.. theek hai..

    ReplyDelete
  15. flex cant open my lex file?? what shall i do??

    ReplyDelete
  16. my laptop is windows 10 yaar,i could not able to download,plsss help me out

    ReplyDelete