home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 4
/
FreshFish_May-June1994.bin
/
gnu
/
man
/
catl
/
flex.0
next >
Wrap
Text File
|
1993-12-07
|
30KB
|
727 lines
FLEX(1) FLEX(1)
NNAAMMEE
flex - fast lexical analyzer generator
SSYYNNOOPPSSIISS
fflleexx [[--bbccddffiinnppssttvvFFIILLTT88 --CC[[eeffmmFF]] --SSsskkeelleettoonn]] _[_f_i_l_e_n_a_m_e _._._._]
DDEESSCCRRIIPPTTIIOONN
_f_l_e_x is a tool for generating _s_c_a_n_n_e_r_s_: programs which
recognized lexical patterns in text. _f_l_e_x reads the given
input files, or its standard input if no file names are
given, for a description of a scanner to generate. The
description is in the form of pairs of regular expressions
and C code, called _r_u_l_e_s_. _f_l_e_x generates as output a C
source file, lleexx..yyyy..cc,, which defines a routine yyyylleexx(())..
This file is compiled and linked with the --llffll library to
produce an executable. When the executable is run, it
analyzes its input for occurrences of the regular expres-
sions. Whenever it finds one, it executes the correspond-
ing C code.
For full documentation, see fflleexxddoocc((11)).. This manual entry
is intended for use as a quick reference.
OOPPTTIIOONNSS
_f_l_e_x has the following options:
--bb Generate backtracking information to _l_e_x_._b_a_c_k_t_r_a_c_k_.
This is a list of scanner states which require
backtracking and the input characters on which they
do so. By adding rules one can remove backtracking
states. If all backtracking states are eliminated
and --ff or --FF is used, the generated scanner will
run faster.
--cc is a do-nothing, deprecated option included for
POSIX compliance.
NNOOTTEE:: in previous releases of _f_l_e_x --cc specified
table-compression options. This functionality is
now given by the --CC flag. To ease the the impact
of this change, when _f_l_e_x encounters --cc,, it cur-
rently issues a warning message and assumes that --CC
was desired instead. In the future this "promo-
tion" of --cc to --CC will go away in the name of full
POSIX compliance (unless the POSIX meaning is
removed first).
--dd makes the generated scanner run in _d_e_b_u_g mode.
Whenever a pattern is recognized and the global
yyyy__fflleexx__ddeebbuugg is non-zero (which is the default),
the scanner will write to _s_t_d_e_r_r a line of the
form:
--accepting rule at line 53 ("the matched text")
Version 2.3 26 May 1990 1
FLEX(1) FLEX(1)
The line number refers to the location of the rule
in the file defining the scanner (i.e., the file
that was fed to flex). Messages are also generated
when the scanner backtracks, accepts the default
rule, reaches the end of its input buffer (or
encounters a NUL; the two look the same as far as
the scanner's concerned), or reaches an end-of-
file.
--ff specifies (take your pick) _f_u_l_l _t_a_b_l_e or _f_a_s_t _s_c_a_n_-
_n_e_r_. No table compression is done. The result is
large but fast. This option is equivalent to --CCff
(see below).
--ii instructs _f_l_e_x to generate a _c_a_s_e_-_i_n_s_e_n_s_i_t_i_v_e scan-
ner. The case of letters given in the _f_l_e_x input
patterns will be ignored, and tokens in the input
will be matched regardless of case. The matched
text given in _y_y_t_e_x_t will have the preserved case
(i.e., it will not be folded).
--nn is another do-nothing, deprecated option included
only for POSIX compliance.
--pp generates a performance report to stderr. The
report consists of comments regarding features of
the _f_l_e_x input file which will cause a loss of per-
formance in the resulting scanner.
--ss causes the _d_e_f_a_u_l_t _r_u_l_e (that unmatched scanner
input is echoed to _s_t_d_o_u_t_) to be suppressed. If
the scanner encounters input that does not match
any of its rules, it aborts with an error.
--tt instructs _f_l_e_x to write the scanner it generates to
standard output instead of lleexx..yyyy..cc..
--vv specifies that _f_l_e_x should write to _s_t_d_e_r_r a sum-
mary of statistics regarding the scanner it gener-
ates.
--FF specifies that the _f_a_s_t scanner table representa-
tion should be used. This representation is about
as fast as the full table representation _(_-_f_)_, and
for some sets of patterns will be considerably
smaller (and for others, larger). See fflleexxddoocc((11))
for details.
This option is equivalent to --CCFF (see below).
--II instructs _f_l_e_x to generate an _i_n_t_e_r_a_c_t_i_v_e scanner,
that is, a scanner which stops immediately rather
than looking ahead if it knows that the currently
scanned text cannot be part of a longer rule's
Version 2.3 26 May 1990 2
FLEX(1) FLEX(1)
match. Again, see fflleexxddoocc((11)) for details.
Note, --II cannot be used in conjunction with _f_u_l_l or
_f_a_s_t _t_a_b_l_e_s_, i.e., the --ff,, --FF,, --CCff,, or --CCFF flags.
--LL instructs _f_l_e_x not to generate ##lliinnee directives in
lleexx..yyyy..cc.. The default is to generate such direc-
tives so error messages in the actions will be cor-
rectly located with respect to the original _f_l_e_x
input file, and not to the fairly meaningless line
numbers of lleexx..yyyy..cc..
--TT makes _f_l_e_x run in _t_r_a_c_e mode. It will generate a
lot of messages to _s_t_d_o_u_t concerning the form of
the input and the resultant non-deterministic and
deterministic finite automata. This option is
mostly for use in maintaining _f_l_e_x_.
--88 instructs _f_l_e_x to generate an 8-bit scanner. On
some sites, this is the default. On others, the
default is 7-bit characters. To see which is the
case, check the verbose ((--vv)) output for "equiva-
lence classes created". If the denominator of the
number shown is 128, then by default _f_l_e_x is gener-
ating 7-bit characters. If it is 256, then the
default is 8-bit characters.
--CC[[eeffmmFF]]
controls the degree of table compression.
--CCee directs _f_l_e_x to construct _e_q_u_i_v_a_l_e_n_c_e _c_l_a_s_s_e_s_,
i.e., sets of characters which have identical lexi-
cal properties. Equivalence classes usually give
dramat