/usr/share/doc/flex-doc/html/Options-for-Scanner-Speed-and-Size.html is in flex-doc 2.6.4-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
The flex manual is placed under the same licensing conditions as the
rest of flex:
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012
The Flex Project.
Copyright (C) 1990, 1997 The Regents of the University of California.
All rights reserved.
This code is derived from software contributed to Berkeley by
Vern Paxson.
The United States Government has rights in this work pursuant
to contract no. DE-AC03-76SF00098 between the United States
Department of Energy and the University of California.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. -->
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Options for Scanner Speed and Size (Lexical Analysis With Flex, for Flex 2.6.4)</title>
<meta name="description" content="Options for Scanner Speed and Size (Lexical Analysis With Flex, for Flex 2.6.4)">
<meta name="keywords" content="Options for Scanner Speed and Size (Lexical Analysis With Flex, for Flex 2.6.4)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Scanner-Options.html#Scanner-Options" rel="up" title="Scanner Options">
<link href="Debugging-Options.html#Debugging-Options" rel="next" title="Debugging Options">
<link href="Code_002dLevel-And-API-Options.html#Code_002dLevel-And-API-Options" rel="prev" title="Code-Level And API Options">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Options-for-Scanner-Speed-and-Size"></a>
<div class="header">
<p>
Next: <a href="Debugging-Options.html#Debugging-Options" accesskey="n" rel="next">Debugging Options</a>, Previous: <a href="Code_002dLevel-And-API-Options.html#Code_002dLevel-And-API-Options" accesskey="p" rel="prev">Code-Level And API Options</a>, Up: <a href="Scanner-Options.html#Scanner-Options" accesskey="u" rel="up">Scanner Options</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Options-for-Scanner-Speed-and-Size-1"></a>
<h3 class="section">16.4 Options for Scanner Speed and Size</h3>
<dl compact="compact">
<dt>‘<samp>-C[aefFmr]</samp>’</dt>
<dd><p>controls the degree of table compression and, more generally, trade-offs
between small scanners and fast scanners.
</p>
<dl compact="compact">
<dd><a name="index-_002dC"></a>
</dd>
<dt>‘<samp>-C</samp>’</dt>
<dd><p>A lone ‘<samp>-C</samp>’ specifies that the scanner tables should be compressed
but neither equivalence classes nor meta-equivalence classes should be
used.
</p>
<a name="option_002dalign"></a><a name="index-_002dCa"></a>
<a name="index-_002d_002d_002dalign"></a>
<a name="index-align"></a>
</dd>
<dt>‘<samp>-Ca, --align, <code>%option align</code></samp>’</dt>
<dd><p>(“align”) instructs flex to trade off larger tables in the
generated scanner for faster performance because the elements of
the tables are better aligned for memory access and computation. On some
RISC architectures, fetching and manipulating longwords is more efficient
than with smaller-sized units such as shortwords. This option can
quadruple the size of the tables used by your scanner.
</p>
<a name="option_002decs"></a><a name="index-_002dCe"></a>
<a name="index-_002d_002d_002decs"></a>
<a name="index-ecs"></a>
</dd>
<dt>‘<samp>-Ce, --ecs, <code>%option ecs</code></samp>’</dt>
<dd><p>directs <code>flex</code> to construct <em>equivalence classes</em>, i.e., sets
of characters which have identical lexical properties (for example, if
the only appearance of digits in the <code>flex</code> input is in the
character class “[0-9]” then the digits ’0’, ’1’, ..., ’9’ will all be
put in the same equivalence class). Equivalence classes usually give
dramatic reductions in the final table/object file sizes (typically a
factor of 2-5) and are pretty cheap performance-wise (one array look-up
per character scanned).
</p>
<a name="index-_002dCf"></a>
</dd>
<dt>‘<samp>-Cf</samp>’</dt>
<dd><p>specifies that the <em>full</em> scanner tables should be generated -
<code>flex</code> should not compress the tables by taking advantages of
similar transition functions for different states.
</p>
<a name="index-_002dCF"></a>
</dd>
<dt>‘<samp>-CF</samp>’</dt>
<dd><p>specifies that the alternate fast scanner representation (described
above under the ‘<samp>--fast</samp>’ flag) should be used. This option cannot be
used with ‘<samp>--c++</samp>’.
</p>
<a name="option_002dmeta_002decs"></a><a name="index-_002dCm"></a>
<a name="index-_002d_002d_002dmeta_002decs"></a>
<a name="index-meta_002decs"></a>
</dd>
<dt>‘<samp>-Cm, --meta-ecs, <code>%option meta-ecs</code></samp>’</dt>
<dd><p>directs
<code>flex</code>
to construct
<em>meta-equivalence classes</em>,
which are sets of equivalence classes (or characters, if equivalence
classes are not being used) that are commonly used together. Meta-equivalence
classes are often a big win when using compressed tables, but they
have a moderate performance impact (one or two <code>if</code> tests and one
array look-up per character scanned).
</p>
<a name="option_002dread"></a><a name="index-_002dCr"></a>
<a name="index-_002d_002d_002dread"></a>
<a name="index-read"></a>
</dd>
<dt>‘<samp>-Cr, --read, <code>%option read</code></samp>’</dt>
<dd><p>causes the generated scanner to <em>bypass</em> use of the standard I/O
library (<code>stdio</code>) for input. Instead of calling <code>fread()</code> or
<code>getc()</code>, the scanner will use the <code>read()</code> system call,
resulting in a performance gain which varies from system to system, but
in general is probably negligible unless you are also using ‘<samp>-Cf</samp>’
or ‘<samp>-CF</samp>’. Using ‘<samp>-Cr</samp>’ can cause strange behavior if, for
example, you read from <samp>yyin</samp> using <code>stdio</code> prior to calling
the scanner (because the scanner will miss whatever text your previous
reads left in the <code>stdio</code> input buffer). ‘<samp>-Cr</samp>’ has no effect
if you define <code>YY_INPUT()</code> (see <a href="Generated-Scanner.html#Generated-Scanner">Generated Scanner</a>).
</p></dd>
</dl>
<p>The options ‘<samp>-Cf</samp>’ or ‘<samp>-CF</samp>’ and ‘<samp>-Cm</samp>’ do not make sense
together - there is no opportunity for meta-equivalence classes if the
table is not being compressed. Otherwise the options may be freely
mixed, and are cumulative.
</p>
<p>The default setting is ‘<samp>-Cem</samp>’, which specifies that <code>flex</code>
should generate equivalence classes and meta-equivalence classes. This
setting provides the highest degree of table compression. You can trade
off faster-executing scanners at the cost of larger tables with the
following generally being true:
</p>
<div class="example">
<pre class="verbatim"> slowest & smallest
-Cem
-Cm
-Ce
-C
-C{f,F}e
-C{f,F}
-C{f,F}a
fastest & largest
</pre></div>
<p>Note that scanners with the smallest tables are usually generated and
compiled the quickest, so during development you will usually want to
use the default, maximal compression.
</p>
<p>‘<samp>-Cfe</samp>’ is often a good compromise between speed and size for
production scanners.
</p>
<a name="option_002dfull"></a><a name="index-_002df"></a>
<a name="index-_002d_002d_002dfull"></a>
<a name="index-full"></a>
</dd>
<dt>‘<samp>-f, --full, <code>%option full</code></samp>’</dt>
<dd><p>specifies
<em>fast scanner</em>.
No table compression is done and <code>stdio</code> is bypassed.
The result is large but fast. This option is equivalent to
‘<samp>--Cfr</samp>’
</p>
<a name="option_002dfast"></a><a name="index-_002dF"></a>
<a name="index-_002d_002d_002dfast"></a>
<a name="index-fast"></a>
</dd>
<dt>‘<samp>-F, --fast, <code>%option fast</code></samp>’</dt>
<dd><p>specifies that the <em>fast</em> scanner table representation should be
used (and <code>stdio</code> bypassed). This representation is about as fast
as the full table representation ‘<samp>--full</samp>’, and for some sets of
patterns will be considerably smaller (and for others, larger). In
general, if the pattern set contains both <em>keywords</em> and a
catch-all, <em>identifier</em> rule, such as in the set:
</p>
<div class="example">
<pre class="verbatim"> "case" return TOK_CASE;
"switch" return TOK_SWITCH;
...
"default" return TOK_DEFAULT;
[a-z]+ return TOK_ID;
</pre></div>
<p>then you’re better off using the full table representation. If only
the <em>identifier</em> rule is present and you then use a hash table or some such
to detect the keywords, you’re better off using
‘<samp>--fast</samp>’.
</p>
<p>This option is equivalent to ‘<samp>-CFr</samp>’. It cannot be used
with ‘<samp>--c++</samp>’.
</p>
</dd>
</dl>
<hr>
<div class="header">
<p>
Next: <a href="Debugging-Options.html#Debugging-Options" accesskey="n" rel="next">Debugging Options</a>, Previous: <a href="Code_002dLevel-And-API-Options.html#Code_002dLevel-And-API-Options" accesskey="p" rel="prev">Code-Level And API Options</a>, Up: <a href="Scanner-Options.html#Scanner-Options" accesskey="u" rel="up">Scanner Options</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|