How to install Lex & Yacc in Linux Mint

Many of my friends had problem installing Linux O.S ,so here's a short tutorial on installing
a)Linux O.S 
b)Lex and Yacc.

To start with we need these:
a>  CD/DVD or an ISO image of your favorite distro
b>  VirtualBox or Vmware
c>  Internet connection

 Step 1: Install VirtualBox .Follow this video
Step 2:After successful installation of the O.S ,login as the root. Step 3:Open the terminal(shortcut: ctrl+alt+T) Step 4:Type these commands one after the other (These commands work only in Ubuntu/Linux Mint,guys who are using fedora look at the end of the post ) 1> $sudo apt-get install flex (installs lex) 2> $sudo apt-get install bison (installs yacc) You will be asked to type your password . On giving the correct password ,you will be shown something like "do you want to install these packages?... It will need XYZ bytes of additional memory....." , press "y". Hit enter. Step 5: That's it.....we are done. If you have any problems in installation,leave me a message in the comment section below,i will replay ASAP. Related articles : How to install lex and yacc in fedora(

15 thoughts on “How to install Lex & Yacc in Linux Mint

  1. After installing these packages am not able to execute the programs… this is the error message what i got … raj@Raj ~/flex $ cc lex.yy.c -ll
    lex.yy.c:19:19: fatal error: stdio.h: No such file or directory
    compilation terminated.

    Please help me out …. Thank you…..

    1. Hi rajesh,the data you have given is insufficient to identify the exact problem. But i think that there is a typing mistake in your lex file. Indentation matter a lot in lex & yacc programming,post your lex file in the reply.

      Another possibility is that you dont have gcc compiler installed,to install goto your terminal and type

      $sudo apt-get install gcc build-essential

      Hope this solves your problem.Let me know if you encounter any other problems while running your lex program

  2. This is what i get,
    “sagar@ubuntu:~$ 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”

    please tell what i have to do.?

    1. I am not sure buddy,i just reinstalled the package on my system to check and it works fine.This works only for Debian based O.S like Ubuntu ,Linux-mint ,Backtrack etc…What O.S are you using?

      1. which password should i enter .i m not able to write anything in password when it appears in vi editor or terminals..

      2. gitesh that’s part of the Linux security system,you don’t see anything while typing your password. Just go ahead,type your password even if you don’t see anything and press enter

    1. You have to enter the administrator password, or you can enter your password if you have the permission to install packages.

Comments are closed.