lex [–achlntTv] [–o file.c] [–P proto] [–p prefix] [file.l …]
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 (stdin). It produces a set of tables that, together with additional prototype code from /etc/yylex.c, constitute a lexical analyzer to scan those expressions. The resulting recognizer is suitable for use with yacc. You can find detailed information about the use of lex in z/OS UNIX System Services Programming Tools.
For a description of the typedefs, constants, variables, macros, and functions in the table file, which can be used to access the lexical analyzer's variables or to control its operations, see z/OS UNIX System Services Programming Tools.
A locale is the subset of a user's environment that depends on language and cultural conventions. A locale defines such things as the definition of characters, and the collation sequence of those characters. POSIX.2 defines a POSIX locale, which is essentially USASCII. Because lex generates code that is then compiled before being executed, it is difficult for lex to act properly on collation information. The POSIX.2 standard therefore does not require lex to accept any locales other than the POSIX locale. lex accepts regular expressions in this locale only.
The lex library contains a number of functions essential for use with lex. These functions are described in z/OS UNIX System Services Programming Tools . The actual library to use depends on your system and compiler. For z/OS programs, you should use –ll.
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. 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.
Line | Table size affected | Default |
---|---|---|
%esize | Number of NFA entries | 1000 |
%nsize | Number of DFA entries | 500 |
%psize | Number of move entries | 2500 |
You can often reduce the NFA and DFA space to make room for more move entries.
See Localization for more information.
The parser stack depth is limited to 150 levels. Attempting to process complicated syntaxes might result in an overflow, causing an error.
POSIX.2, POSIX.2 C-Language Development Utilities Option, UNIX systems.
The –a, –h, –l, –o, –p, –P, and –T options are extensions of the POSIX standard.