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 :

Anonymous said... Best Blogger Tips [Reply to comment] Best Blogger Templates

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

Arjun said... Best Blogger Tips [Reply to comment] Best Blogger Templates

osum man!! \m/

v!p!n said... Best Blogger Tips [Reply to comment] Best Blogger Templates

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

Mohammad Rahman said... Best Blogger Tips [Reply to comment] Best Blogger Templates

thanks for the information. it helps :)

v!p!n said... Best Blogger Tips [Reply to comment] Best Blogger Templates

Nice to know that.....:)

Rahul koul said... Best Blogger Tips [Reply to comment] Best Blogger Templates

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...!!

sachinkalsi15 said... Best Blogger Tips [Reply to comment] Best Blogger Templates

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

abhi CEA said... Best Blogger Tips [Reply to comment] Best Blogger Templates
This comment has been removed by the author.
Anonymous said... Best Blogger Tips [Reply to comment] Best Blogger Templates

Same here...
pls helpp

hemant said... Best Blogger Tips [Reply to comment] Best Blogger Templates

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

Unknown said... Best Blogger Tips [Reply to comment] Best Blogger Templates

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

Anonymous said... Best Blogger Tips [Reply to comment] Best Blogger Templates

Linker error..................

Unknown said... Best Blogger Tips [Reply to comment] Best Blogger Templates

how to compile yacc programs

Prasanna said... Best Blogger Tips [Reply to comment] Best Blogger Templates

@Amrutesh M Mahadev

Same question dude..

Unknown said... Best Blogger Tips [Reply to comment] Best Blogger Templates

how to generate lex.yy.exe ??

Bhaskar Sharma said... Best Blogger Tips [Reply to comment] Best Blogger Templates

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

Anonymous said... Best Blogger Tips [Reply to comment] Best Blogger Templates

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..

Unknown said... Best Blogger Tips [Reply to comment] Best Blogger Templates

link not working

Unknown said... Best Blogger Tips [Reply to comment] Best Blogger Templates

how to compile and run yacc program in telnet?

Unknown said... Best Blogger Tips [Reply to comment] Best Blogger Templates

Very useful

Anonymous said... Best Blogger Tips [Reply to comment] Best Blogger Templates

hmm.. acha.. theek hai..

Anonymous said... Best Blogger Tips [Reply to comment] Best Blogger Templates

flex cant open my lex file?? what shall i do??

Anonymous said... Best Blogger Tips [Reply to comment] Best Blogger Templates

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

Post a Comment