2.5.39 GPL (GNU General Public License)    
3.5/5 35


A fast, Open Source and cross-platform lexical analyzer and scanner generator tool

editor's review




Flex is widely known as the fast lexical analyser and it’s an open source, totally free and multi-platform command-line application implemented in C/C++ and designed from the offset to be used for generating scanners.

The scanners generated by the Flex tool, which shouldn’t be confused with a non-GNU free implementation of Lex, are actually programs that can recognize lexical patterns in text, also known as applications that perform pattern-matching on text.

Flex has been designed in such a way that it can generate a C source file called "lex.yy.c" which can define the yylex() function. The software is a command-line tool, so you can use it via any terminal emulator.

Command-line options

The program’s command-line options are organized in categories like table compression, debugging, files, scanner behavior, generated code and miscellaneous. To see them at a glance, run the ‘flex --help’ command after installing the software on your system.

Among the table compression command-line options, we can mention the ability to construct equivalence and/or meta-equivalence classes, to use an alternate table representation, to use default compression, to generate a large and fast scanner, as well as to not compress tables.

Debugging command-line options include support for enabling debug mode in scanner, support for writing summary of scanner statistics to stdout, support for running Flex in trace mode, as well as support for writing backing-up information to a specific file and a performance report to stderr.

The scanner behavior can also be customized via command-line options, which include support for generating 7-bit or 8-bit scanners, support for generating a batch scanner, support for generating an interactive scanner, as well as support for tracking line count in yylineno.

Supports 32-bit/64-bit Linux and BSD platforms

The software has been written entirely in the C and C++ programming language and it is known to work well on both Linux and FreeBSD operating systems. Currently, it can be installed on computers supporting either of the 64-bit or 32-bit instruction set architectures.
Flex was reviewed by
Last updated on December 5th, 2014

#lexical analyzer #scanner generator #generate scanner #lexical #analyzer #scanner #generator

Flex - The usage message of the Flex utility, as viewed from the Linux TerminalFlex - Various command-line options of the Flex programFlex - The help message of the Flex software, as viewed from the Terminal app

5 User reviews so far. Load top Load all