How to Install Lex-Yacc in Ubuntu / LinuxMint easily! Works on all Versions :)

Share

Recently, i had to install lex and yacc on quite a few ubuntu/installations because of college practicals exams (15-20 machines approximately) and that really fed me up 🙁 . Installing Lex and Yacc on Ubuntu/LinuxMint isn’t much difficult and is a cake-walk) if you can follow the correct steps as mentioned in this article –

Procedure to install Lex/Yacc on Ubuntu / LinuxMint

Pre-requisites :

An existing Ubuntu / Linux Mint Installation .

A working Internet connection.

Steps –

First of all connect your Ubuntu/LinuxMint to the Internet and Open terminal (you can use the shortcut Ctrl+Alt+t to open the terminal)

Now in terminal type the following command. (You can check the above image for the screenshot)

sudo apt-get update

Now, it will ask for your password – Please type the password for your Linux Account and hit Enter. (Note : While typing the password nothing will be visible on terminal –it’s normal simply continue typing your password and hit enter when you are done with it)

It may also ask for your permissions to update simply type “y” and hit enter , it will update its repositories through the internet, wait till the complete index update gets completed and it presents you with a terminal screen to enter command .

Now , first we will install the Lex package which is called as flex by typing the following command in terminal –

sudo apt-get install flex

Again it will , ask for confirmation , simply respond with “y” and hit enter. Lex will be successfully installed , and you will be presented with the terminal screen .

Now, Let’s move on to the installation of Yacc for which we will be using the bison package . Type the following command in the terminal to install yacc –

sudo apt-get install bison

That’s it the Yacc file too will be downloaded and installed , sometimes the Repository servers of bison are down and give errors in such cases you can use any of the following alternatives to install yacc.-

sudo apt-get install byacc

sudo apt-get install bison++

sudo apt-get install byacc -j

That’s it it was this much simple 🙂 , Happy Lex and Yacc programming.

If you have any doubts/or want to enquire about any issues/errors feel free to comment, I will be happy to help you 🙂 , also will be adding screenshots to this article once i am done with my practicals.

Reading package lists… Done
Building dependency tree
Reading state information… Done
Package flex is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source