ADC Home > Reference Library > Reference > Mac OS X > Mac OS X Man Pages


This document is a Mac OS X manual page. Manual pages are a command-line technology for providing documentation. You can view these manual pages locally using the man(1) command. These manual pages come from many different sources, and thus, have a variety of writing styles.

This manual page is associated with the Mac OS X developer tools. The software or headers described may not be present on your Mac OS X installation until you install the developer tools package. This package is available on your Mac OS X installation DVD, and the latest versions can be downloaded from

For more information about the manual page format, see the manual page for manpages(5).

FLEX(1)                                         User Commands                                        FLEX(1)

       flex - fast lexical analyzer generator

       flex [OPTIONS] [FILE]...

       Generates programs that perform pattern-matching on text.

   Table Compression:
       -Ca, --align
              trade off larger tables for better memory alignment

       -Ce, --ecs
              construct equivalence classes

       -Cf    do not compress tables; use -f representation

       -CF    do not compress tables; use -F representation

       -Cm, --meta-ecs
              construct meta-equivalence classes

       -Cr, --read
              use read() instead of stdio for scanner input

       -f, --full
              generate fast, large scanner. Same as -Cfr

       -F, --fast
              use alternate table representation. Same as -CFr

       -Cem   default compression (same as --ecs --meta-ecs)

       -d, --debug
              enable debug mode in scanner

       -b, --backup
              write backing-up information to lex.backup

       -p, --perf-report
              write performance report to stderr

       -s, --nodefault
              suppress default rule to ECHO unmatched text

       -T, --trace
              flex should run in trace mode

       -w, --nowarn
              do not generate warnings

       -v, --verbose
              write summary of scanner statistics to stdout

       -o, --outfile=FILE
              specify output filename

       -S, --skel=FILE
              specify skeleton file

       -t, --stdout
              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

       -B, --batch
              generate batch scanner (opposite of -I)

       -i, --case-insensitive
              ignore case in patterns

       -l, --lex-compat
              maximal compatibility with original lex

       -X, --posix-compat
              maximal compatibility with POSIX lex

       -I, --interactive
              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')

       -L,  --noline
              suppress #line directives in scanner

       -P,  --prefix=STRING
              use STRING as prefix instead of "yy"

       -R,  --reentrant
              generate a reentrant C scanner

              scanner for bison pure parser.

              include yylloc support.

              initialize yyin/yyout to stdin/stdout

       --noansi-definitions old-style function definitions

              empty parameter list in prototypes

              do not include <unistd.h>

              do not generate a particular FUNCTION

       -c     do-nothing POSIX option

       -n     do-nothing POSIX option


       -h, --help
              produce this help message

       -V, --version
              report flex version

       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.

flex 2.5.33                                     February 2006                                        FLEX(1)

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.