_ap_ufes{"success":true,"siteUrl":"techapple.net","urls":{"Home":"http://techapple.net","Category":"http://techapple.net/category/mobileno/plans-news/airtel/","Archive":"http://techapple.net/2018/07/","Post":"http://techapple.net/2018/07/install-memu-nougat-emulator-pc-laptop-windows-10-7-8-1/","Page":"http://techapple.net/69328-2/","Attachment":"http://techapple.net/2014/05/3-best-android-emulators-for-mac-os-macbook-run-and-install-android-app-on-your-mac-os-x-macbook-airpro/noxd/","Nav_menu_item":"http://techapple.net/2018/06/69513/","Custom_css":"http://techapple.net/2018/06/newspaper/","Social-site":"http://techapple.net/cpt-social-site/167/","Special-content":"http://techapple.net/cpt-special-content/special-content-one/"}}_ap_ufee
LOADING

Type to search

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

23 Comments

  1. umesh toke October 5, 2014

    Nice Post Chaitanya, I would like to refer a video on youtube which does the same thing that you wrote above but in a non terminal way, for more readers can click here

    Reply
    1. Chaitanya October 6, 2014

      Thank you Umesh for the compliment and link 🙂

  2. Mahendra November 27, 2014

    thank you for helpful information…!!

    Reply
  3. Mohit June 5, 2015

    when i tried sudo apt-get install flex,

    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

    Reply
  4. Bidur Handique October 14, 2015

    thanks..

    Reply
  5. Keekri October 30, 2015

    Thank you!
    This helped a lot when I had to prepare for my own practical exam!! 😀

    Reply
    1. Chaitanya October 30, 2015

      Hello Keerthana, you’re welcome. Infact I too wrote this article last year when I was tired searching for a method to get these two installed as I too jad my practical examinations 😛

  6. Venky November 1, 2015

    sudo apt-get install byacc -j is not working.. it says command j not known from -j

    Reply
    1. shekhar November 6, 2015

      dont give space b\w from and -j

  7. shekhar November 6, 2015

    thanks a lot guru

    Reply
  8. Subhash Sharma November 8, 2015

    Iam also facing the same problem as Mohith is facing… Plz anyone answer the problem.

    Reply
  9. Guru kiran November 21, 2015

    [email protected]:~$ sudo apt-get install byacc -j
    E: Command line option ‘j’ [from -j] is not known.

    Reply
  10. Anita February 15, 2016

    Thank you so much …

    Reply
  11. rania February 17, 2016

    thank you

    Reply
  12. Abhishek Ghorpade October 13, 2016

    for kali linux??

    Reply
  13. Charmila November 9, 2016

    I followed the same steps what u told but couldn’t compile the lex program
    What might be the error??

    Reply
  14. Rani s November 19, 2016

    thank you so much

    Reply
  15. Maithri hegde November 25, 2016

    thank you so much for the information:)

    Reply
  16. sathya December 24, 2016

    after installing the lex and yacc tools in ubuntu, is internet required to run the lab programs?

    Reply
  17. Juan June 5, 2017

    Thanks for this post. It helps me very much.

    Reply
  18. saurabh July 7, 2017

    It is saying index file failed to download.they have been ignored or old ones used …what to do now…

    Reply
  19. Tanvi February 21, 2018

    Thanks a lot.

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: