You are on page 1of 4

Guidelines for Installing and Executing Lex and Yacc Programs in Windows

Step 1 : Download the setup for Flex (Lexical analyzer) and Bison (for Yacc) from Gnu Win Packages

Now, Click on Setup against Bison Package (See in Below Figure)

After clicking on “Setup” you will get this page , Click on Save File
Repeat the same steps for Flex Package , Click on Set up

You will get this page

Step 2: Install Bison

Click on Next

Select “I Accept Agreement” , click on Next

Important step : You see here “C:\Program files (x86)\GnuWin32” (Remove the Red color part) then
click on Next

Select components (Do nothing) , Click on Next


Click on next

Additional Icon (Remove tick mark from first check box), Click on Next

Click on Install

Click on Finish

Do the same process for Flex

Step – 3:

Go to C Drive and Copy the Path

Step – 4:

Set Path in Environment Variables

Right click on “This PC”  Properties  Advance System Settings  Environment Variable
Go to Path and Paste “C:\GnuWin32\bin” , Then Click OK

Step -5 : Take any sample Program written in lex in Desktop. (eg : 6a.l) Open cmd and follow below
mentioned process.

cd Desktop

lex 6a.l <lex <filename> >

you see after this command you will have lex.yy.c file

gcc lex.yy.c

a.exe

Answer for lex program

You might also like