How To Install Lex In Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian And MacOS?

How To Install Lex In Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian And MacOS?

lex

Lexical analyser generator.
Given the specification for a lexical analyser, generates C code implementing it.

Maintainer: Manoj Srivastava



Section: devel

Install lex

  • Debian apt-get install flex Click to copy
  • Ubuntu apt-get install flex Click to copy
  • Alpine OS apk add flex Click to copy
  • Arch Linux pacman -S flex Click to copy
  • Kali Linux apt-get install flex Click to copy
  • CentOS yum install flex Click to copy
  • Fedora dnf install flex Click to copy
  • Raspbian apt-get install flex Click to copy
  • macOS brew install flex Click to copy

Lexical analyser generator. Given the specification for a lexical analyser, generates C code implementing it.

How to use lex?

Below are few example commands for lex that you can use in the terminal.

Generate an analyser from a Lex file:
lex analyser.lClick to copy
Specify the output file:
lex analyser.l --outfile analyser.cClick to copy
Compile a C file generated by Lex:
cc path/to/lex.yy.c --output executableClick to copy
Installing lex command is simple. just copy one of the above commands for your operating system and paste it into terminal. This command is available for Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian and macOS operating systems. Once you run the command it will install the latest version of lex 2024 package in your OS.