Scroll to navigation

FLEX(1) Programming FLEX(1)

NAME

flex - the fast lexical analyser generator

SYNOPSIS

flex [OPTIONS] [FILE]...

DESCRIPTION

Generates programs that perform pattern-matching on text.

Table Compression:

trade off larger tables for better memory alignment
construct equivalence classes
do not compress tables; use -f representation
do not compress tables; use -F representation
construct meta-equivalence classes
use read() instead of stdio for scanner input
generate fast, large scanner. Same as -Cfr
use alternate table representation. Same as -CFr
default compression (same as --ecs --meta-ecs)

Debugging:

enable debug mode in scanner
write backing-up information to lex.backup
write performance report to stderr
suppress default rule to ECHO unmatched text
flex should run in trace mode
do not generate warnings
write summary of scanner statistics to stdout
use hexadecimal numbers instead of octal in debug outputs

FILES

specify output filename
specify skeleton file
write scanner on stdout instead of lex.yy.c
name of C++ class
create a C header file in addition to the scanner

--tables-file[=FILE] write tables to FILE

Scanner behavior:

-7, --7bit
generate 7-bit scanner
-8, --8bit
generate 8-bit scanner
generate batch scanner (opposite of -I)
ignore case in patterns
maximal compatibility with original lex
maximal compatibility with POSIX lex
generate interactive scanner (opposite of -B)
track line count in yylineno

Generated code:

-+, --c++
generate C++ scanner class
#define macro defn (default defn is '1')
suppress #line directives in scanner
use STRING as prefix instead of "yy"
generate a reentrant C scanner
scanner for bison pure parser.
include yylloc support.
initialize yyin/yyout to stdin/stdout
do not include <unistd.h>
do not generate a particular FUNCTION

Miscellaneous:

do-nothing POSIX option
do-nothing POSIX option

-?

produce this help message
report flex version

SEE ALSO

The full documentation for flex is maintained as a Texinfo manual. If the info and flex programs are properly installed at your site, the command

info flex

should give you access to the complete manual.

August 2021 The Flex Project