Generate programs for lexical tasks


flex [-bcdfhilnpstvwBFILTV78+? -C[aefFmr] -ooutput
      -Pprefix -Sskeleton] [--help --version] [file ...]

Runs on:

QNX Neutrino, Linux, Microsoft Windows


Generate C++ scanner class.
Generate 7-bit scanner.
Generate 8-bit scanner.
Display a help message.
Generate batch scanner (opposite of -I).
Generate backing-up information to lex.backup.
Specify the degree of table compression (default is -Cem):
  • -Ca — trade off larger tables for better memory alignment.
  • -Ce — construct equivalence classes.
  • -Cf — don't compress scanner tables; use -f representation.
  • -CF — don't compress scanner tables; use -F representation.
  • -Cm — construct meta-equivalence classes.
  • -Cr — use read() instead of standard I/O for scanner input.
Do-nothing POSIX option.
Turn on debug mode in generated scanner.
Use the alternative fast scanner representation.
Generate fast, large scanner.
Display a help message.
Generate an interactive scanner (opposite of -B).
Generate case-insensitive scanner.
Suppress #line directives in scanner.
("el") Provide maximal compatibility with original lex.
Do-nothing POSIX option.
Specify the output filename.
Specify a scanner prefix other than yy.
Generate a performance report to stderr.
Specify the skeleton file.
Suppress default rule to ECHO unmatched text.
Run flex in trace mode.
Write the generated scanner on stdout instead of lex.yy.c.
Report the flex version.
Write a summary of scanner statistics.
Don't generate warnings.
Display a help message.
Report the flex version.


The flex command generates programs for lexical tasks.

QNX does not provide the flex library (libfl.a). If you wish to generate code that is not dependent on this library, add the following line as the first line in your lex source file:

%option noyywrap

Otherwise, the undefined yywrap() function will result in a link error.

For more information, see the GNU website at http://www.gnu.org/.

Contributing author: