MPE/iX Shell and Utilities Reference Manual, Vol 1

lex(1) MPE/iX Shell and Utilities lex(1)
NAME
lex — lexical analyzer generator
SYNOPSIS
lex [–achlntTv][–o file.c][–P proto][–p prefix][file.l ...]
DESCRIPTION
lex reads a description of a lexical syntax, in the form of regular expressions and actions,
from file.l. If you do not provide file.l or if the file is named , lex reads the description from
standard input. It produces a set of tables that, together with additional prototype code from
/etc/yylex.c, constitute a lexical analyzer to scan those expressions. lex places this
output in the file lex.yy.c. The resulting recognizer is suitable for use with yacc(1). For
detailed information on using lex, see the LEX Programming Guide.
The
LEX library contains a number of functions essential for use with lex (described in
lex(3)). The actual library to use depends on your system and compiler: for example, for
UNIX systems and POSIX–compliant systems, use -ll. You can specify this as an operand on
the c89 command line (see c89(1)). If you use a different compiler, you must create the
LEX
library yourself from the provided sources.
Some lex programs can cause one or more tables within lex to overflow. These tables are
the NFA, DFA, and move tables; lex displays an appropriate message if an overflow occurs.
You can change table sizes by inserting the appropriate line into the definition section of the
lex input, with the number size giving the number of entries to use. This is shown in Table
1-6, Internal Table Sizes.
Line Table Size Affected Default
%esize number of NFA entries 1000
%nsize number of DFA entries 500
%psize number of move entries 2500
Table 1-6: Internal Table Sizes
You can often reduce the NFA and DFA space to make room for more move entries.
Options
lex accepts the following options:
–a lets character classes refer to 8-bit characters (0200 through 0377). Normally, to
save table space, character classes only apply to the 7-bit character set. On systems
that use 8-bit character sets, this option is on by default, and cannot be turned off.
–c generates C code. As this is the default, this option is only provided for compatibility
with other implementations.
Commands and Utilities 1-287