If you have programming experience in a UNIX environment, you have probably already come across Lex and YACC, or as Linux users know them, Flex and Bison. For those who didn’t know Flex is the implementation of the Lex program, and Bison is the GNU version of the YACC program. These programs are extremely useful for some tasks, so in today's article we will walk you through installing Lex and YACC on Linux. As an example, we will use the Ubuntu distribution.

Install LEX and YACC in Ubuntu

  1. Open a terminal. To do this, use the keyboard shortcut (Ctrl + Alt + T).
  2. To install Lex (Flex), use the command:
    sudo apt install flex
    Installing Lex using terminal
    To install YACC (Bison), use the command:
    sudo apt install bison
    YACC installation using Terminal
    Or so, for a faster installation of both programs:
    sudo apt install flex bison

Done, now you can use LEX and YACC for your tasks. Still have questions? Write to us in the comments.