Wednesday, October 31, 2007

Installing lex and yacc on Ubuntu 6.10 !

An easy tutorial on installing lex and yacc tools on Ubuntu 6.10.
This is targeting an audience who would like to install the above compiler tools without having the aid of an ubuntu cd-rom , and for those who have not installed all the packages during installation.

The lex and yacc are compiler construction tools and are referred to as "flex" and "bison" packages respectively for Ubuntu.

First and foremost to check if lex and yacc are already present on your Ubuntu , click on the terminal and type the following

galacticosfan@galacticosfan:~$ which lex
galacticosfan@galacticosfan:~$ which yacc

If lex and yacc are already present , you will be notified by a message
" /usr/bin/lex" and " /usr/bin/yacc".

If such messages are not received , it would indicate that the tools are absent.

Simple guidelines to install "flex" and "bison" for Ubuntu :

1. Go to System---->Administration----> Synaptic Package Manager
Search for the "flex" package.


Apply mark for installation and click on "Apply" on the toolbar in the Synaptic Package Manager.

Similarly search for "bison" and mark for installation as shown



On applying changes you would come across the following screen

On applying changes the Operating system sets up flex and bison.

Now to confirm that flex and bison have been setup , go to the
terminal and type "which lex" and "which yacc"



The /usr/bin/lex shows that the flex tool has been setup,showing the same for yacc as well.

Alternatively u can install the above tools by issue the following commands

galacticosfan@galacticosfan:~$ sudo apt-get install flex
galacticosfan@galacticosfan:~$ sudo apt-get install bison

The tools will be installed automatically .