%!PS-Adobe-1.0 %%Creator: devps (Pipeline Associates, Inc.) %%CreationDate: Fri Sep 13 13:03:43 1996 %%Pages: (atend) %%DocumentFonts: (atend) /devps 180 dict def devps begin /res 10.000000 def /y_offset 843 def /X{exch}bind def /mm {transform round X round X itransform} bind def /r{rmoveto}bind def /m{moveto}bind def /l{lineto}bind def /rl{rlineto}bind def /st{stroke}bind def /gs{gsave}bind def /gr{grestore}bind def /cp{currentpoint}bind def /np{newpath}bind def /ct{curveto}bind def systemdict /setpacking known { /savepacking currentpacking def true setpacking } if /m0{0 0 moveto}bind def /xc{//res div}bind def /yc{//res neg div //y_offset add}bind def /lc{yc X xc X l st}bind def /mc{yc X xc X m}bind def /el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}bind def /ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}bind def /sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}bind def /V{//res neg div //y_offset add currentpoint pop X m}bind def /H{//res div 0 transform X round X itransform pop currentpoint X pop moveto}bind def /h{//res div 0 r}bind def /v{//res neg div 0 X r}bind def /S{X H show}bind def /A{H //res div 1 index stringwidth pop sub 1 index length div 0 3 2 roll ashow}bind def /psize 10 def /height 0 def /cheight { height 0 ne { height } { psize } ifelse } bind def /slant 0 def /FF{findfont X dup 30 div 0 mm pop setlinewidth /psize X def [psize 0 cheight slant sin slant cos div mul cheight 0 0] makefont setfont}bind def /shade{gs /dy X def /dx X def np m 0 /dy rl /dx 0 rl 0 /dy neg rl /dx neg 0 rl closepath .9 setgray fill gr}bind def 1 setlinecap /resolution res 72 mul def /startFig { /SavedState save def userdict maxlength dict begin currentpoint transform DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap setlinewidth setmatrix itransform moveto /ury exch def /urx exch def /lly exch def /llx exch def /y exch 72 mul resolution div def /x exch 72 mul resolution div def currentpoint /cy exch def /cx exch def /sx x urx llx sub div def /sy y ury lly sub div def sx sy scale cx sx div llx sub cy sy div ury sub translate /DefFigCTM matrix currentmatrix def /initmatrix { DefFigCTM setmatrix } def /defaultmatrix { DefFigCTM exch copy } def /initgraphics { DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap setlinewidth setmatrix DefFigCTM setmatrix } def /showpage { initgraphics } def }bind def /clipFig { currentpoint 6 2 roll newpath 4 copy 4 2 roll moveto 6 -1 roll exch lineto exch lineto exch lineto closepath clip newpath moveto }bind def /doclip { llx lly urx ury clipFig } def /endFig { end SavedState restore }bind def /globalstart { fontnum psize slant height resolution currentpoint pagesave restore gsave }bind def /globalend { grestore moveto /resolution exch def /height exch def /slant exch def /psize exch def /fontnum exch def F /pagesave save def }bind def /fontnum 1 def systemdict /setpacking known { savepacking setpacking} if end /BP{ save mark devps begin m0 /DocumentInitState [ matrix currentmatrix currentlinewidth currentlinecap currentlinejoin currentdash currentgray currentmiterlimit ] cvx def }bind def /EP{ end cleartomark restore showpage}def /R{/Times-Roman FF}def /B{/Times-Bold FF}def /I{/Times-Italic FF}def /Encoding-1 256 array def 0 1 255 {Encoding-1 exch /.notdef put} for Encoding-1 8#301 StandardEncoding 8#101 26 getinterval putinterval %A-B Encoding-1 8#341 StandardEncoding 8#141 26 getinterval putinterval %a-b Encoding-1 8#241 StandardEncoding 8#301 16 getinterval putinterval %accents Encoding-1 8#373 StandardEncoding 8#365 1 getinterval putinterval %dotlessi Encoding-1 dup 8#41 /copyright put dup 8#42 /registered put dup 8#43 /trademark put dup 8#44 /logicalnot put dup 8#45 /Eth put dup 8#46 /eth put dup 8#47 /Thorn put dup 8#50 /thorn put dup 8#51 /brokenbar put dup 8#52 /degree put dup 8#53 /divide put dup 8#54 /multiply put dup 8#55 /minus put dup 8#56 /onehalf put dup 8#57 /onequarter put dup 8#60 /threequarters put dup 8#101 /Aacute put dup 8#102 /Acircumflex put dup 8#103 /Adieresis put dup 8#104 /Agrave put dup 8#105 /Aring put dup 8#106 /Atilde put dup 8#107 /Ccedilla put dup 8#110 /Eacute put dup 8#111 /Ecircumflex put dup 8#112 /Edieresis put dup 8#113 /Egrave put dup 8#114 /Iacute put dup 8#115 /Icircumflex put dup 8#116 /Idieresis put dup 8#117 /Igrave put dup 8#120 /Ntilde put dup 8#121 /Oacute put dup 8#122 /Ocircumflex put dup 8#123 /Odieresis put dup 8#124 /Ograve put dup 8#125 /Otilde put dup 8#126 /Scaron put dup 8#127 /Uacute put dup 8#130 /Ucircumflex put dup 8#131 /Udieresis put dup 8#132 /Ugrave put dup 8#133 /Ydieresis put dup 8#134 /Zcaron put dup 8#135 /aacute put dup 8#136 /acircumflex put dup 8#137 /adieresis put dup 8#140 /agrave put dup 8#141 /aring put dup 8#142 /atilde put dup 8#143 /ccedilla put dup 8#144 /eacute put dup 8#145 /ecircumflex put dup 8#146 /edieresis put dup 8#147 /egrave put dup 8#150 /iacute put dup 8#151 /icircumflex put dup 8#152 /idieresis put dup 8#153 /igrave put dup 8#154 /ntilde put dup 8#155 /oacute put dup 8#156 /ocircumflex put dup 8#157 /odieresis put dup 8#160 /ograve put dup 8#161 /otilde put dup 8#162 /scaron put dup 8#163 /uacute put dup 8#164 /ucircumflex put dup 8#165 /udieresis put dup 8#166 /ugrave put dup 8#167 /ydieresis put dup 8#170 /zcaron put pop /Enc-dict 30 dict def Enc-dict /tmpstr1 50 string put Enc-dict /tmpstr2 50 string put Enc-dict /tmpstr3 50 string dup (Encoding-) exch cvs pop put /AEnc-def { % arguments: the original font's name, encoding nr Enc-dict begin tmpstr2 cvs /Enc-no exch def % Remember the number in a string dup /OrigName exch def % remember the name findfont dup maxlength dict /newdict exch def % get dictionary for new font { exch dup /FID ne { exch newdict 3 1 roll put } { pop pop } % Ignore FID ifelse } forall newdict begin /Encoding tmpstr3 9 Enc-no putinterval tmpstr3 0 9 Enc-no length add getinterval cvn load def % Replace encoding currentdict /UniqueID known { /UniqueID UniqueID Enc-no cvi 49999 mul add def } if % Derive New UniqueID end % newdict /FNlength OrigName tmpstr1 cvs length def % convert name, remember length FNlength 1 add Enc-no length add string dup 0 OrigName tmpstr1 cvs putinterval dup FNlength (-) putinterval dup FNlength 1 add Enc-no putinterval dup 0 tmpstr1 0 FNlength getinterval putinterval % Add old name cvn dup newdict /FontName 3 2 roll put newdict definefont end % Enc-dict } def /Times-Bold 1 AEnc-def pop /B-1{/Times-Bold-1 FF}def %%EndProlog %%Page: 1 1 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 9 R 720(N)S 722(NA)S 790(AM)S 858(ME)S 940(E)S 1080 V 10 R (\257exdoc)296 1080 A 1401(-)S 1460(fast)S 1631(lexical)S 1925(analyzer)S 2292(generator)S 1248 V 9 R 720(S)S 722(SY)S 774(YN)S 842(NO)S 910(OP)S 978(PS)S 1030(SI)S 1082(IS)S 1115(S)S 1368 V 10 B 1080(\257ex)S ([-bcd\256npstvFILT8)801 1269 A 2108(-C[efmF])S 2546(-Sskeleton])S 10 I 3061([\256lename)S (...])114 3479 A 1536 V 9 R 720(D)S 722(DE)S 790(ES)S 848(SC)S 900(CR)S 962(RI)S 1024(IP)S 1057(PT)S 1109(TI)S 1167(IO)S 1200(ON)S 1268(N)S 1656 V 10 I 1080(\257ex)S 10 R 1246(is)S 1339(a)S 1410(tool)S 1592(for)S 1737(generating)S 10 I (scanners:)391 2189 A 10 R 2607(programs)S 3014(which)S (recognized)442 3287 A 3756(lexical)S 4052(patterns)S 4398(in)S 4503(text.)S 10 I 4731(\257ex)S 10 R 4898(reads)S 5138(the)S 1776 V 1080(given)S (input)206 1334 A 1571(\256les,)S 1795(or)S 1910(its)S 2036(standard)S (input)206 2408 A 2645(if)S 2738(no)S 2869(\256le)S 3028(names)S 3315(are)S 3469(given,)S 3747(for)S 3895(a)S 3970(description)S 4447(of)S 4561(a)S 4636(scanner)S 4974(to)S 5082(gen-)S 1896 V 1080(erate.)S 1356(The)S 1542(description)S 2018(is)S 2114(in)S 2221(the)S 2373(form)S 2599(of)S 2713(pairs)S 2939(of)S 3053(regular)S 3369(expressions)S 3868(and)S 4043(C)S 4140(code,)S 4385(called)S 10 I 4656(rules.)S 4912(\257ex)S 10 R 5082(gen-)S 2016 V 1080(erates)S 1355(as)S 1478(output)S 1773(a)S 1857(C)S 1963(source)S 2265(\256le,)S 10 B 2458(lex.yy.c,)S 10 R 2840(which)S 3125(de\256nes)S 3449(a)S 3533(routine)S 10 B 3857(yylex\(\).)S 10 R 4212(This)S 4430(\256le)S 4598(is)S 4704(compiled)S 5116(and)S 2136 V 1080(linked)S 1362(with)S 1572(the)S 10 B 1726(-l\257)S 10 R 1875(library)S 2175(to)S (produce)324 2285 A 2641(an)S 2768(executable.)S 3281(When)S 3553(the)S 3708(executable)S 4171(is)S 4270(run,)S 4461(it)S 4549(analyzes)S 4928(its)S (input)206 5055 A 2256 V 1080(for)S 1239(occurrences)S 1762(of)S 1887(the)S 2051(regular)S 2378(expressions.)S 2938(Whenever)S 3392(it)S 3488(\256nds)S 3723(one,)S 3933(it)S 4029(executes)S 4416(the)S (corresponding)575 4579 A 5194(C)S 2376 V 1080(code.)S 2544 V 9 R 720(S)S 722(SO)S 774(OM)S 842(ME)S 924(E)S 1020(S)S 1022(SI)S 1074(IM)S 1107(MP)S 1189(PL)S 1241(LE)S 1299(E)S 1395(E)S 1397(EX)S 1455(XA)S 1523(AM)S 1591(MP)S 1673(PL)S 1725(LE)S 1783(ES)S 1841(S)S 2664 V 10 R 1080(First)S 1295(some)S 1537(simple)S 1835(examples)S 2245(to)S 2353(get)S 2506(the)S 2659(\257avor)S 2925(of)S 3040(how)S 3244(one)S 3420(uses)S 10 I 3624(\257ex.)S 10 R 3820(The)S 4008(following)S 10 I 4430(\257ex)S 10 R (input)206 4601 A 4838(speci\256es)S 5216(a)S 2784 V 1080(scanner)S 1413(which)S 1684(whenever)S 2101(it)S (encounters)436 2182 A 2643(the)S 2791(string)S 3045("username")S (will)157 3538 A (replace)292 3720 A 4037(it)S 4118(with)S 4322(the)S 4470(user's)S 4736(login)S 4967(name:)S 3024 V 1180(%%)S 3144 V 1180(username)S 1666(printf\()S 1949("%s",)S 2204(getlogin\(\))S 2626(\);)S 3384 V 1080(By)S 1236(default,)S 1580(any)S 1764(text)S 1954(not)S 2121(matched)S 2501(by)S 2640(a)S 10 I 2724(\257ex)S 10 R 2903(scanner)S 3250(is)S 3356(copied)S 3664(to)S 3782(the)S 3945(output,)S 4266(so)S 4395(the)S 4558(net)S 4721(effect)S 4992(of)S 5116(this)S 3504 V 1080(scanner)S 1427(is)S 1533(to)S (copy)195 1650 A 1884(its)S (input)206 2018 A 2262(\256le)S 2429(to)S 2545(its)S 2678(output)S 2972(with)S (each)185 3189 A 3412(occurrence)S 3893(of)S 4015("username")S 4521(expanded.)S 4994(In)S 5116(this)S 3624 V (input,)231 1080 A 1341(there)S 1573(is)S 1670(just)S 1845(one)S 2020(rule.)S 2257("username")S 2755(is)S 2852(the)S 10 I 3005(pattern)S 10 R 3325(and)S 3500(the)S 3653("printf")S 3989(is)S 4086(the)S 10 I 4239(action.)S 10 R 4546(The)S 4734("%%")S 5015(marks)S 3744 V 1080(the)S 1228(beginning)S 1654(of)S 1763(the)S 1911(rules.)S 3912 V 1080(Here's)S 1375(another)S 1702(simple)S 1995(example:)S 4152 V 1280(int)S 1411(num_lines)S 1854(=)S 1936(0,)S 2036(num_chars)S 2502(=)S 2584(0;)S 4392 V 1180(%%)S 4512 V 1180(\\n)S 1358(++num_lines;)S 1943(++num_chars;)S 4632 V 1180(.)S 1330(++num_chars;)S 4872 V 1180(%%)S 4992 V 1180(main\(\))S 5112 V 1280({)S 5232 V 1280(yylex\(\);)S 5352 V 1280(printf\()S 1563("#)S 1679(of)S 1788(lines)S 2003(=)S 2085(%d,)S 2269(#)S 2344(of)S 2453(chars)S 2691(=)S 2773(%d\\n",)S 5472 V 1480(num_lines,)S 1948(num_chars)S 2414(\);)S 5592 V 1280(})S 5832 V 1080(This)S 1285(scanner)S (counts)262 1619 A 1907(the)S 2056(number)S 2389(of)S 2499(characters)S 2935(and)S 3106(the)S 3255(number)S 3588(of)S 3698(lines)S 3914(in)S 4018(its)S (input)206 4139 A 4371(\(it)S (produces)363 4488 A 4878(no)S 5005(output)S 5952 V 1080(other)S 1340(than)S 1566(the)S 1741(\256nal)S 1972(report)S 2265(on)S 2417(the)S (counts\).)321 2592 A 2990(The)S 3199(\256rst)S 3408(line)S 3611(declares)S 3994(two)S 4197(globals,)S 4564("num_lines")S 5116(and)S 6072 V 1080("num_chars",)S 1669(which)S 1956(are)S (accessible)409 2121 A 2571(both)S 2790(inside)S 10 B 3071(yylex\(\))S 10 R 3403(and)S 3589(in)S 3708(the)S 10 B 3872(main\(\))S 10 R 4199(routine)S 4526(declared)S 4910(after)S 5138(the)S 6192 V (second)279 1080 A 1392("%%".)S 1725(There)S 1994(are)S 2151(two)S 2335(rules,)S 2589(one)S 2766(which)S 3044(matches)S 3406(a)S 3483(newline)S 3834(\("\\n"\))S 4094(and)S 4271(increments)S 4745(both)S 4955(the)S 5110(line)S 6312 V (count)223 1080 A 1330(and)S 1502(the)S 1652(character)S (count,)248 2050 A 2325(and)S 2497(one)S 2670(which)S 2944(matches)S 3302(any)S 3475(character)S 3874(other)S 4109(than)S 4310(a)S 4383(newline)S 4730(\(indicated)S 5161(by)S 6432 V 1080(the)S 1228(".")S 1360(regular)S 1671(expression\).)S 6600 V 1080(A)S 1178(somewhat)S 1611(more)S 1843(complicated)S 2360(example:)S 6840 V 1180(/*)S 1283(scanner)S 1616(for)S 1759(a)S 1829(toy)S 1982(Pascal-like)S (language)363 2450 A 2838(*/)S 7080 V 1180(%{)S 7200 V 1180(/*)S 1283(need)S 1498(this)S 1668(for)S 1811(the)S 1959(call)S 2130(to)S (atof\(\))225 2233 A 2483(below)S 2754(*/)S 7320 V 1180(#include)S 1551()S 7440 V 1180(%})S 7903 V 720(Page)S 941(1)S 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4455(September)S 4911(13,)S (1996)200 5061 A 8143 V EP %%Page: 2 2 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1180(DIGIT)S 1556([0-9])S 1080 V 1180(ID)S 1462([a-z][a-z0-9]*)S 1320 V 1180(%%)S 1560 V 1180({DIGIT}+)S 1709({)S 1680 V 1480(printf\()S 1763("An)S 1952(integer:)S 2285(%s)S 2433(\(%d\)\\n",)S 2804(yytext,)S 1800 V 1680(atoi\()S 1890(yytext)S 2166(\))S 2225(\);)S 1920 V 1480(})S 2160 V 1180({DIGIT}+"."{DIGIT}*)S 2338({)S 2280 V 1480(printf\()S 1763("A)S 1902(\257oat:)S 2134(%s)S 2282(\(%g\)\\n",)S 2653(yytext,)S 2400 V 1680(atof\()S 1896(yytext)S 2172(\))S 2231(\);)S 2520 V 1480(})S 2760 V 1180(if|then|begin|end|procedure|function)S 2821({)S 2880 V 1480(printf\()S 1763("A)S 1902(keyword:)S 2307(%s\\n",)S 2599(yytext)S 2875(\);)S 3000 V 1480(})S 3240 V 1180({ID})S 1583(printf\()S 1866("An)S 2055(identi\256er:)S 2472(%s\\n",)S 2764(yytext)S 3040(\);)S 3480 V 1180("+"|"-"|"*"|"/")S 1812(printf\()S 2095("An)S 2284(operator:)S 2673(%s\\n",)S 2965(yytext)S 3241(\);)S 3720 V 1180("{"[\303}\\n]*"}")S 1843(/*)S 1946(eat)S 2089(up)S 2214(one-line)S 2569(comments)S 3007(*/)S 3960 V 1180([)S (\\t\\n]+)225 1239 A 1714(/*)S 1817(eat)S 1960(up)S (whitespace)448 2085 A 2558(*/)S 4200 V 1180(.)S 1480(printf\()S ("Unrecognized)606 1763 A 2394(character:)S 2818(%s\\n",)S 3110(yytext)S 3386(\);)S 4440 V 1180(%%)S 4680 V 1180(main\()S 1440(argc,)S 1664(argv)S 1868(\))S 4800 V 1180(int)S 1311(argc;)S 4920 V 1180(char)S 1379(**argv;)S 5040 V 1280({)S 5160 V 1280(++argv,)S 1623(--argc;)S 1943(/*)S 2046(skip)S 2238(over)S 2442(program)S 2808(name)S 3051(*/)S 5280 V 1280(if)S 1367(\()S 1426(argc)S 1625(>)S 1707(0)S 1782(\))S 5400 V 1480(yyin)S 1683(=)S 1765(fopen\()S 2053(argv[0],)S 2400("r")S 2541(\);)S 5520 V 1280(else)S 5640 V 1480(yyin)S 1683(=)S 1765(stdin;)S 5880 V 1280(yylex\(\);)S 6000 V 1280(})S 6240 V 1080(This)S 1294(is)S 1396(the)S 1554(beginnings)S 2029(of)S 2148(a)S 2229(simple)S 2533(scanner)S 2877(for)S 3031(a)S (language)363 3112 A 3511(like)S 3698(Pascal.)S 4042(It)S 4140(identi\256es)S 4545(different)S 4929(types)S 5177(of)S 6360 V 10 I 1080(tokens)S 10 R 1362(and)S 1532(reports)S 1837(on)S 1962(what)S 2183(it)S 2264(has)S 2423(seen.)S 6528 V 1080(The)S 1262(details)S 1550(of)S 1659(this)S 1829(example)S (will)157 2195 A 2377(be)S 2497(explained)S 2913(in)S 3016(the)S 3164(following)S 3580(sections.)S 6696 V 9 R 720(F)S 722(FO)S 774(OR)S 842(RM)S 904(MA)S 986(AT)S 1054(T)S 1150(O)S 1152(OF)S 1220(F)S 1310(T)S 1312(TH)S 1370(HE)S 1438(E)S 1534(I)S 1536(IN)S 1569(NP)S 1637(PU)S 1689(UT)S 1757(T)S 1853(F)S 1855(FI)S 1907(IL)S 1940(LE)S 1998(E)S 6816 V 10 R 1080(The)S 10 I 1262(\257ex)S 10 R (input)206 1427 A 1658(\256le)S 1812(consists)S 2155(of)S 2264(three)S 2491(sections,)S 2865(separated)S 3271(by)S 3396(a)S 3466(line)S 3642(with)S 3846(just)S 10 B 4016(%%)S 10 R 4241(in)S (it:)84 4344 A 7056 V (de\256nitions)424 1180 A 7176 V 1180(%%)S 7296 V 1180(rules)S 7416 V 1180(%%)S 7536 V 1180(user)S 1373(code)S 7903 V 720(September)S 1176(13,)S (1996)200 1326 A 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4990(Page)S 5211(2)S 8143 V EP %%Page: 3 3 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1080(The)S 10 I (de\256nitions)418 1292 A 10 R 1765(section)S 2105(contains)S 2495(declarations)S 3037(of)S 3176(simple)S 10 I 3499(name)S 10 R (de\256nitions)424 3772 A 4251(to)S 4384(simplify)S 4774(the)S 4953(scanner)S 1080 V 1080(speci\256cation,)S 1639(and)S 1809(declarations)S 2321(of)S 10 I 2430(start)S (conditions,)443 2639 A 10 R 3107(which)S 3378(are)S 3527(explained)S 3943(in)S 4046(a)S 4116(later)S 4321(section.)S 1248 V 1080(Name)S (de\256nitions)424 1346 A 1795(have)S 2010(the)S 2158(form:)S 1488 V 1180(name)S (de\256nition)385 1423 A 1728 V 1080(The)S 1268("name")S 1599(is)S 1697(a)S 1773(word)S 2011(beginning)S 2443(with)S 2654(a)S 2731(letter)S 2971(or)S 3087(an)S (underscore)442 3214 A 3688(\('_'\))S 3906(followed)S 4296(by)S 4428(zero)S 4634(or)S 4750(more)S 4989(letters,)S 1848 V 1080(digits,)S 1359('_',)S 1533(or)S ('-')102 1648 A 1781(\(dash\).)S 2114(The)S (de\256nition)385 2302 A 2718(is)S 2815(taken)S 3063(to)S 3171(begin)S 3424(at)S 3527(the)S 3680(\256rst)S (non-white-space)666 3867 A 4563(character)S 4964(follow-)S 1968 V 1080(ing)S 1233(the)S 1382(name)S 1626(and)S 1797(continuing)S 2252(to)S 2356(the)S 2505(end)S 2676(of)S 2786(the)S 2935(line.)S 3162(The)S (de\256nition)385 3345 A 3756(can)S 3922(subsequently)S 4472(be)S 4593(referred)S 4940(to)S 5044(using)S 2088 V 1080("{name}",)S 1526(which)S (will)157 1797 A 1979(expand)S 2294(to)S ("\(de\256nition\)".)560 2397 A 3007(For)S 3172(example,)S 2328 V 1180(DIGIT)S 1556([0-9])S 2448 V 1180(ID)S 1462([a-z][a-z0-9]*)S 2688 V 1080(de\256nes)S 1405("DIGIT")S 1804(to)S 1923(be)S 2059(a)S 2145(regular)S 2472(expression)S 2943(which)S 3230(matches)S 3601(a)S 3687(single)S 3968(digit,)S 4218(and)S 4404("ID")S 4634(to)S 4753(be)S 4889(a)S 4975(regular)S 2808 V 1080(expression)S 1543(which)S 1822(matches)S 2185(a)S 2263(letter)S 2504(followed)S 2895(by)S 3028(zero-or-more)S 3594(letters-or-digits.)S 4299(A)S 4405(subsequent)S 4884(reference)S 2928 V 1080(to)S 3168 V 1180({DIGIT}+"."{DIGIT}*)S 3408 V 1080(is)S 1172(identical)S 1544(to)S 3648 V 1180(\([0-9]\)+"."\([0-9]\)*)S 3888 V 1080(and)S 1250(matches)S 1605(one-or-more)S 2134(digits)S 2382(followed)S 2765(by)S 2890(a)S 2960('.')S 3078(followed)S 3461(by)S 3586(zero-or-more)S 4144(digits.)S 4056 V 1080(The)S 10 I 1262(rules)S 10 R 1488(section)S 1798(of)S 1907(the)S 10 I 2055(\257ex)S 10 R (input)206 2220 A 2451(contains)S 2811(a)S 2881(series)S 3136(of)S 3245(rules)S 3466(of)S 3575(the)S 3723(form:)S 4296 V 1180(pattern)S 1535(action)S 4536 V 1080(where)S 1352(the)S 1500(pattern)S 1805(must)S 2025(be)S 2145(unindented)S 2616(and)S 2786(the)S 2934(action)S 3205(must)S 3425(begin)S 3673(on)S 3798(the)S 3946(same)S 4178(line.)S 4704 V 1080(See)S 1251(below)S 1522(for)S 1665(a)S 1735(further)S 2035(description)S 2507(of)S 2616(patterns)S 2960(and)S 3130(actions.)S 4872 V 1080(Finally,)S 1420(the)S 1573(user)S 1771(code)S 1991(section)S 2307(is)S 2405(simply)S 2709(copied)S 3008(to)S 10 B 3117(lex.yy.c)S 10 R 3466(verbatim.)S 3905(It)S 3998(is)S 4096(used)S 4311(for)S 4460(companion)S 4937(routines)S 4992 V 1080(which)S 1362(call)S 1543(or)S 1662(are)S 1821(called)S 2097(by)S 2232(the)S 2390(scanner.)S 2783(The)S 2975(presence)S 3363(of)S 3482(this)S 3662(section)S 3982(is)S 4084(optional;)S 4476(if)S 4573(it)S 4664(is)S 4766(missing,)S 5138(the)S 5112 V (second)279 1080 A 10 B 1384(%%)S 10 R 1609(in)S 1712(the)S (input)206 1860 A 2091(\256le)S 2245(may)S 2443(be)S 2563(skipped,)S 2925(too.)S 5280 V 1080(In)S 1193(the)S (de\256nitions)424 1345 A 1798(and)S 1972(rules)S 2197(sections,)S 2576(any)S 10 I 2751(indented)S 10 R 3127(text)S 3308(or)S 3422(text)S 3603(enclosed)S 3985(in)S 10 B 4093(%{)S 10 R 4263(and)S 10 B 4438(%})S 10 R 4608(is)S 4705(copied)S 5003(verba-)S 5400 V 1080(tim)S 1253(to)S 1370(the)S 1532(output)S 1827(\(with)S 2079(the)S 2241(%{}'s)S 2533(removed\).)S 3008(The)S 3204(%{}'s)S 3496(must)S 3730(appear)S 4038(unindented)S 4522(on)S 4660(lines)S 4888(by)S 5026(them-)S 5520 V 1080(selves.)S 5688 V 1080(In)S 1200(the)S 1359(rules)S 1591(section,)S 1937(any)S 2118(indented)S 2500(or)S 2620(%{})S 2836(text)S 3023(appearing)S 3456(before)S 3750(the)S 3909(\256rst)S 4102(rule)S 4295(may)S 4504(be)S 4635(used)S 4855(to)S 4969(declare)S 5808 V 1080(variables)S 1477(which)S 1756(are)S 1913(local)S 2142(to)S 2253(the)S 2408(scanning)S 2797(routine)S 3114(and)S 3291(\(after)S 3543(the)S 3698(declarations\))S 4251(code)S 4473(which)S 4751(is)S 4850(to)S 4960(be)S 5087(exe-)S 5928 V 1080(cuted)S 1329(whenever)S 1752(the)S 1906(scanning)S 2294(routine)S 2611(is)S 2710(entered.)S 3089(Other)S 3351(indented)S 3729(or)S 3845(%{})S 4057(text)S 4240(in)S 4350(the)S 4505(rule)S 4694(section)S 5011(is)S (still)151 5110 A 6048 V 1080(copied)S 1374(to)S 1478(the)S 1627(output,)S 1934(but)S 2088(its)S 2209(meaning)S 2581(is)S 2674(not)S 2828(well-de\256ned)S 3358(and)S 3529(it)S 3611(may)S 3810(well)S 4010(cause)S 4259(compile-time)S 4821(errors)S 5082(\(this)S 6168 V 1080(feature)S 1386(is)S 1478(present)S 1794(for)S 10 I 1937(POSIX)S 10 R 2243(compliance;)S 2760(see)S 2914(below)S 3185(for)S 3328(other)S 3560(such)S 3769(features\).)S 6336 V 1080(In)S 1190(the)S (de\256nitions)424 1339 A 1789(section,)S 2125(an)S 2246(unindented)S 2718(comment)S 3118(\(i.e.,)S 3326(a)S 3397(line)S 3574(beginning)S 4001(with)S 4206("/*"\))S 4426(is)S 4519(also)S 4708(copied)S 5003(verba-)S 6456 V 1080(tim)S 1252(to)S 1368(the)S 1529(output)S 1823(up)S 1961(to)S 2077(the)S 2238(next)S 2449("*/".)S 2697(Also,)S 2950(any)S 3133(line)S 3322(in)S 3438(the)S (de\256nitions)424 3599 A 4061(section)S 4384(beginning)S 4823(with)S 5039('#')S 5194(is)S 6576 V (ignored,)332 1080 A (though)278 1437 A 1740(this)S 1910(style)S 2125(of)S 2234(comment)S 2633(is)S (deprecated)437 2725 A 3187(and)S 3357(may)S 3555(go)S 3680(away)S 3918(in)S 4021(the)S 4169(future.)S 6744 V 9 R 720(P)S 722(PA)S 774(AT)S 842(TT)S 900(TE)S 958(ER)S 1016(RN)S 1078(NS)S 1146(S)S 6864 V 10 R 1080(The)S 1262(patterns)S 1606(in)S 1709(the)S (input)206 1857 A 2088(are)S (written)286 2237 A 2548(using)S 2790(an)S 2910(extended)S 3298(set)S 3435(of)S 3544(regular)S 3855(expressions.)S 4399(These)S 4665(are:)S 7104 V 1180(x)S 1480(match)S 1751(the)S 1899(character)S 2295('x')S 7224 V 1180(.)S 1455(any)S 1625(character)S 2021(except)S 2309(newline)S 7344 V 1180([xyz])S 1543(a)S 1613("character)S 2050(class";)S 2340(in)S 2443(this)S 2613(case,)S 2837(the)S 2985(pattern)S 7464 V 1505(matches)S 1860(either)S 2115(an)S 2235('x',)S 2403(a)S 2473('y',)S 2641(or)S 2750(a)S 2820('z')S 7903 V 720(Page)S 941(3)S 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4455(September)S 4911(13,)S (1996)200 5061 A 8143 V EP %%Page: 4 4 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1180([abj-oZ])S 1592(a)S 1662("character)S 2099(class")S 2361(with)S 2565(a)S 2635(range)S 2884(in)S (it;)84 2987 A 3096(matches)S 1080 V 1505(an)S 1625('a',)S 1788(a)S 1858('b',)S 2026(any)S 2196(letter)S 2429(from)S 2650('j')S (through)312 2771 A 3108('o',)S 1200 V 1505(or)S 1614(a)S 1684('Z')S 1320 V 1180([\303A-Z])S 1576(a)S 1646("negated)S 2025(character)S 2421(class",)S 2708(i.e.,)S 2881(any)S 3051(character)S 1440 V 1505(but)S 1658(those)S 1895(in)S 1998(the)S 2146(class.)S 2417(In)S 2526(this)S 2696(case,)S 2920(any)S 1560 V 1505(character)S 1901(EXCEPT)S 2308(an)S (uppercase)403 2428 A 2856(letter.)S 1680 V 1180([\303A-Z\\n])S 1604(any)S 1774(character)S 2170(EXCEPT)S 2577(an)S (uppercase)403 2697 A 3125(letter)S 3358(or)S 1800 V 1505(a)S 1575(newline)S 1920 V 1180(r*)S 1489(zero)S 1688(or)S 1797(more)S 2029(r's,)S 2186(where)S 2458(r)S 2517(is)S 2609(any)S 2779(regular)S 3090(expression)S 2040 V 1180(r+)S 1496(one)S 1666(or)S 1775(more)S 2007(r's)S 2160 V 1180(r?)S 1484(zero)S 1683(or)S 1792(one)S 1962(r's)S 2094(\(that)S 2304(is,)S 2421("an)S 2582(optional)S 2936(r"\))S 2280 V 1180(r{2,5})S 1560(anywhere)S 1977(from)S 2198(two)S 2374(to)S 2477(\256ve)S 2653(r's)S 2400 V 1180(r{2,})S 1535(two)S 1711(or)S 1820(more)S 2052(r's)S 2520 V 1180(r{4})S 1535(exactly)S 1851(4)S 1926(r's)S 2640 V 1180({name})S 1619(the)S 1767(expansion)S 2199(of)S 2308(the)S 2456("name")S (de\256nition)385 2781 A 2760 V 1455(\(see)S (above\))274 1643 A 2880 V 1180("[xyz]\\"foo")S 3000 V 1455(the)S (literal)236 1603 A 1864(string:)S 2146([xyz]"foo)S 3120 V 1180(\\X)S 1506(if)S 1593(X)S 1691(is)S 1783(an)S 1903('a',)S 2066('b',)S ('f',)127 2234 A 2386('n',)S ('r',)127 2554 A 2706('t',)S 2852(or)S 2961('v',)S 3240 V 1505(then)S 1703(the)S 1851(ANSI-C)S 2213(interpretation)S 2781(of)S 2890(\\x.)S 3360 V 1505(Otherwise,)S 1970(a)S (literal)236 2040 A 2301('X')S 2467(\(used)S 2710(to)S 2813(escape)S 3480 V 1505(operators)S 1905(such)S 2114(as)S 2223('*'\))S 3600 V (\\123)178 1180 A 1533(the)S 1681(character)S 2077(with)S 2281(octal)S 2502(value)S (123)150 2745 A 3720 V 1180(\\x2a)S 1528(the)S 1676(character)S 2072(with)S 2276(hexadecimal)S 2810(value)S 3053(2a)S 3840 V (\(r\))102 1180 A 1482(match)S 1753(an)S 1873(r;)S 1960(parentheses)S 2455(are)S 2604(used)S 2813(to)S 2916(override)S 3960 V (precedence)454 1505 A 1984(\(see)S 2172(below\))S 4320 V 1180(rs)S 1478(the)S 1626(regular)S 1937(expression)S 2392(r)S 2451(followed)S 2834(by)S 2959(the)S 4440 V 1505(regular)S 1816(expression)S 2271(s;)S 2363(called)S 2629("concatenation")S 4800 V 1180(r|s)S 1473(either)S 1728(an)S 1848(r)S 1907(or)S 2016(an)S 2136(s)S 5160 V 1180(r/s)S 1481(an)S 1601(r)S 1660(but)S 1813(only)S 2016(if)S 2103(it)S 2184(is)S 2276(followed)S 2659(by)S 2784(an)S 2904(s.)S 3018(The)S 5280 V 1505(s)S 1569(is)S 1661(not)S 1814(part)S 1996(of)S 2105(the)S 2253(matched)S 2619(text.)S 2845(This)S 3049(type)S 5400 V 1505(of)S 1614(pattern)S 1919(is)S 2011(called)S 2277(as)S ("trailing)332 2386 A 2743(context".)S 5520 V 1180(\303r)S 1473(an)S 1593(r,)S 1677(but)S 1830(only)S 2033(at)S 2131(the)S 2279(beginning)S 2705(of)S 2814(a)S 2884(line)S 5640 V 1180(r$)S 1489(an)S 1609(r,)S 1693(but)S 1846(only)S 2049(at)S 2147(the)S 2295(end)S 2465(of)S 2574(a)S 2644(line.)S 2870(Equivalent)S 5760 V 1505(to)S 1608("r/\\n".)S 6120 V 1180(r)S 1542(an)S 1662(r,)S 1746(but)S 1899(only)S 2102(in)S 2205(start)S (condition)379 2404 A 2808(s)S 2872(\(see)S 6240 V 1455(below)S 1726(for)S 1869(discussion)S 2312(of)S 2421(start)S (conditions\))452 2620 A 6360 V 1180(r)S 6480 V 1455(same,)S 1712(but)S 1865(in)S 1968(any)S 2138(of)S 2247(start)S (conditions)418 2446 A 2889(s1,)S 6600 V 1455(s2,)S 1594(or)S 1703(s3)S 6960 V 1180(<>)S 1699(an)S 1819(end-of-\256le)S 7080 V (<>)736 1180 A 7200 V 1455(an)S 1575(end-of-\256le)S 2026(when)S 2269(in)S 2372(start)S (condition)379 2571 A 2975(s1)S 3089(or)S 3198(s2)S 7440 V 1080(The)S 1267(regular)S 1583(expressions)S 2082(listed)S (above)240 2330 A 2600(are)S (grouped)329 2754 A (according)397 3113 A 3540(to)S (precedence,)479 3648 A 4157(from)S 4383(highest)S (precedence)454 4703 A 5188(at)S 7903 V 720(September)S 1176(13,)S (1996)200 1326 A 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4990(Page)S 5211(4)S 8143 V EP %%Page: 5 5 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1080(the)S 1228(top)S 1381(to)S 1484(lowest)S 1772(at)S 1870(the)S 2018(bottom.)S 2377(Those)S (grouped)329 2648 A 3002(together)S 3357(have)S 3572(equal)S (precedence.)479 3815 A 4344(For)S 4509(example,)S 1200 V 1180(foo|bar*)S 1440 V 1080(is)S 1172(the)S 1320(same)S 1552(as)S 1680 V 1180(\(foo\)|\(ba\(r*\)\))S 1920 V 1080(since)S 1314(the)S 1464('*')S 1609(operator)S 1972(has)S 2133(higher)S (precedence)454 2417 A 2898(than)S 3098(concatenation,)S 3709(and)S 3881(concatenation)S 4467(higher)S 4751(than)S 4952(alterna-)S 2040 V 1080(tion)S 1265(\('|'\).)S 1500(This)S 1708(pattern)S 2017(therefore)S 2411(matches)S 10 I 2770(either)S 10 R 3034(the)S 3186(string)S 3444("foo")S 10 I 3689(or)S 10 R 3807(the)S 3959(string)S 4216("ba")S 4421(followed)S 4807(by)S 4935(zero-or-)S 2160 V 1080(more)S 1312(r's.)S 1494(To)S 1631(match)S 1902("foo")S 2143(or)S 2252(zero-or-more)S 2810("bar"'s,)S 3144(use:)S 2400 V 1180(foo|\(bar\)*)S 2640 V 1080(and)S 1250(to)S 1353(match)S 1624(zero-or-more)S 2182("foo"'s-or-"bar"'s:)S 2880 V 1180(\(foo|bar\)*)S 3168 V 1080(Some)S 1334(notes)S 1571(on)S 1696(patterns:)S 3336 V 1080(-)S 1440(A)S 1551(negated)S 1902(character)S 2311(class)S 2545(such)S 2767(as)S 2889(the)S 3050(example)S 3429("[\303A-Z]")S (above)240 3820 A 10 I (will)151 4098 A 4287(match)S 4571(a)S 4659(newline)S 10 R 5010(unless)S 3456 V 1440("\\n")S 1647(\(or)S 1812(an)S 1954(equivalent)S 2420(escape)S 2736(sequence\))S 3186(is)S 3300(one)S 3492(of)S 3623(the)S 3793(characters)S (explicitly)380 4250 A 4677(present)S 5014(in)S 5138(the)S 3576 V 1440(negated)S 1786(character)S 2190(class)S 2420(\(e.g.,)S 2658("[\303A-Z\\n]"\).)S 3207(This)S 3420(is)S 3521(unlike)S 3806(how)S 4013(many)S 4270(other)S 4511(regular)S 4831(expression)S 3696 V 1440(tools)S 1695(treat)S 1935(negated)S 2308(character)S 2739(classes,)S 3104(but)S 3292(unfortunately)S 3894(the)S 4076(inconsistency)S 4682(is)S 4808(historically)S 3816 V 1440(entrenched.)S 1977(Matching)S 2407(newlines)S 2810(means)S 3112(that)S 3308(a)S 3398(pattern)S 3724(like)S 3921([\303"]*)S 4160(can)S 4346(match)S 4638(an)S 4779(entire)S (input)206 5055 A 3936 V 1440(\(over\257owing)S 1985(the)S 2133(scanner's)S (input)206 2539 A 2770(buffer\))S 3076(unless)S 3352(there's)S 3652(another)S (quote)223 3979 A 4227(in)S 4330(the)S (input.)231 4478 A 4104 V 1080(-)S 1440(A)S 1544(rule)S 1732(can)S 1903(have)S 2124(at)S 2228(most)S 2454(one)S 2631(instance)S 2993(of)S (trailing)291 3109 A 3432(context)S 3760(\(the)S 3949('/')S 4077(operator)S 4445(or)S 4561(the)S 4716('$')S 4866(operator\).)S 4224 V 1440(The)S 1626(start)S (condition,)404 1828 A ('\303',)127 2260 A 2415(and)S 2588("<>")S 3117(patterns)S 3464(can)S 3632(only)S 3838(occur)S 4090(at)S 4191(the)S 4342(beginning)S 4771(of)S 4883(a)S 4956(pattern,)S 4344 V 1440(and,)S 1643(as)S 1760(well)S 1967(as)S 2084(with)S 2296('/')S 2425(and)S 2603('$',)S (cannot)268 2779 A 3080(be)S (grouped)329 3208 A 3570(inside)S 3843(parentheses.)S 4396(A)S ('\303')102 4502 A 4637(which)S 4916(does)S 5133(not)S 4464 V 1440(occur)S 1691(at)S 1791(the)S 1941(beginning)S 2369(of)S 2480(a)S 2552(rule)S 2736(or)S 2847(a)S 2919('$')S 3064(which)S 3337(does)S 3548(not)S 3703(occur)S 3954(at)S 4054(the)S 4204(end)S 4376(of)S 4487(a)S 4559(rule)S 4743(loses)S 4971(its)S 5093(spe-)S 4584 V 1440(cial)S 1611(properties)S 2039(and)S 2209(is)S 2301(treated)S 2601(as)S 2710(a)S 2780(normal)S 3090(character.)S 4752 V 1440(The)S 1622(following)S 2038(are)S (illegal:)280 2187 A 4992 V 1540(foo/bar$)S 5112 V 1540(foobar)S 5352 V 1440(Note)S 1661(that)S 1837(the)S 1985(first)S 2173(of)S 2282(these,)S 2539(can)S 2704(be)S (written)286 2824 A 3135("foo/bar\\n".)S 5520 V 1440(The)S 1622(following)S (will)157 2038 A 2220(result)S 2469(in)S 2572('$')S 2715(or)S ('\303')102 2824 A 2951(being)S 3199(treated)S 3499(as)S 3608(a)S 3678(normal)S 3988(character:)S 5760 V 1540(foo|\(bar$\))S 5880 V 1540(foo|\303bar)S 6120 V 1440(If)S 1540(what's)S 1841(wanted)S 2164(is)S 2263(a)S 2340("foo")S 2588(or)S 2704(a)S (bar-followed-by-a-newline,)1112 2781 A 3925(the)S 4080(following)S 4503(could)S 4759(be)S 4887(used)S 5104(\(the)S 6240 V 1440(special)S 1745('|')S 1858(action)S 2129(is)S 2221(explained)S 2637(below\):)S 6480 V 1540(foo)S 1824(|)S 6600 V 1540(bar$)S 1844(/*)S 1947(action)S 2218(goes)S 2427(here)S 2626(*/)S 6840 V 1440(A)S 1538(similar)S 1843(trick)S (will)157 2053 A 2235(work)S 2467(for)S 2610(matching)S 3009(a)S 3079(foo)S 3238(or)S 3347(a)S 3417(bar-at-the-beginning-of-a-line.)S 7008 V 9 R 720(H)S 722(HO)S 790(OW)S 858(W)S 984(T)S 986(TH)S 1044(HE)S 1112(E)S 1208(I)S 1210(IN)S 1243(NP)S 1311(PU)S 1363(UT)S 1431(T)S 1527(I)S 1529(IS)S 1562(S)S 1652(M)S 1654(MA)S 1736(AT)S 1804(TC)S 1862(CH)S 1924(HE)S 1992(ED)S 2050(D)S 7128 V 10 R 1080(When)S 1349(the)S 1501(generated)S 1922(scanner)S 2259(is)S 2355(run,)S 2543(it)S 2628(analyzes)S 3004(its)S (input)206 3128 A (looking)306 3363 A 3698(for)S 3845(strings)S 4142(which)S 4417(match)S 4692(any)S 4866(of)S 4979(its)S 5104(pat-)S 7248 V 1080(terns.)S 1352(If)S 1446(it)S 1528(finds)S 1755(more)S 1988(than)S 2186(one)S 2356(match,)S 2652(it)S 2733(takes)S 2965(the)S 3113(one)S 3283(matching)S 3682(the)S 3830(most)S 4050(text)S 4226(\(for)S (trailing)291 4403 A 4719(context)S 5040(rules,)S 7368 V 1080(this)S 1252(includes)S 1614(the)S 1764(length)S 2042(of)S 2153(the)S (trailing)291 2303 A 2621(part,)S 2830(even)S (though)278 3047 A 3352(it)S (will)157 3435 A 3619(then)S 3819(be)S 3941(returned)S 4305(to)S 4411(the)S (input\).)265 4562 A 4880(If)S 4976(it)S 5060(finds)S 7488 V 1080(two)S 1256(or)S 1365(more)S 1597(matches)S 1952(of)S 2061(the)S 2209(same)S 2441(length,)S 2742(the)S 2890(rule)S 3072(listed)S 3315(first)S 3503(in)S 3606(the)S 10 I 3754(flex)S 10 R (input)206 3925 A 4156(file)S 4316(is)S 4408(chosen.)S 7903 V 720(Page)S 941(5)S 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4455(September)S 4911(13,)S (1996)200 5061 A 8143 V EP %%Page: 6 6 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1080(Once)S 1321(the)S 1472(match)S 1746(is)S 1841(determined,)S 2347(the)S 2499(text)S (corresponding)575 2679 A 3283(to)S 3390(the)S 3542(match)S 3817(\(called)S 4121(the)S 10 I 4273(token\))S 10 R 4554(is)S 4650(made)S 4897(available)S 1080 V 1080(in)S 1215(the)S 1395(global)S 1703(character)S 2131(pointer)S 10 B 2473(yytext,)S 10 R 2818(and)S 3020(its)S 3172(length)S 3480(in)S 3615(the)S 3794(global)S 4101(integer)S 10 B 4437(yyleng.)S 10 R 4797(The)S 10 I 5010(action)S 1200 V 10 R (corresponding)575 1080 A 1683(to)S 1789(the)S 1941(matched)S 2311(pattern)S 2620(is)S 2716(then)S 2918(executed)S 3305(\(a)S 3413(more)S 3649(detailed)S 3997(description)S 4473(of)S 4586(actions)S 4900(follows\),)S 1320 V 1080(and)S 1250(then)S 1448(the)S 1596(remaining)S (input)206 2029 A 2260(is)S 2352(scanned)S 2701(for)S 2844(another)S 3171(match.)S 1488 V 1080(If)S 1185(no)S 1322(match)S 1605(is)S (found,)259 1709 A 2005(then)S 2215(the)S 10 I 2375(default)S 2691(rule)S 10 R 2890(is)S 2994(executed:)S 3418(the)S 3579(next)S 3790(character)S 4199(in)S 4315(the)S (input)206 4476 A 4720(is)S 4825(considered)S 1608 V 1080(matched)S 1446(and)S 1616(copied)S 1909(to)S 2012(the)S 2160(standard)S 2526(output.)S 2857(Thus,)S 3108(the)S 3256(simplest)S 3616(legal)S 10 I 3837(flex)S 10 R (input)206 4008 A 4239(is:)S 1848 V 1180(%%)S 2088 V 1080(which)S 1351(generates)S 1757(a)S 1827(scanner)S 2160(that)S 2336(simply)S 2634(copies)S 2916(its)S (input)206 3036 A 3267(\(one)S 3471(character)S 3867(at)S 3965(a)S 4035(time\))S 4273(to)S 4376(its)S 4496(output.)S 2256 V 9 R 720(A)S 722(AC)S 790(CT)S 852(TI)S 910(IO)S 943(ON)S 1011(NS)S 1079(S)S 2376 V 10 R 1080(Each)S 1310(pattern)S 1618(in)S 1724(a)S 1797(rule)S 1982(has)S 2144(a)S (corresponding)575 2217 A 2820(action,)S 3119(which)S 3393(can)S 3561(be)S 3684(any)S 3857(arbitrary)S 4234(C)S 4330(statement.)S 4795(The)S 4981(pattern)S 2496 V 1080(ends)S 1294(at)S 1397(the)S 1550(first)S (non-escaped)503 1743 A (whitespace)448 2276 A 2754(character;)S 3183(the)S 3336(remainder)S 3775(of)S 3889(the)S 4041(line)S 4221(is)S 4317(its)S 4441(action.)S 4766(If)S 4863(the)S 5015(action)S 2616 V 1080(is)S 1180(empty,)S 1489(then)S 1695(when)S 1946(the)S 2102(pattern)S 2415(is)S 2515(matched)S 2889(the)S (input)206 3045 A 3284(token)S 3540(is)S 3640(simply)S 3946(discarded.)S 4415(For)S 4588(example,)S 4987(here)S 5194(is)S 2736 V 1080(the)S 1228(specification)S 1768(for)S 1911(a)S 1981(program)S 2347(which)S 2618(deletes)S 2923(all)S 3049(occurrences)S 3556(of)S 3665("zap)S 3871(me")S 4060(from)S 4281(its)S (input:)234 4401 A 2976 V 1180(%%)S 3096 V 1180("zap)S 1386(me")S 3336 V 1080(\(It)S (will)157 1211 A (copy)195 1403 A 1633(all)S 1769(other)S 2011(characters)S 2456(in)S 2569(the)S (input)206 2727 A 2968(to)S 3082(the)S 3241(output)S 3533(since)S 3776(they)S (will)157 3985 A 4178(be)S 4309(matched)S 4686(by)S 4822(the)S 4981(default)S 3456 V 1080(rule.\))S 3624 V 1080(Here)S 1303(is)S 1396(a)S 1467(program)S 1834(which)S 2106(compresses)S (multiple)335 2596 A 2957(blanks)S 3245(and)S 3417(tabs)S 3606(down)S 3856(to)S 3961(a)S 4033(single)S 4300(blank,)S 4575(and)S 4747(throws)S 5048(away)S 3744 V (whitespace)448 1080 A (found)234 1553 A 1812(at)S 1910(the)S 2058(end)S 2228(of)S 2337(a)S 2407(line:)S 3984 V 1180(%%)S 4104 V 1180([)S 1239(\\t]+)S 1586(putchar\()S 1947(')S 2006(')S 2065(\);)S 4224 V 1180([)S 1239(\\t]+$)S 1611(/*)S (ignore)257 1714 A 1996(this)S 2166(token)S 2414(*/)S 4512 V 1080(If)S 1185(the)S 1345(action)S 1628(contains)S 2000(a)S 2082('{',)S 2260(then)S 2470(the)S 2630(action)S 2913(spans)S (till)112 3173 A 3322(the)S 3482(balancing)S 3910('}')S 4063(is)S (found,)259 4167 A 4463(and)S 4645(the)S 4805(action)S 5088(may)S 4632 V 1080(cross)S (multiple)335 1322 A 1692(lines.)S 10 I 1967(flex)S 10 R (knows)262 2148 A (about)223 2445 A 2703(C)S 2805(strings)S 3107(and)S 3286(comments)S 3733(and)S 3912(won't)S 4181(be)S 4310(fooled)S 4601(by)S (braces)258 4735 A (found)234 5027 A 4752 V 1080(within)S 1366(them,)S 1621(but)S 1778(also)S 1969(allows)S 2261(actions)S 2575(to)S 2682(begin)S 2934(with)S 10 B 3142(%{)S 10 R 3311(and)S (will)157 3485 A 3671(consider)S 4041(the)S 4193(action)S 4468(to)S 4575(be)S 4699(all)S 4829(the)S 4981(text)S 5161(up)S 4872 V 1080(to)S 1183(the)S 1331(next)S 10 B 1529(%})S 10 R 1694(\(regardless)S 2162(of)S 2271(ordinary)S (braces)258 2637 A 2920(inside)S 3185(the)S 3333(action\).)S 5040 V 1080(An)S 1240(action)S 1523(consisting)S 1968(solely)S 2246(of)S 2368(a)S 2451(vertical)S 2792(bar)S 2959(\('|'\))S 3153(means)S 3448("same)S 3734(as)S 3856(the)S 4017(action)S 4301(for)S 4457(the)S 4618(next)S 4829(rule.")S 5115(See)S 5160 V 1080(below)S 1351(for)S 1494(an)S (illustration.)461 1614 A 5328 V 1080(Actions)S 1419(can)S 1585(include)S 1907(arbitrary)S 2282(C)S 2376(code,)S 2618(including)S 10 B 3024(return)S 10 R 3332(statements)S 3784(to)S 3889(return)S 4157(a)S 4229(value)S 4474(to)S 4579(whatever)S 4976(routine)S 5448 V 1080(called)S 10 B 1347(yylex\(\).)S 10 R 1689(Each)S 1917(time)S 10 B 2122(yylex\(\))S 10 R 2439(is)S 2532(called)S 2799(it)S 2881(continues)S 3292(processing)S 3748(tokens)S 4035(from)S 4256(where)S 4528(it)S 4609(last)S 4774(left)S 4934(off)S (until)184 5077 A 5568 V 1080(it)S 1166(either)S (reaches)303 1426 A 1759(the)S 1912(end)S 2087(of)S 2201(the)S 2354(file)S 2519(or)S 2633(executes)S 3010(a)S 3085(return.)S 3406(Once)S 3650(it)S (reaches)303 3737 A 4071(an)S (end-of-file,)457 4197 A 4685(however,)S 5088(then)S 5688 V 1080(any)S 1263(subsequent)S 1747(call)S 1931(to)S 10 B 2047(yylex\(\))S 10 R (will)157 2376 A 2571(simply)S 2882(immediately)S 3423(return,)S 3727(unless)S 10 B (yyrestart\(\))460 4016 A 10 R 4514(is)S 4619(first)S 4820(called)S 5098(\(see)S 5808 V 1080(below\).)S 5976 V 1080(Actions)S 1418(are)S 1567(not)S 1720(allowed)S 2064(to)S 2167(modify)S 2482(yytext)S 2758(or)S 2867(yyleng.)S 6144 V 1080(There)S 1341(are)S 1490(a)S 1560(number)S 1892(of)S 2001(special)S 2306(directives)S 2723(which)S 2994(can)S 3159(be)S 3279(included)S 3650(within)S 3932(an)S 4052(action:)S 6312 V 1080(-)S 10 B 1440(ECHO)S 10 R 1761(copies)S 2043(yytext)S 2319(to)S 2422(the)S 2570(scanner's)S 2976(output.)S 6480 V 1080(-)S 10 B 1440(BEGIN)S 10 R 1789(followed)S 2172(by)S 2297(the)S 2445(name)S 2688(of)S 2797(a)S 2867(start)S (condition)379 3067 A (places)252 3472 A 3750(the)S 3899(scanner)S 4233(in)S 4337(the)S (corresponding)575 4486 A 5087(start)S 6600 V (condition)379 1440 A 1844(\(see)S 2032(below\).)S 6768 V 1080(-)S 10 B 1440(REJECT)S 10 R 1865(directs)S 2162(the)S 2313(scanner)S 2649(to)S (proceed)319 2755 A 3103(on)S 3232(to)S 3339(the)S ("second)320 3491 A 3840(best")S 4072(rule)S 4258(which)S 4533(matched)S 4903(the)S (input)206 5055 A 6888 V 1440(\(or)S 1608(a)S 1703(pre\256x)S 1988(of)S 2122(the)S (input\).)265 2295 A 2635(The)S 2841(rule)S 3047(is)S 3163(chosen)S 3491(as)S 3624(described)S (above)240 4059 A 4348(in)S 4475("How)S 4761(the)S (Input)212 4933 A 5194(is)S 7008 V 1440(Matched",)S 1884(and)S 10 B 2055(yytext)S 10 R 2344(and)S 10 B 2515(yyleng)S 10 R 2820(set)S 2958(up)S 3084(appropriately.)S 3697(It)S 3785(may)S 3985(either)S 4242(be)S 4364(one)S 4536(which)S 4809(matched)S 5177(as)S 7128 V 1440(much)S 1706(text)S 1900(as)S 2026(the)S 2191(originally)S 2624(chosen)S 2945(rule)S 3144(but)S 3314(came)S 3569(later)S 3791(in)S 3911(the)S 10 I 4076(\257ex)S 10 R (input)206 4258 A 4506(\256le,)S 4702(or)S 4828(one)S 5015(which)S 7248 V 1440(matched)S 1811(less)S 1992(text.)S 2223(For)S 2393(example,)S 2789(the)S 2942(following)S (will)157 3363 A 3550(both)S (count)223 3758 A 4011(the)S 4164(words)S 4440(in)S 4548(the)S (input)206 4702 A 4939(and)S 5115(call)S 7368 V 1440(the)S 1588(routine)S 1898(special\(\))S 2271(whenever)S 2688("frob")S 2963(is)S 3055(seen:)S 7903 V 720(September)S 1176(13,)S (1996)200 1326 A 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4990(Page)S 5211(6)S 8143 V EP %%Page: 7 7 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1740(int)S (word_count)480 1871 A 2376(=)S 2458(0;)S 1080 V 1540(%%)S 1320 V 1540(frob)S 1908(special\(\);)S 2309(REJECT;)S 1440 V 1540([\303)S (\\t\\n]+)225 1633 A (++word_count;)622 1933 A 1680 V (Without)329 1440 A 1808(the)S 10 B 1970(REJECT,)S 10 R 2431(any)S 2615("frob"'s)S 2977(in)S 3095(the)S (input)206 3258 A 3504(would)S 3795(not)S 3963(be)S (counted)318 4098 A 4456(as)S 4580(words,)S 4891(since)S 5138(the)S 1800 V 1440(scanner)S 1779(normally)S 2173(executes)S 2551(only)S 2759(one)S 2934(action)S 3210(per)S 3369(token.)S (Multiple)346 3672 A 10 B 4048(REJECT's)S 10 R 4548(are)S 4702(allowed,)S (each)185 5076 A 1920 V 1440(one)S 1613(\256nding)S 1925(the)S 2076(next)S 2277(best)S 2467(choice)S 2758(to)S 2864(the)S 3015(currently)S 3407(active)S 3676(rule.)S 3911(For)S 4079(example,)S 4473(when)S 4719(the)S 4870(following)S 2040 V 1440(scanner)S 1773(scans)S 2016(the)S 2164(token)S 2412("abcd",)S 2734(it)S (will)157 2815 A 2997(write)S 3230("abcdabcaba")S 3807(to)S 3910(the)S 4058(output:)S 2280 V 1540(%%)S 2400 V 1540(a)S 1785(|)S 2520 V 1540(ab)S 1810(|)S 2640 V 1540(abc)S 1830(|)S 2760 V 1540(abcd)S 1855(ECHO;)S 2183(REJECT;)S 2880 V 1540(.|\\n)S 1788(/*)S 1891(eat)S 2034(up)S 2159(any)S 2329(unmatched)S 2795(character)S 3191(*/)S 3120 V 1440(\(The)S 1660(\256rst)S 1846(three)S 2077(rules)S 2302(share)S 2544(the)S 2696(fourth's)S 3044(action)S 3319(since)S 3556(they)S 3759(use)S 3923(the)S 4076(special)S 4386('|')S 4504(action.\))S 10 B 4864(REJECT)S 3240 V 10 R 1440(is)S 1546(a)S 1630(particularly)S 2134(expensive)S 2575(feature)S 2895(in)S 3012(terms)S 3274(scanner)S 3620(performance;)S 4196(if)S 4296(it)S 4390(is)S 4495(used)S 4717(in)S 10 I 4833(any)S 10 R 5016(of)S 5138(the)S 3360 V 1440(scanner's)S 1861(actions)S 2186(it)S (will)157 2282 A 2479(slow)S 2709(down)S 10 I 2972(all)S 10 R 3118(of)S 3243(the)S 3407(scanner's)S 3829(matching.)S 4294(Furthermore,)S 10 B 4864(REJECT)S 3480 V 10 R (cannot)268 1440 A 1733(be)S 1853(used)S 2062(with)S 2266(the)S 10 I 2414(-f)S 10 R 2501(or)S 10 I 2610(-F)S 10 R 2731(options)S 3051(\(see)S 3239(below\).)S 3648 V 1440(Note)S 1669(also)S 1865(that)S 2050(unlike)S 2335(the)S 2492(other)S 2733(special)S 3047(actions,)S 10 B 3391(REJECT)S 10 R 3822(is)S 3923(a)S 10 I 4002(branch;)S 10 R 4354(code)S 4578(immediately)S 5115(fol-)S 3768 V 1440(lowing)S 1744(it)S 1825(in)S 1928(the)S 2076(action)S (will)157 2347 A 10 I 2529(not)S 10 R 2682(be)S 2802(executed.)S 3936 V 1080(-)S 10 B 1440(yymore\(\))S 10 R 1858(tells)S 2052(the)S 2202(scanner)S 2537(that)S 2715(the)S 2865(next)S 3065(time)S 3271(it)S 3354(matches)S 3711(a)S 3783(rule,)S 3992(the)S (corresponding)575 4142 A 4744(token)S (should)267 4994 A 4056 V 1440(be)S 10 I (appended)390 1565 A 10 R 1985(onto)S 2193(the)S 2346(current)S 2662(value)S 2910(of)S 10 B 3024(yytext)S 10 R 3316(rather)S 3581(than)S 3783(replacing)S 4187(it.)S 4322(For)S 4491(example,)S 4886(given)S 5138(the)S 4176 V (input)206 1440 A ("mega-kludge")607 1671 A 2303(the)S 2451(following)S (will)157 2867 A 3049(write)S ("mega-mega-kludge")859 3282 A 4166(to)S 4269(the)S 4417(output:)S 4416 V 1540(%%)S 4536 V 1540(mega-)S 1892(ECHO;)S 2220(yymore\(\);)S 4656 V (kludge)273 1540 A 1888(ECHO;)S 4896 V 1440(First)S 1656("mega-")S 2021(is)S 2119(matched)S 2491(and)S 2667(echoed)S 2983(to)S 3092(the)S 3246(output.)S 3583(Then)S ("kludge")355 3821 A 4208(is)S 4307(matched,)S 4705(but)S 4865(the)S 5020(previ-)S 5016 V 1440(ous)S 1609("mega-")S 1973(is)S (still)151 2070 A 2251(hanging)S (around)279 2604 A 2913(at)S 3016(the)S 3169(beginning)S 3600(of)S 10 B 3714(yytext)S 10 R 4007(so)S 4126(the)S 10 B 4279(ECHO)S 10 R 4605(for)S 4753(the)S ("kludge")355 4906 A 5136 V 1440(rule)S (will)157 1639 A 1838(actually)S 2199(write)S ("mega-kludge".)632 2449 A 3148(The)S 3347(presence)S 3742(of)S 10 B 3869(yymore\(\))S 10 R 4304(in)S 4425(the)S 4591(scanner's)S 5015(action)S 5256 V 1440(entails)S 1728(a)S 1798(minor)S 2063(performance)S 2598(penalty)S 2919(in)S 3022(the)S 3170(scanner's)S 3576(matching)S 3975(speed.)S 5424 V 1080(-)S 10 B 1440(yyless\(n\))S 10 R 1851(returns)S 2167(all)S 2305(but)S 2470(the)S 2630(\256rst)S 10 I 2824(n)S 10 R 2911(characters)S 3358(of)S 3479(the)S 3639(current)S 3962(token)S 4222(back)S 4449(to)S 4564(the)S (input)206 4724 A 4967(stream,)S 5544 V 1440(where)S 1720(they)S (will)157 1926 A 2116(be)S 2243(rescanned)S 2678(when)S 2928(the)S 3083(scanner)S (looks)217 3423 A 3672(for)S 3822(the)S 3977(next)S 4182(match.)S 10 B 4510(yytext)S 10 R 4805(and)S 10 B 4982(yyleng)S 5664 V 10 R 1440(are)S 1598(adjusted)S 1967(appropriately)S 2538(\(e.g.,)S 10 B 2776(yyleng)S 10 R (will)157 3089 A 3280(now)S 3487(be)S 3616(equal)S 3869(to)S 10 I 3982(n)S 10 R 4067(\).)S 4186(For)S 4361(example,)S 4762(on)S 4897(the)S (input)206 5055 A 5784 V ("foobar")345 1440 A 1810(the)S 1958(following)S (will)157 2374 A 2556(write)S 2789(out)S ("foobarbar":)502 2942 A 6024 V 1540(%%)S 6144 V (foobar)263 1540 A 1903(ECHO;)S 2231(yyless\(3\);)S 6264 V 1540([a-z]+)S 1889(ECHO;)S 6504 V 1440(An)S 1604(argument)S 2025(of)S 2150(0)S 2241(to)S 10 B 2360(yyless)S 10 R (will)157 2652 A 2850(cause)S 3115(the)S 3279(entire)S 3550(current)S (input)206 3877 A 4124(string)S 4395(to)S 4515(be)S 4652(scanned)S 5018(again.)S 6624 V 1440(Unless)S (you've)279 1740 A 2045(changed)S 2405(how)S 2603(the)S 2751(scanner)S (will)157 3084 A 3266(subsequently)S 3815(process)S 4142(its)S (input)206 4262 A 4493(\(using)S 10 B 4769(BEGIN,)S 10 R 5143(for)S 6744 V 1440(example\),)S 1865(this)S (will)157 2035 A 2217(result)S 2466(in)S 2569(an)S 2689(endless)S (loop.)203 3010 A 6912 V 1080(-)S 10 B (unput\(c\))371 1440 A 10 R 1860(puts)S 2076(the)S 2248(character)S 10 I 2669(c)S 10 R 2764(back)S 3004(onto)S 3232(the)S (input)206 3405 A 3661(stream.)S 4030(It)S (will)157 4142 A 4349(be)S 4494(the)S 4667(next)S 4890(character)S 7032 V 1440(scanned.)S 1864(The)S 2071(following)S 2512(action)S (will)157 2808 A 3015(take)S 3233(the)S 3406(current)S 3742(token)S 4015(and)S 4209(cause)S 4482(it)S 4587(to)S 4714(be)S 4858(rescanned)S 7152 V 1440(enclosed)S 1817(in)S 1920(parentheses.)S 7392 V 1540({)S 7512 V 1540(int)S 1671(i;)S 7903 V 720(Page)S 941(7)S 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4455(September)S 4911(13,)S (1996)200 5061 A 8143 V EP %%Page: 8 8 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V (unput\()262 1540 A ('\)')102 1827 A 1954(\);)S 1080 V 1540(for)S 1683(\()S 1742(i)S 1795(=)S 1877(yyleng)S 2175(-)S 2234(1;)S 2337(i)S 2390(>=)S 2529(0;)S 2632(--i)S 2753(\))S 1200 V (unput\()262 1640 A 1927(yytext[i])S 2299(\);)S 1320 V (unput\()262 1540 A ('\(')102 1827 A 1954(\);)S 1440 V 1540(})S 1680 V 1440(Note)S 1680(that)S 1875(since)S (each)185 2126 A 10 B (unput\(\))326 2356 A 10 R 2727(puts)S 2939(the)S 3107(given)S 3375(character)S 3791(back)S 4026(at)S 4144(the)S 10 I 4312(beginning)S 10 R 4758(of)S 4887(the)S (input)206 5055 A 1800 V 1440(stream,)S 1759(pushing)S 2101(back)S 2316(strings)S 2609(must)S 2829(be)S (done)195 2949 A (back-to-front.)557 3169 A 1968 V 1080(-)S 10 B (input\(\))298 1440 A 10 R 1764(reads)S 2003(the)S 2152(next)S 2351(character)S 2748(from)S 2970(the)S (input)206 3120 A 3353(stream.)S 3699(For)S 3866(example,)S 4259(the)S 4409(following)S 4827(is)S 4921(one)S 5093(way)S 2088 V 1440(to)S 1543(eat)S 1686(up)S 1811(C)S 1903(comments:)S 2328 V 1540(%%)S 2448 V 1540("/*")S 1900({)S 2568 V 1840(register)S 2168(int)S 2299(c;)S 2808 V 1840(for)S 1983(\()S 2042(;)S 2095(;)S 2148(\))S 2928 V 1940({)S 3048 V 1940(while)S 2189(\()S 2248(\(c)S 2352(=)S (input\(\)\))308 2434 A 2767(!=)S 2883('*')S 3026(&&)S 3168 V 2140(c)S 2210(!=)S 2326(EOF)S 2542(\))S 3288 V 2040(;)S 2168(/*)S 2271(eat)S 2414(up)S 2539(text)S 2715(of)S 2824(comment)S 3223(*/)S 3528 V 1940(if)S 2027(\()S 2086(c)S 2156(==)S 2295('*')S 2438(\))S 3648 V 2040({)S 3768 V 2040(while)S 2289(\()S 2348(\(c)S 2452(=)S (input\(\)\))308 2534 A 2867(==)S 3006('*')S 3149(\))S 3888 V 2140(;)S 4008 V 2040(if)S 2127(\()S 2186(c)S 2256(==)S 2395('/')S 2516(\))S 4128 V 2140(break;)S 2492(/*)S (found)234 2595 A 2854(the)S 3002(end)S 3172(*/)S 4248 V 2040(})S 4488 V 1940(if)S 2027(\()S 2086(c)S 2156(==)S 2295(EOF)S 2511(\))S 4608 V 2040({)S 4728 V 2040(error\()S 2296("EOF)S 2553(in)S 2656(comment")S 3096(\);)S 4848 V 2040(break;)S 4968 V 2040(})S 5088 V 1940(})S 5208 V 1840(})S 5448 V 1440(\(Note)S 1704(that)S 1889(if)S 1985(the)S 2142(scanner)S 2484(is)S 2585(compiled)S 2993(using)S 10 B 3245(C++,)S 10 R 3492(then)S 10 B (input\(\))298 3700 A 10 R 4033(is)S 4135(instead)S 4455(referred)S 4811(to)S 4924(as)S 10 B 5043(yyin-)S 5568 V (put\(\),)239 1440 A 10 R 1704(in)S 1807(order)S 2045(to)S 2148(avoid)S 2396(a)S 2466(name)S 2709(clash)S 2941(with)S 3145(the)S 10 B 3293(C++)S 10 R 3505(stream)S 3799(by)S 3924(the)S 4072(name)S 4315(of)S 10 I (input.\))265 4424 A 5736 V 10 R 1080(-)S 10 B 1440(yyterminate\(\))S 10 R 2056(can)S 2223(be)S 2346(used)S 2558(in)S 2664(lieu)S 2843(of)S 2955(a)S 3028(return)S 3297(statement)S 3711(in)S 3817(an)S 3940(action.)S 4264(It)S 4354(terminates)S 4802(the)S 4953(scanner)S 5856 V 1440(and)S 1618(returns)S 1931(a)S 2008(0)S 2090(to)S 2200(the)S 2355(scanner's)S 2768(caller,)S 3050(indicating)S 3484("all)S (done".)261 3658 A 3976(Subsequent)S 4471(calls)S 4688(to)S 4798(the)S 4953(scanner)S 5976 V (will)157 1440 A 1640(immediately)S 2186(return)S 2470(unless)S (preceded)364 2764 A 3171(by)S 3314(a)S 3402(call)S 3591(to)S 10 B (yyrestart\(\))460 3712 A 10 R 4215(\(see)S 4421(below\).)S 4795(By)S 4956(default,)S 6096 V 10 B 1440(yyterminate\(\))S 10 R 2068(is)S 2174(also)S 2375(called)S 2655(when)S 2912(an)S 3045(end-of-\256le)S 3509(is)S (encountered.)517 3614 A 4194(It)S 4294(is)S 4399(a)S 4482(macro)S 4772(and)S 4955(may)S 5166(be)S 6216 V 1440(rede\256ned.)S 6384 V 9 R 720(T)S 722(TH)S 780(HE)S 848(E)S 944(G)S 946(GE)S 1014(EN)S 1072(NE)S 1140(ER)S 1198(RA)S 1260(AT)S 1328(TE)S 1386(ED)S 1444(D)S 1550(S)S 1552(SC)S 1604(CA)S 1666(AN)S 1734(NN)S 1802(NE)S 1870(ER)S 1928(R)S 6504 V 10 R 1080(The)S 1269(output)S 1557(of)S 10 I 1673(\257ex)S 10 R 1845(is)S 1944(the)S 2099(\256le)S 10 B 2260(lex.yy.c,)S 10 R 2635(which)S 2913(contains)S 3280(the)S 3435(scanning)S 3824(routine)S 10 B 4142(yylex\(\),)S 10 R 4491(a)S 4569(number)S 4909(of)S 5026(tables)S 6624 V 1080(used)S 1296(by)S 1428(it)S 1516(for)S 1666(matching)S 2072(tokens,)S 2391(and)S 2567(a)S 2643(number)S 2981(of)S (auxiliary)358 3096 A 3485(routines)S 3840(and)S 4016(macros.)S 4388(By)S 4536(default,)S 10 B 4872(yylex\(\))S 10 R 5194(is)S 6744 V 1080(declared)S 1447(as)S 1556(follows:)S 6984 V 1180(int)S 1311(yylex\(\))S 7104 V 1280({)S 7224 V (...)75 1280 A 1380(various)S (de\256nitions)424 1701 A 2150(and)S 2320(the)S 2468(actions)S 2778(in)S 2881(here)S (...)75 3080 A 7344 V 1280(})S 7903 V 720(September)S 1176(13,)S (1996)200 1326 A 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4990(Page)S 5211(8)S 8143 V EP %%Page: 9 9 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V (\(If)102 1080 A (your)184 1213 A 1428(environment)S (supports)340 1967 A 2339(function)S 2706(prototypes,)S 3187(then)S 3392(it)S (will)157 3480 A 3669(be)S 3796("int)S 3975(yylex\()S 4264(void)S 4474(\)".\))S 4665(This)S (de\256nition)385 4876 A 1080 V 1080(may)S 1278(be)S 1398(changed)S 1758(by)S 1883(rede\256ning)S 2316(the)S 2464("YY_DECL")S 3031(macro.)S 3358(For)S 3523(example,)S (you)150 3914 A 4089(could)S 4337(use:)S 1320 V (#undef)279 1180 A 1484(YY_DECL)S 1440 V 1180(#de\256ne)S 1501(YY_DECL)S 1986(\257oat)S 2190(lexscan\()S 2551(a,)S 2646(b)S 2721(\))S 2780(\257oat)S 2984(a,)S 3079(b;)S 1680 V 1080(to)S 1194(give)S 1403(the)S 1562(scanning)S 1955(routine)S 2276(the)S 2435(name)S 10 I 2690(lexscan,)S 10 R 3054(returning)S 3460(a)S 3542(\257oat,)S 3783(and)S 3965(taking)S 4253(two)S 4441(\257oats)S 4696(as)S 4817(arguments.)S 1800 V 1080(Note)S 1315(that)S 1505(if)S (you)150 1606 A 1795(give)S 2007(arguments)S 2465(to)S 2582(the)S 2743(scanning)S 3138(routine)S 3461(using)S 3716(a)S (K&R-style/non-prototyped)1089 3799 A 4926(function)S 1920 V 1080(declaration,)S (you)150 1578 A 1753(must)S 1973(terminate)S 2379(the)S (de\256nition)385 2527 A 2937(with)S 3141(a)S 3211(semi-colon)S 3683(\(;\).)S 2088 V 1080(Whenever)S 10 B 1524(yylex\(\))S 10 R 1845(is)S 1942(called,)S 2238(it)S 2324(scans)S 2572(tokens)S 2864(from)S 3090(the)S 3243(global)S (input)206 3524 A 3760(\256le)S 10 I 3920(yyin)S 10 R 4119(\(which)S 4430(defaults)S 4780(to)S 4889(stdin\).)S 5199(It)S 2208 V 1080(continues)S (until)184 1491 A 1701(it)S 1783(either)S (reaches)303 2039 A 2368(an)S 2489(end-of-\256le)S 2941(\(at)S 3074(which)S 3346(point)S 3578(it)S 3660(returns)S 3966(the)S 4115(value)S 4359(0\))S 4468(or)S 4577(one)S 4747(of)S 4856(its)S 4976(actions)S 2328 V 1080(executes)S 1454(a)S 10 I 1526(return)S 10 R 1804(statement.)S 2267(In)S 2378(the)S 2528(former)S 2830(case,)S 3056(when)S 3302(called)S 3571(again)S 3817(the)S 3968(scanner)S (will)157 4304 A 4489(immediately)S 5020(return)S 2448 V 1080(unless)S 10 B (yyrestart\(\))460 1371 A 10 R 1871(is)S 1977(called)S 2257(to)S 2374(point)S 10 I 2619(yyin)S 10 R 2826(at)S 2938(the)S 3100(new)S (input)206 3307 A 3552(\256le.)S 3770(\()S 10 B (yyrestart\(\))460 3843 A 10 R 4342(takes)S 4588(one)S 4772(argument,)S 5216(a)S 2568 V 10 B 1080(FILE)S 1350(*)S 10 R 1435(pointer.\))S 1839(In)S 1958(the)S 2116(latter)S 2359(case)S 2568(\(i.e.,)S 2785(when)S 3038(an)S 3168(action)S 3449(executes)S 3831(a)S 3911(return\),)S 4246(the)S 4404(scanner)S 4748(may)S 4957(then)S 5166(be)S 2688 V 1080(called)S 1346(again)S 1589(and)S 1759(it)S (will)157 1840 A 2022(resume)S 2338(scanning)S 2720(where)S 2992(it)S 3073(left)S 3233(off.)S 2856 V 1080(By)S 1224(default)S 1531(\(and)S 1737(for)S 1883(purposes)S 2268(of)S 2380(ef\256ciency\),)S 2865(the)S 3016(scanner)S 3352(uses)S 3553(block-reads)S 4051(rather)S 4315(than)S 4516(simple)S 10 I 4812(getc\(\))S 10 R 5076(calls)S 2976 V 1080(to)S 1196(read)S 1408(characters)S 1856(from)S 10 I 2090(yyin.)S 10 R 2321(The)S 2515(nature)S 2804(of)S 2925(how)S 3135(it)S 3228(gets)S 3427(its)S (input)206 3559 A 3802(can)S 3979(be)S 4111(controlled)S 4556(by)S 4693(rede\256ning)S 5138(the)S 3096 V 10 B 1080(YY_INPUT)S 10 R 1622(macro.)S 1957(YY_INPUT's)S (calling)274 2557 A 2864(sequence)S 3266(is)S 3366("YY_INPUT\(buf,result,max_size\)".)S 4881(Its)S 5015(action)S 3216 V 1080(is)S 1177(to)S (place)213 1285 A 1528(up)S 1658(to)S 10 I 1766(max_size)S 10 R 2165(characters)S 2605(in)S 2713(the)S 2866(character)S 3267(array)S 10 I 3505(buf)S 10 R 3663(and)S 3838(return)S 4109(in)S 4217(the)S 4369(integer)S 4678(variable)S 10 I 5032(result)S 3336 V 10 R 1080(either)S 1340(the)S 1494(number)S 1832(of)S 1947(characters)S 2388(read)S 2593(or)S 2708(the)S 2862(constant)S 3228(YY_NULL)S 3725(\(0)S 3840(on)S 3971(Unix)S 4203(systems\))S 4586(to)S 4695(indicate)S 5045(EOF.)S 3456 V 1080(The)S 1262(default)S 1567(YY_INPUT)S 2086(reads)S 2324(from)S 2545(the)S 2693(global)S 2969(\256le-pointer)S 3442("yyin".)S 3624 V 1080(A)S 1178(sample)S (rede\256nition)464 1488 A 1977(of)S 2086(YY_INPUT)S 2605(\(in)S 2742(the)S (de\256nitions)424 2890 A 3339(section)S 3649(of)S 3758(the)S (input)206 3906 A 4137(\256le\):)S 3864 V 1180(%{)S 3984 V (#undef)279 1180 A 1484(YY_INPUT)S 4104 V 1180(#de\256ne)S 1501(YY_INPUT\(buf,result,max_size\))S 2876(\\)S 4224 V 1280({)S 1353(\\)S 4344 V 1280(int)S 1411(c)S 1481(=)S (getchar\(\);)393 1563 A 1981(\\)S 4464 V 1280(result)S 1529(=)S 1611(\(c)S 1715(==)S 1854(EOF\))S 2104(?)S 2174(YY_NULL)S 2665(:)S 2718(\(buf[0])S 3029(=)S 3111(c,)S 3206(1\);)S 3343(\\)S 4584 V 1280(})S 4704 V 1180(%})S 4944 V 1080(This)S (de\256nition)385 1284 A (will)157 1694 A 1876(change)S 2186(the)S (input)206 2334 A 2565(processing)S 3020(to)S 3123(occur)S 3372(one)S 3542(character)S 3938(at)S 4036(a)S 4106(time.)S 5112 V 1080(You)S 1282(also)S 1473(can)S 1643(add)S 1818(in)S 1926(things)S 2201(like)S 2382(keeping)S 2730(track)S 2962(of)S 3076(the)S (input)206 3229 A 3465(line)S 3646(number)S 3983(this)S 4158(way;)S 4384(but)S (don't)212 4542 A 4784(expect)S (your)184 5077 A 5232 V 1080(scanner)S 1413(to)S 1516(go)S 1641(very)S 1845(fast.)S 5400 V 1080(When)S 1360(the)S 1523(scanner)S (receives)331 1871 A 2242(an)S 2377(end-of-\256le)S 2843(indication)S 3285(from)S 3521(YY_INPUT,)S 4080(it)S 4176(then)S 4390(checks)S 4705(the)S 10 B 4869(yywrap\(\))S 5520 V 10 R 1080(function.)S 1496(If)S 10 B 1595(yywrap\(\))S 10 R 2018(returns)S 2329(false)S 2551(\(zero\),)S 2849(then)S 3053(it)S 3140(is)S 3238(assumed)S 3615(that)S 3797(the)S 3951(function)S 4317(has)S (gone)195 4482 A 4708(ahead)S 4974(and)S 5149(set)S 5640 V 1080(up)S 10 I 1217(yyin)S 10 R 1422(to)S 1538(point)S 1782(to)S 1898(another)S (input)206 2238 A 2482(\256le,)S 2674(and)S 2857(scanning)S 3252(continues.)S 3725(If)S 3831(it)S 3925(returns)S 4243(true)S (\(non-zero\),)451 4438 A 4927(then)S 5138(the)S 5760 V 1080(scanner)S 1413(terminates,)S 1883(returning)S 2277(0)S 2352(to)S 2455(its)S 2575(caller.)S 5928 V 1080(The)S 1262(default)S 10 B 1567(yywrap\(\))S 10 R 1984(always)S 2289(returns)S 2594(1.)S 2719(Presently,)S 3145(to)S 3249(rede\256ne)S 3600(it)S (you)150 3682 A 3858(must)S 4079(\256rst)S ("#undef)320 4262 A 4608(yywrap",)S 5002(as)S 5112(it)S 5194(is)S 6048 V 1080(currently)S 1481(implemented)S 2043(as)S 2164(a)S 2246(macro.)S 2585(As)S 2734(indicated)S 3140(by)S 3277(the)S 3437(hedging)S 3797(in)S 3912(the)S 4072(previous)S 4455(sentence,)S 4864(it)S 4957(may)S 5166(be)S 6168 V 1080(changed)S 1440(to)S 1543(a)S 1613(true)S 1795(function)S 2155(in)S 2258(the)S 2406(near)S 2605(future.)S 6336 V 1080(The)S 1269(scanner)S 1609(writes)S 1888(its)S 10 B 2015(ECHO)S 10 R 2343(output)S 2631(to)S 2741(the)S 10 I 2896(yyout)S 10 R 3147(global)S 3431(\(default,)S (stdout\),)304 3803 A 4140(which)S 4419(may)S 4625(be)S 4753(rede\256ned)S 5161(by)S 6456 V 1080(the)S 1228(user)S 1421(simply)S 1719(by)S 1844(assigning)S 2248(it)S 2329(to)S 2432(some)S 2669(other)S 10 B 2901(FILE)S 10 R 3161(pointer.)S 6624 V 9 R 720(S)S 722(ST)S 774(TA)S 832(AR)S 900(RT)S 962(T)S 1058(C)S 1060(CO)S 1122(ON)S 1190(ND)S 1258(DI)S 1326(IT)S 1359(TI)S 1417(IO)S 1450(ON)S 1518(NS)S 1586(S)S 6744 V 10 I 1080(\257ex)S 10 R 1252(provides)S 1630(a)S 1707(mechanism)S 2197(for)S (conditionally)530 2348 A 2911(activating)S 3341(rules.)S 3620(Any)S 3826(rule)S 4016(whose)S 4306(pattern)S 4619(is)S 4719(pre\256xed)S 5082(with)S 6864 V 1080("")S (will)157 1385 A 1567(only)S 1770(be)S 1890(active)S 2156(when)S 2399(the)S 2547(scanner)S 2880(is)S 2972(in)S 3075(the)S 3223(start)S (condition)379 3422 A 3826(named)S 4119("sc".)S 4360(For)S 4525(example,)S 7104 V 1180([\303"]*)S 2052({)S 2125(/*)S 2228(eat)S 2371(up)S 2496(the)S 2644(string)S (body)200 2898 A (...)75 3123 A 3223(*/)S 7224 V (...)75 1480 A 7344 V 1480(})S 7903 V 720(Page)S 941(9)S 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4455(September)S 4911(13,)S (1996)200 5061 A 8143 V EP %%Page: 10 10 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V (will)157 1080 A 1262(be)S 1382(active)S 1648(only)S 1851(when)S 2094(the)S 2242(scanner)S 2575(is)S 2667(in)S 2770(the)S 2918("STRING")S 3390(start)S (condition,)404 3589 A 4018(and)S 1200 V (\\.)1297 1180 A 2677({)S 2750(/*)S 2853(handle)S 3146(an)S 3266(escape)S (...)75 3560 A 3660(*/)S 1320 V (...)75 1480 A 1440 V 1480(})S 1680 V (will)157 1080 A 1262(be)S 1382(active)S 1648(only)S 1851(when)S 2094(the)S 2242(current)S 2553(start)S (condition)379 2752 A 3156(is)S 3248(either)S 3503("INITIAL",)S 4007("STRING",)S 4504(or)S ("QUOTE".)450 4613 A 1848 V 1080(Start)S (conditions)418 1300 A 1747(are)S 1901(declared)S 2273(in)S 2381(the)S (de\256nitions)424 2534 A 2988(\(\256rst\))S 3243(section)S 3558(of)S 3672(the)S (input)206 3825 A 4061(using)S 4308(unindented)S 4784(lines)S 5004(begin-)S 1968 V 1080(ning)S 1286(with)S 1493(either)S 10 B 1751(%s)S 10 R 1918(or)S 10 B 2030(%x)S 10 R 2208(followed)S 2594(by)S 2721(a)S 2793(list)S 2943(of)S 3054(names.)S 3388(The)S 3572(former)S 3874(declares)S 10 I 4232(inclusive)S 10 R 4617(start)S (conditions,)443 4818 A 2088 V 1080(the)S 1235(latter)S 10 I (exclusive)370 1475 A 10 R 1877(start)S (conditions.)443 2083 A 2584(A)S 2690(start)S (condition)379 2897 A 3309(is)S 3409(activated)S 3806(using)S 4056(the)S 10 B 4212(BEGIN)S 10 R 4569(action.)S (Until)207 4898 A 5138(the)S 2208 V 1080(next)S 10 B 1283(BEGIN)S 10 R 1636(action)S 1911(is)S 2007(executed,)S 2419(rules)S 2644(with)S 2852(the)S 3004(given)S 3256(start)S (condition)379 3459 A (will)157 3867 A 4053(be)S 4177(active)S 4447(and)S 4621(rules)S 4846(with)S 5054(other)S 2328 V 1080(start)S (conditions)418 1281 A (will)157 1726 A 1910(be)S 2032(inactive.)S 2428(If)S 2523(the)S 2673(start)S (condition)379 2874 A 3280(is)S 10 I 3374(inclusive,)S 10 R 3784(then)S 3984(rules)S 4207(with)S 4413(no)S 4540(start)S (conditions)418 4742 A 5188(at)S 2448 V 1080(all)S (will)157 1209 A 1394(also)S 1584(be)S 1707(active.)S 2026(If)S 2122(it)S 2206(is)S 10 I (exclusive,)395 2301 A 10 R 2724(then)S 10 I 2924(only)S 10 R 3124(rules)S 3347(quali\256ed)S 3726(with)S 3932(the)S 4082(start)S (condition)379 4283 A (will)157 4689 A 4873(be)S 4995(active.)S 2568 V 1080(A)S 1180(set)S 1319(of)S 1430(rules)S 1653(contingent)S 2104(on)S 2231(the)S 2381(same)S 2615(exclusive)S 3022(start)S (condition)379 3223 A 3629(describe)S 3992(a)S 4065(scanner)S 4401(which)S 4675(is)S 4770(independent)S 2688 V 1080(of)S 1199(any)S 1379(of)S 1498(the)S 1656(other)S 1898(rules)S 2129(in)S 2241(the)S 10 I 2398(\257ex)S 10 R (input.)231 2572 A (Because)336 2862 A 3232(of)S 3350(this,)S 3554(exclusive)S 3968(start)S (conditions)418 4176 A 4628(make)S 4880(it)S 4970(easy)S 5183(to)S 2808 V 1080(specify)S 1405("mini-scanners")S 2086(which)S 2366(scan)S 2579(portions)S 2942(of)S 3060(the)S (input)206 3217 A 3457(that)S 3642(are)S 3800(syntactically)S 4343(different)S 4726(from)S 4957(the)S 5115(rest)S 2928 V 1080(\(e.g.,)S 1309(comments\).)S 3096 V 1080(If)S 1177(the)S 1329(distinction)S 1782(between)S 2148(inclusive)S 2541(and)S 2716(exclusive)S 3126(start)S (conditions)418 3330 A 3778(is)S (still)151 3875 A 4056(a)S (little)185 4131 A 4346(vague,)S 4641(here's)S 4918(a)S 4993(simple)S 3216 V 1080(example)S (illustrating)436 1446 A 1907(the)S (connection)441 2055 A 2521(between)S 2882(the)S 3030(two.)S 3256(The)S 3438(set)S 3575(of)S 3684(rules:)S 3456 V 1180(%s)S 1328(example)S 3576 V 1180(%%)S 3696 V 1180(foo)S 2044(/*)S 2147(do)S 2272(something)S 2715(*/)S 3936 V 1080(is)S 1172(equivalent)S 1616(to)S 4176 V 1180(%x)S 1339(example)S 4296 V 1180(%%)S 4416 V 1180(foo)S 2241(/*)S 2344(do)S 2469(something)S 2912(*/)S 4704 V 1080(The)S 1262(default)S 1567(rule)S 1749(\(to)S 10 B 1886(ECHO)S 10 R 2207(any)S 2377(unmatched)S 2843(character\))S 3273(remains)S 3617(active)S 3883(in)S 3986(start)S (conditions.)443 4185 A 4872 V 10 B 1080(BEGIN\(0\))S 10 R 1556(returns)S 1870(to)S 1982(the)S 2139(original)S 2486(state)S 2705(where)S 2986(only)S 3198(the)S 3355(rules)S 3586(with)S 3800(no)S 3935(start)S (conditions)418 4144 A 4597(are)S 4756(active.)S 5082(This)S 4992 V 1080(state)S 1300(can)S 1475(also)S 1672(be)S 1802(referred)S 2158(to)S 2271(as)S 2390(the)S (start-condition)587 2548 A 3170("INITIAL",)S 3683(so)S 10 B 3806(BEGIN\(INITIAL\))S 10 R 4629(is)S 4730(equivalent)S 5183(to)S 5112 V 10 B 1080(BEGIN\(0\).)S 10 R 1575(\(The)S 1794(parentheses)S (around)279 2293 A 2601(the)S 2753(start)S (condition)379 2956 A 3364(name)S 3611(are)S 3764(not)S 3921(required)S 4286(but)S 4443(are)S 4596(considered)S (good)200 5061 A 5232 V 1080(style.\))S 5400 V 10 B 1080(BEGIN)S 10 R 1432(actions)S 1745(can)S 1914(also)S 2105(be)S 2229(given)S 2481(as)S 2594(indented)S 2969(code)S 3188(at)S 3290(the)S 3442(beginning)S 3872(of)S 3985(the)S 4137(rules)S 4362(section.)S 4726(For)S 4895(example,)S 5520 V 1080(the)S 1232(following)S (will)157 1652 A 1838(cause)S 2091(the)S 2243(scanner)S 2580(to)S 2687(enter)S 2918(the)S 3070("SPECIAL")S 3591(start)S (condition)379 3794 A 4201(whenever)S 10 I 4621(yylex\(\))S 10 R 4925(is)S 5020(called)S 5640 V 1080(and)S 1250(the)S 1398(global)S 1674(variable)S 10 I 2024(enter_special)S 10 R 2591(is)S 2683(true:)S 5880 V 1380(int)S 1511(enter_special;)S 6120 V 1180(%x)S 1339(SPECIAL)S 6240 V 1180(%%)S 6360 V 1380(if)S 1467(\()S 1526(enter_special)S 2083(\))S 6480 V 1480(BEGIN\(SPECIAL\);)S 6720 V 1180(blahblahblah)S 6840 V (...more)282 1180 A 1487(rules)S (follow...)338 1708 A 7128 V 1080(To)S (illustrate)353 1222 A 1605(the)S 1758(uses)S 1961(of)S 2075(start)S (conditions,)443 2279 A 2752(here)S 2956(is)S 3053(a)S 3128(scanner)S 3466(which)S 3742(provides)S 4118(two)S 4300(different)S 4679(interpretations)S 7248 V 1080(of)S 1191(a)S 1263(string)S 1518(like)S ("123.456".)432 1695 A 2178(By)S 2321(default)S 2627(it)S (will)157 2709 A 2892(treat)S 3098(it)S 3180(as)S 3290(as)S 3400(three)S 3628(tokens,)S 3941(the)S 4090(integer)S ("123",)257 4396 A 4679(a)S 4750(dot)S 4904(\('.'\),)S 5116(and)S 7368 V 1080(the)S 1238(integer)S ("456".)257 1553 A 1870(But)S 2050(if)S 2147(the)S 2305(string)S 2569(is)S (preceded)364 2671 A 3070(earlier)S 3364(in)S 3477(the)S 3635(line)S 3821(by)S 3956(the)S 4114(string)S 4379("expect-\257oats")S 5012(it)S (will)157 5104 A 7488 V 1080(treat)S 1285(it)S 1366(as)S 1475(a)S 1545(single)S 1810(token,)S 2083(the)S 2231(\257oating-point)S 2803(number)S (123.456:)353 3135 A 7903 V 720(September)S 1176(13,)S (1996)200 1326 A 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4940(Page)S 5161(10)S 8143 V EP %%Page: 11 11 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1180(%{)S 1080 V 1180(#include)S 1551()S 1200 V 1180(%})S 1320 V 1180(%s)S 1328(expect)S 1560 V 1180(%%)S 1680 V 1180(expect-\257oats)S 1895(BEGIN\(expect\);)S 1920 V 1180([0-9]+"."[0-9]+)S 2332({)S 2040 V 1480(printf\()S ("found)275 1763 A 2063(a)S 2133(\257oat,)S 2362(=)S 2444(%f\\n",)S 2160 V 1680(atof\()S 1896(yytext)S 2172(\))S 2231(\);)S 2280 V 1480(})S 2400 V 1180(\\n)S 1910({)S 2520 V 1480(/*)S 1583(that's)S 1832(the)S 1980(end)S 2150(of)S 2259(the)S 2407(line,)S 2608(so)S 2640 V 1505(*)S 1580(we)S 1723(need)S 1938(another)S 2265("expect-number")S 2760 V 1505(*)S 1580(before)S 1863(we'll)S (recognize)392 2096 A 2513(any)S 2683(more)S 2880 V 1505(*)S 1580(numbers)S 3000 V 1505(*/)S 3120 V 1480(BEGIN\(INITIAL\);)S 3240 V 1480(})S 3480 V 1180([0-9]+)S 1589({)S 3600 V 1480(printf\()S ("found)275 1763 A 2063(an)S 2183(integer,)S 2513(=)S 2595(%d\\n",)S 3720 V 1680(atoi\()S 1890(yytext)S 2166(\))S 2225(\);)S 3840 V 1480(})S 4080 V 1180(".")S 1512(printf\()S ("found)275 1795 A 2095(a)S 2165(dot\\n")S 2437(\);)S 4320 V 1080(Here)S 1322(is)S 1434(a)S 1524(scanner)S 1877(which)S (recognizes)431 2168 A 2645(\(and)S 2870(discards\))S 3280(C)S 3393(comments)S 3852(while)S 4122(maintaining)S 4648(a)S (count)223 4739 A 5008(of)S 5138(the)S 4440 V 1080(current)S (input)206 1391 A 1622(line.)S 4680 V 1180(%x)S 1339(comment)S 4800 V 1180(%%)S 4920 V 1380(int)S (line_num)379 1511 A 1915(=)S 1997(1;)S 5160 V 1180("/*")S 1565(BEGIN\(comment\);)S 5400 V 1180([\303*\\n]*)S 2148(/*)S 2251(eat)S 2394(anything)S 2770(that's)S 3019(not)S 3172(a)S 3242('*')S 3385(*/)S 5520 V 1180("*"+[\303*/\\n]*)S 2240(/*)S 2343(eat)S 2486(up)S 2611('*'s)S 2793(not)S 2946(followed)S 3329(by)S 3454('/'s)S 3614(*/)S 5640 V 1180(\\n)S (++line_num;)521 2071 A 5760 V 1180("*"+"/")S 2167(BEGIN\(INITIAL\);)S 6000 V 1080(Note)S 1308(that)S (start-conditions)626 1492 A 2151(names)S 2441(are)S 2598(really)S 2861(integer)S 3174(values)S 3464(and)S 3642(can)S 3815(be)S 3943(stored)S 4222(as)S 4339(such.)S 4606(Thus,)S 4865(the)S (above)240 5021 A 6120 V 1080(could)S 1328(be)S 1448(extended)S 1836(in)S 1939(the)S 2087(following)S 2503(fashion:)S 6360 V 1180(%x)S 1339(comment)S 1738(foo)S 6480 V 1180(%%)S 6600 V 1380(int)S (line_num)379 1511 A 1915(=)S 1997(1;)S 6720 V 1380(int)S 1511(comment_caller;)S 6960 V 1180("/*")S 1565({)S 7080 V 1505(comment_caller)S 2179(=)S 2261(INITIAL;)S 7200 V 1505(BEGIN\(comment\);)S 7320 V 1505(})S 7903 V 720(Page)S 941(11)S 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4455(September)S 4911(13,)S (1996)200 5061 A 8143 V EP %%Page: 12 12 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V (...)75 1180 A 1200 V 1180("/*")S 1688({)S 1320 V 1505(comment_caller)S 2179(=)S 2261(foo;)S 1440 V 1505(BEGIN\(comment\);)S 1560 V 1505(})S 1800 V 1180([\303*\\n]*)S 2148(/*)S 2251(eat)S 2394(anything)S 2770(that's)S 3019(not)S 3172(a)S 3242('*')S 3385(*/)S 1920 V 1180("*"+[\303*/\\n]*)S 2240(/*)S 2343(eat)S 2486(up)S 2611('*'s)S 2793(not)S 2946(followed)S 3329(by)S 3454('/'s)S 3614(*/)S 2040 V 1180(\\n)S (++line_num;)521 2071 A 2160 V 1180("*"+"/")S 2167(BEGIN\(comment_caller\);)S 2400 V 1080(One)S 1279(can)S 1450(then)S 1654(implement)S 2115(a)S 2191("stack")S 2511(of)S 2626(start)S (conditions)418 2831 A 3280(using)S 3528(an)S 3654(array)S 3893(of)S 4008(integers.)S 4408(\(It)S 4535(is)S 4633(likely)S 4894(that)S 5077(such)S 2520 V 1080(stacks)S (will)157 1358 A 1547(become)S 1892(a)S 1969(full-\257edged)S 10 I 2471(\257ex)S 10 R 2643(feature)S 2956(in)S 3066(the)S 3221(future.\))S 3578(Note,)S (though,)303 3831 A 4166(that)S 4348(start)S (conditions)418 4553 A 5002(do)S 5133(not)S 2640 V 1080(have)S 1295(their)S 1505(own)S (name-space;)504 1703 A 2232(%s's)S 2453(and)S 2623(%x's)S 2855(declare)S 3172(names)S 3454(in)S 3557(the)S 3705(same)S 3937(fashion)S 4258(as)S 4367(#de\256ne's.)S 2808 V 9 R 720(M)S 722(MU)S 804(UL)S 872(LT)S 930(TI)S 988(IP)S 1021(PL)S 1073(LE)S 1131(E)S 1227(I)S 1229(IN)S 1262(NP)S 1330(PU)S 1382(UT)S 1450(T)S 1546(B)S 1548(BU)S 1610(UF)S 1678(FF)S 1730(FE)S 1782(ER)S 1840(RS)S 1902(S)S 2928 V 10 R 1080(Some)S 1334(scanners)S 1706(\(such)S 1949(as)S 2058(those)S 2295(which)S (support)301 2566 A 2892("include")S 3295(\256les\))S 3522(require)S 3834(reading)S 4162(from)S 4384(several)S (input)206 4696 A 4928(streams.)S 3048 V 1080(As)S 10 I 1225(\257ex)S 10 R 1397(scanners)S 1776(do)S 1908(a)S 1985(large)S (amount)301 2219 A 2552(of)S 2668(buffering,)S 3100(one)S (cannot)268 3277 A 3577(control)S 3894(where)S 4173(the)S 4328(next)S (input)206 4533 A (will)157 4771 A 4960(be)S 5087(read)S 3168 V 1080(from)S 1305(by)S 1434(simply)S (writing)291 1736 A 2056(a)S 10 B 2130(YY_INPUT)S 10 R 2669(which)S 2944(is)S (sensitive)352 3040 A 3422(to)S 3530(the)S 3683(scanning)S 4070(context.)S 10 B 4446(YY_INPUT)S 10 R 4986(is)S 5083(only)S 3288 V 1080(called)S 1350(when)S 1597(the)S 1749(scanner)S (reaches)303 2086 A 2418(the)S 2570(end)S 2744(of)S 2857(its)S 2981(buffer,)S 3282(which)S 3557(may)S 3759(be)S 3883(a)S (long)178 3957 A 4163(time)S 4370(after)S 4584(scanning)S 4969(a)S 5042(state-)S 3408 V 1080(ment)S 1306(such)S 1515(as)S 1624(an)S 1744("include")S 2147(which)S 2418(requires)S 2768(switching)S 3184(the)S (input)206 3332 A 3563(source.)S 3576 V 1080(To)S 1228(negotiate)S 1633(these)S 1877(sorts)S 2104(of)S 2225(problems,)S 10 I 2661(\257ex)S 10 R 2838(provides)S 3221(a)S 3303(mechanism)S 3798(for)S 3953(creating)S 4315(and)S 4497(switching)S 4925(between)S 3696 V (multiple)335 1080 A (input)206 1440 A 1671(buffers.)S 2032(An)S (input)206 2180 A 2411(buffer)S 2683(is)S 2775(created)S 3092(by)S 3217(using:)S 3936 V 1180(YY_BUFFER_STATE)S (yy_create_buffer\()723 2147 A 2895(FILE)S 3134(*\256le,)S 3363(int)S 3494(size)S 3676(\))S 4176 V 1080(which)S 1365(takes)S 1611(a)S 10 I 1695(FILE)S 10 R 1948(pointer)S 2272(and)S 2456(a)S 2540(size)S 2736(and)S 2920(creates)S 3240(a)S 3324(buffer)S 3610(associated)S 4063(with)S 4281(the)S 4443(given)S 4705(\256le)S 4874(and)S 5059(large)S 4296 V (enough)295 1080 A 1429(to)S 1561(hold)S 10 I 1793(size)S 10 R 1998(characters)S 2462(\(when)S 2768(in)S (doubt,)253 2900 A 3207(use)S 10 B 3395(YY_BUF_SIZE)S 10 R 4126(for)S 4298(the)S 4474(size\).)S 4768(It)S 4883(returns)S 5216(a)S 4416 V 10 B 1080(YY_BUFFER_STATE)S 10 R 2085(handle,)S 2403(which)S 2674(may)S 2872(then)S 3070(be)S 3190(passed)S 3483(to)S 3586(other)S 3818(routines:)S 4656 V 1180(void)S (yy_switch_to_buffer\()872 1383 A 2280(YY_BUFFER_STATE)S (new_buffer)465 3247 A 3737(\))S 4896 V 1080(switches)S 1479(the)S 1654(scanner's)S (input)206 2087 A 2345(buffer)S 2645(so)S 2787(subsequent)S 3286(tokens)S (will)157 3601 A 3811(come)S 4082(from)S 10 I (new_buffer.)477 4331 A 10 R 4861(Note)S 5110(that)S 5016 V 10 B (yy_switch_to_buffer\(\))947 1080 A 10 R 2061(may)S 2268(be)S 2397(used)S 2615(by)S 2749(yywrap\(\))S 3153(to)S 3265(sets)S 3450(things)S 3729(up)S 3863(for)S 4015(continued)S 4444(scanning,)S 4859(instead)S 5177(of)S 5136 V 1080(opening)S 1428(a)S 1498(new)S 1691(\256le)S 1845(and)S 2015(pointing)S 10 I 2374(yyin)S 10 R 2567(at)S 2665(it.)S 5376 V 1180(void)S (yy_delete_buffer\()722 1383 A 2130(YY_BUFFER_STATE)S 3097(buffer)S 3369(\))S 5616 V 1080(is)S 1172(used)S 1381(to)S 1484(reclaim)S 1812(the)S 1960(storage)S 2276(associated)S 2715(with)S 2919(a)S 2989(buffer.)S 5784 V 10 B (yy_new_buffer\(\))712 1080 A 10 R 1827(is)S 1929(an)S 2059(alias)S 2280(for)S 10 B (yy_create_buffer\(\),)827 2434 A 10 R 3297(provided)S 3690(for)S (compatibility)536 3844 A 4416(with)S 4631(the)S 4790(C++)S 5007(use)S 5177(of)S 5904 V 10 I 1080(new)S 10 R 1267(and)S 10 I 1437(delete)S 10 R 1703(for)S 1846(creating)S 2196(and)S 2366(destroying)S (dynamic)346 2815 A 3186(objects.)S 6072 V 1080(Finally,)S 1418(the)S 10 B (YY_CURRENT_BUFFER)1149 1569 A 10 R 2746(macro)S 3027(returns)S 3336(a)S 10 B 3410(YY_BUFFER_STATE)S 10 R 4419(handle)S 4716(to)S 4823(the)S 4975(current)S 6192 V 1080(buffer.)S 6360 V 1080(Here)S 1320(is)S 1430(an)S 1568(example)S 1952(of)S 2079(using)S 2339(these)S 2589(features)S 2952(for)S (writing)291 3113 A 3448(a)S 3537(scanner)S 3889(which)S 4179(expands)S 4552(include)S 4892(\256les)S 5104(\(the)S 6480 V 10 B 1080(<>)S 10 R 1540(feature)S 1846(is)S 1938(discussed)S 2348(below\):)S 6720 V 1180(/*)S 1283(the)S 1431("incl")S 1689(state)S 1899(is)S 1991(used)S 2200(for)S 2343(picking)S 2669(up)S 2794(the)S 2942(name)S 6840 V 1205(*)S 1280(of)S 1389(an)S 1509(include)S 1830(\256le)S 6960 V 1205(*/)S 7080 V 1180(%x)S 1339(incl)S 7320 V 1180(%{)S 7440 V 1180(#de\256ne)S 1501(MAX_INCLUDE_DEPTH)S 2631(10)S 7903 V 720(September)S 1176(13,)S (1996)200 1326 A 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4940(Page)S 5161(12)S 8143 V EP %%Page: 13 13 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1180(YY_BUFFER_STATE)S 2147(include_stack[MAX_INCLUDE_DEPTH];)S 1080 V 1180(int)S (include_stack_ptr)715 1311 A 2051(=)S 2133(0;)S 1200 V 1180(%})S 1440 V 1180(%%)S 1560 V 1180(include)S 1801(BEGIN\(incl\);)S 1800 V 1180([a-z]+)S 1779(ECHO;)S 1920 V 1180([\303a-z\\n]*\\n?)S 1857(ECHO;)S 2160 V 1180([)S 1504(\\t]*)S 1794(/*)S 1897(eat)S 2040(the)S (whitespace)448 2188 A 2661(*/)S 2280 V 1180([\303)S (\\t\\n]+)225 1538 A 1838({)S 1911(/*)S 2014(got)S 2167(the)S 2315(include)S 2636(\256le)S 2790(name)S 3033(*/)S 2400 V 1380(if)S 1467(\()S (include_stack_ptr)715 1526 A 2266(>=)S 2405(MAX_INCLUDE_DEPTH)S 3535(\))S 2520 V 1480({)S 2640 V 1480(fprintf\()S 1797(stderr,)S 2077("Includes)S 2484(nested)S 2766(too)S 2919(deeply")S 3253(\);)S 2760 V 1480(exit\()S 1690(1)S 1765(\);)S 2880 V 1480(})S 3120 V (include_stack[include_stack_ptr++])1450 1380 A 2855(=)S 3240 V 1480(YY_CURRENT_BUFFER;)S 3480 V 1380(yyin)S 1583(=)S 1665(fopen\()S 1953(yytext,)S 2254("r")S 2395(\);)S 3720 V 1380(if)S 1467(\()S 1526(!)S 1585(yyin)S 1788(\))S 3840 V 1480(error\()S (...)75 1736 A 1836(\);)S 4080 V (yy_switch_to_buffer\()872 1380 A 4200 V (yy_create_buffer\()723 1480 A 2228(yyin,)S 2456(YY_BUF_SIZE)S 3137(\))S 3196(\);)S 4440 V 1380(BEGIN\(INITIAL\);)S 4560 V 1380(})S 4800 V 1180(<>)S 1624({)S 4920 V 1380(if)S 1467(\()S (--include_stack_ptr)783 1526 A 2334(<)S 2416(0)S 2491(\))S 5040 V 1480({)S 5160 V 1480(yyterminate\(\);)S 5280 V 1480(})S 5520 V 1380(else)S 5640 V (yy_switch_to_buffer\()872 1480 A 5760 V (include_stack[include_stack_ptr])1336 1605 A 2966(\);)S 5880 V 1380(})S 6168 V 9 R 720(E)S 722(EN)S 780(ND)S 848(D-)S 916(-O)S 949(OF)S 1017(F-)S 1069(-F)S 1102(FI)S 1154(IL)S 1187(LE)S 1245(E)S 1341(R)S 1343(RU)S 1405(UL)S 1473(LE)S 1531(ES)S 1589(S)S 6288 V 10 R 1080(The)S 1262(special)S 1567(rule)S 1749("<>")S 2275(indicates)S 2658(actions)S 2968(which)S 3240(are)S 3390(to)S 3494(be)S 3615(taken)S 3859(when)S 4103(an)S 4224(end-of-\256le)S 4676(is)S (encountered)492 4769 A 6408 V 1080(and)S 1263(yywrap\(\))S 1671(returns)S (non-zero)358 1989 A 2385(\(i.e.,)S 2605(indicates)S 3000(no)S 3137(further)S 3449(\256les)S 3654(to)S 3769(process\).)S 4192(The)S 4386(action)S 4669(must)S 4901(\256nish)S 5161(by)S 6528 V 1080(doing)S 1333(one)S 1503(of)S 1612(four)S 1805(things:)S 6696 V 1080(-)S 1440(the)S 1588(special)S 10 B 1893(YY_NEW_FILE)S 10 R 2639(action,)S 2935(if)S 10 I 3022(yyin)S 10 R 3215(has)S 3374(been)S 3589(pointed)S 3915(at)S 4013(a)S 4083(new)S 4276(\256le)S 4430(to)S 4533(process;)S 6864 V 1080(-)S 1440(a)S 10 I 1510(return)S 10 R 1786(statement;)S 7032 V 1080(-)S 1440(the)S 1588(special)S 10 B 1893(yyterminate\(\))S 10 R 2507(action;)S 7200 V 1080(-)S 1440(or,)S 1574(switching)S 1990(to)S 2093(a)S 2163(new)S 2356(buffer)S 2628(using)S 10 B (yy_switch_to_buffer\(\))947 2870 A 10 R 3842(as)S 3951(shown)S 4238(in)S 4341(the)S 4489(example)S (above.)265 4855 A 7368 V 1080(<>)S 1525(rules)S 1747(may)S 1946(not)S 2100(be)S 2221(used)S 2431(with)S 2636(other)S 2869(patterns;)S 3242(they)S 3441(may)S 3640(only)S 3844(be)S 3965(quali\256ed)S 4343(with)S 4548(a)S 4620(list)S 4770(of)S 4881(start)S 5082(con-)S 7488 V (ditions.)298 1080 A 1431(If)S 1527(an)S (unquali\256ed)452 1650 A 2130(<>)S 2577(rule)S 2761(is)S 2855(given,)S 3130(it)S 3213(applies)S 3525(to)S 10 I 3630(all)S 10 R 3763(start)S (conditions)418 3964 A 4409(which)S 4682(do)S 4809(not)S 4964(already)S 7903 V 720(Page)S 941(13)S 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4455(September)S 4911(13,)S (1996)200 5061 A 8143 V EP %%Page: 14 14 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1080(have)S 1295(<>)S 1739(actions.)S 2099(To)S 2236(specify)S 2552(an)S 2672(<>)S 3116(rule)S 3298(for)S 3441(only)S 3644(the)S (initial)235 3792 A 4052(start)S (condition,)404 4251 A 4680(use)S 1200 V (<>)905 1180 A 1488 V 1080(These)S 1346(rules)S 1567(are)S 1716(useful)S 1987(for)S 2130(catching)S 2496(things)S 2766(like)S 2942(unclosed)S 3324(comments.)S 3812(An)S 3960(example:)S 1728 V 1180(%x)S (quote)223 1339 A 1848 V 1180(%%)S 2088 V (...other)282 1180 A 1487(rules)S 1708(for)S 1851(dealing)S 2172(with)S (quotes...)337 2376 A 2328 V (<>)756 1180 A 2011({)S 2448 V 1405(error\()S 1661("unterminated)S (quote")264 2258 A 2547(\);)S 2568 V 1405(yyterminate\(\);)S 2688 V 1405(})S 2808 V 1180(<>)S 1649({)S 2928 V 1405(if)S 1492(\()S 1551(*++\256lelist)S 1992(\))S 3048 V 1505({)S 3168 V 1505(yyin)S 1708(=)S 1790(fopen\()S 2078(*\256lelist,)S 2430("r")S 2571(\);)S 3288 V 1505(YY_NEW_FILE;)S 3408 V 1505(})S 3528 V 1405(else)S 3648 V 1480(yyterminate\(\);)S 3768 V 1405(})S 4056 V 9 R 720(M)S 722(MI)S 804(IS)S 837(SC)S 889(CE)S 951(EL)S 1009(LL)S 1067(LA)S 1125(AN)S 1193(NE)S 1261(EO)S 1319(OU)S 1387(US)S 1455(S)S 1545(M)S 1547(MA)S 1629(AC)S 1697(CR)S 1759(RO)S 1821(OS)S 1889(S)S 4176 V 10 R 1080(The)S 1263(macro)S 10 B 1541(YY_USER_ACTION)S 10 R 2485(can)S 2651(be)S 2772(rede\256ned)S 3173(to)S 3277(provide)S 3611(an)S 3733(action)S 4006(which)S 4279(is)S 4373(always)S 4680(executed)S 5065(prior)S 4296 V 1080(to)S 1191(the)S 1347(matched)S 1721(rule's)S 1984(action.)S 2313(For)S 2486(example,)S 2885(it)S 2974(could)S 3230(be)S 3358(#de\256ne'd)S 3771(to)S 3882(call)S 4061(a)S 4139(routine)S 4456(to)S (convert)302 4566 A 4900(yytext)S 5183(to)S 4416 V 1080(lower-case.)S 4584 V 1080(The)S 1269(macro)S 10 B 1554(YY_USER_INIT)S 10 R 2320(may)S 2526(be)S 2654(rede\256ned)S 3062(to)S 3173(provide)S 3513(an)S 3641(action)S 3920(which)S 4199(is)S 4299(always)S 4612(executed)S 5003(before)S 4704 V 1080(the)S 1232(\256rst)S 1418(scan)S 1626(\(and)S 1834(before)S 2121(the)S 2273(scanner's)S 2683(internal)S (initializations)548 3020 A 3597(are)S (done\).)254 3750 A 4057(For)S 4225(example,)S 4619(it)S 4703(could)S 4954(be)S 5077(used)S 4824 V 1080(to)S 1183(call)S 1354(a)S 1424(routine)S 1734(to)S 1837(read)S 2036(in)S 2139(a)S 2209(data)S 2402(table)S 2623(or)S 2732(open)S 2952(a)S (logging)306 3022 A 3353(\256le.)S 4992 V 1080(In)S 1192(the)S 1343(generated)S 1763(scanner,)S 2124(the)S 2275(actions)S 2588(are)S 2740(all)S 2869(gathered)S 3244(in)S 3350(one)S 3523(large)S 3753(switch)S 4045(statement)S 4460(and)S 4634(separated)S 5044(using)S 5112 V 10 B 1080(YY_BREAK,)S 10 R 1702(which)S 1991(may)S 2207(be)S 2345(rede\256ned.)S 2813(By)S 2973(default,)S 3321(it)S 3420(is)S 3530(simply)S 3846(a)S 3934("break",)S 4308(to)S 4429(separate)S (each)185 4803 A 5031(rule's)S 5232 V 1080(action)S 1358(from)S 1586(the)S 1741(following)S 2164(rule's.)S 2476(Rede\256ning)S 10 B 2949(YY_BREAK)S 10 R 3535(allows,)S 3855(for)S 4005(example,)S 4403(C++)S 4616(users)S 4855(to)S 4965(#de\256ne)S 5352 V 1080(YY_BREAK)S 1645(to)S 1750(do)S 1877(nothing)S 2210(\(while)S 2495(being)S 2745(very)S 2951(careful)S 3259(that)S 3437(every)S 3688(rule)S 3871(ends)S 4081(with)S 4286(a)S 4357("break")S 4689(or)S 4799(a)S 4870("return"!\))S 5472 V 1080(to)S 1206(avoid)S 1477(suffering)S 1889(from)S (unreachable)487 2133 A 2668(statement)S 3102(warnings)S 3519(where)S (because)319 3814 A 4181(a)S 4275(rule's)S 4554(action)S 4849(ends)S 5082(with)S 5592 V 1080("return",)S 1453(the)S 10 B 1601(YY_BREAK)S 10 R 2180(is)S (inaccessible.)512 2272 A 5760 V 9 R 720(I)S 722(IN)S 755(NT)S 823(TE)S 881(ER)S 939(RF)S 1001(FA)S 1053(AC)S 1121(CI)S 1183(IN)S 1216(NG)S 1284(G)S 1390(W)S 1392(WI)S 1480(IT)S 1513(TH)S 1571(H)S 1677(Y)S 1679(YA)S 1747(AC)S 1815(CC)S 1877(C)S 5880 V 10 R 1080(One)S 1274(of)S 1384(the)S 1533(main)S 1761(uses)S 1961(of)S 10 I 2072(\257ex)S 10 R 2239(is)S 2333(as)S 2444(a)S 2516(companion)S 2989(to)S 3094(the)S 10 I 3244(yacc)S 10 R 3456(parser-generator.)S 10 I 4195(yacc)S 10 R 4407(parsers)S 4720(expect)S 5010(to)S 5115(call)S 6000 V 1080(a)S 1156(routine)S 1472(named)S 10 B 1771(yylex\(\))S 10 R 2093(to)S 2202(\256nd)S 2389(the)S 2543(next)S (input)206 2747 A 2984(token.)S 3287(The)S 3474(routine)S 3789(is)S (supposed)373 3886 A 4289(to)S 4397(return)S 4668(the)S 4821(type)S 5024(of)S 5138(the)S 6120 V 1080(next)S 1293(token)S 1556(as)S 1680(well)S 1894(as)S (putting)284 2018 A 2342(any)S 2527(associated)S 2981(value)S 3239(in)S 3358(the)S 3522(global)S 10 B 3814(yylval.)S 10 R 4136(To)S 4289(use)S 10 I 4464(\257ex)S 10 R 4645(with)S 10 I 4865(yacc,)S 10 R 5116(one)S 6240 V 1080(speci\256es)S 1458(the)S 10 B 1612(-d)S 10 R 1732(option)S 2018(to)S 10 I 2126(yacc)S 10 R 2341(to)S 2449(instruct)S 2781(it)S 2867(to)S 2975(generate)S 3347(the)S 3500(\256le)S 10 B 3659(y.tab.h)S 10 R 3985(containing)S (de\256nitions)424 4439 A 4893(of)S 5007(all)S 5138(the)S 6360 V 10 B 1080(%tokens)S 10 R 1485(appearing)S 1907(in)S 2010(the)S 10 I 2158(yacc)S 10 R (input.)231 2368 A 2649(This)S 2853(\256le)S 3007(is)S 3099(then)S 3297(included)S 3668(in)S 3771(the)S 10 I 3920(\257ex)S 10 R 4086(scanner.)S 4470(For)S 4636(example,)S 5028(if)S 5116(one)S 6480 V 1080(of)S 1189(the)S 1337(tokens)S 1624(is)S 1716("TOK_NUMBER",)S 2537(part)S 2719(of)S 2828(the)S 2976(scanner)S 3309(might)S (look)178 3568 A 3771(like:)S 6720 V 1180(%{)S 6840 V 1180(#include)S 1551("y.tab.h")S 6960 V 1180(%})S 7200 V 1180(%%)S 7440 V 1180([0-9]+)S 1639(yylval)S 1915(=)S 1997(atoi\()S 2207(yytext)S 2483(\);)S 2570(return)S 2836(TOK_NUMBER;)S 7903 V 720(September)S 1176(13,)S (1996)200 1326 A 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4940(Page)S 5161(14)S 8143 V EP %%Page: 15 15 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 9 R 720(T)S 722(TR)S 780(RA)S 842(AN)S 910(NS)S 978(SL)S 1030(LA)S 1088(AT)S 1156(TI)S 1214(IO)S 1247(ON)S 1315(N)S 1421(T)S 1423(TA)S 1481(AB)S 1549(BL)S 1611(LE)S 1669(E)S 1080 V 10 R 1080(In)S 1196(the)S 1351(name)S 1601(of)S 1717(POSIX)S 2041(compliance,)S 10 I 2562(\257ex)S 10 R (supports)340 2734 A 3106(a)S 10 I 3183(translation)S 3655(table)S 10 R 3888(for)S 4039(mapping)S (input)206 4423 A 4662(characters)S 5105(into)S 1200 V (groups.)298 1080 A 1428(The)S 1610(table)S 1831(is)S 1923(speci\256ed)S 2306(in)S 2409(the)S 2557(\256rst)S 2739(section,)S 3074(and)S 3244(its)S 3364(format)S (looks)217 3658 A 3900(like:)S 1440 V 1180(%t)S 1560 V 1180(1)S 1430(abcd)S 1680 V 1180(2)S 1430(ABCDEFGHIJKLMNOPQRSTUVWXYZ)S 1800 V 1180(52)S (0123456789)500 1455 A 1920 V 1180(6)S (\\t\\)84 1430 A 1539(\\n)S 2040 V 1180(%t)S 2280 V 1080(This)S 1299(example)S 1680(speci\256es)S 2067(that)S 2258(the)S 2422(characters)S 2873('a',)S 3052('b',)S 3236('c',)S 3415(and)S 3601('d')S 3760(are)S 3925(to)S 4044(all)S 4186(be)S 4322(lumped)S 4664(into)S (group)234 4861 A 5136(#1,)S 2400 V (upper-case)437 1080 A 1554(letters)S 1837(in)S (group)234 1951 A 2221(#2,)S 2382(digits)S 2641(in)S (group)234 2755 A (#52,)175 3025 A 3236(tabs,)S 3459(blanks,)S 3782(and)S 3963(newlines)S 4357(into)S (group)234 4549 A 4819(#6,)S 4980(and)S 10 I 5161(no)S 2520 V 1080(other)S 1323(characters)S (will)151 1784 A (appear)284 1966 A 2281(in)S 2390(the)S 2544(patterns.)S 10 R 2954(The)S (group)234 3142 A 3407(numbers)S 3784(are)S 3939(actually)S 4289(disregarded)S 4790(by)S 10 I 4921(\257ex;)S 10 B 5127(%t)S 2640 V 10 R 1080(serves,)S (though,)303 1384 A 1714(to)S 1819(lump)S 2052(characters)S 2489(together.)S 2895(Given)S 3167(the)S (above)240 3316 A 3582(table,)S 3829(for)S 3973(example,)S 4365(the)S 4514(pattern)S 4820("a\(AA\)*5")S 2760 V 1080(is)S 1184(equivalent)S 1640(to)S 1755("d\(ZQ\)*0".)S 2277(They)S 2521(both)S 2736(say,)S 2933("match)S 3258(any)S 3441(character)S 3850(in)S (group)234 3966 A 4238(#1,)S 4401(followed)S 4797(by)S 4935(zero-or-)S 2880 V 1080(more)S 1314(pairs)S 1537(of)S 1648(characters)S 2085(from)S (group)234 2308 A 2569(#2,)S 2721(followed)S 3106(by)S 3233(a)S 3305(character)S 3703(from)S (group)234 3926 A (#52.")216 4187 A 4455(Thus)S 10 B 4683(%t)S 10 R 4844(provides)S 5216(a)S 3000 V 1080(crude)S 1329(way)S 1522(for)S (introducing)463 1665 A 2153(equivalence)S 2659(classes)S 2964(into)S 3145(the)S 3293(scanner)S 3626(speci\256cation.)S 3168 V 1080(Note)S 1306(that)S 1487(the)S 10 B 1640(-i)S 10 R 1732(option)S 2018(\(see)S 2211(below\))S (coupled)318 2521 A 2869(with)S 3078(the)S 3232(equivalence)S 3744(classes)S 4055(which)S 10 I 4332(\257ex)S 10 R 4503(automatically)S 5082(gen-)S 3288 V 1080(erates)S 1345(take)S 1542(care)S 1740(of)S 1852(virtually)S 2221(all)S 2350(the)S 2501(instances)S 2898(when)S 3144(one)S 3317(might)S 3579(consider)S 3948(using)S 10 B 4193(%t.)S 10 R 4380(But)S 4553(what)S 4777(the)S 4928(hell,)S 5132(it's)S 3408 V 1080(there)S 1307(if)S (you)150 1394 A 1569(want)S 1790(it.)S 3576 V 9 R 720(O)S 722(OP)S 790(PT)S 842(TI)S 900(IO)S 933(ON)S 1001(NS)S 1069(S)S 3696 V 10 I 1080(\257ex)S 10 R 1245(has)S 1404(the)S 1552(following)S 1968(options:)S 3864 V 10 B 1080(-b)S 10 R 1440(Generate)S 1850(backtracking)S 2415(information)S 2935(to)S 10 I 3058(lex.backtrack.)S 10 R 3668(This)S 3892(is)S 4004(a)S 4094(list)S 4262(of)S 4391(scanner)S 4745(states)S 5015(which)S 3984 V 1440(require)S 1760(backtracking)S 2314(and)S 2493(the)S (input)206 2650 A 2890(characters)S 3334(on)S 3468(which)S 3747(they)S 3953(do)S 4086(so.)S 4258(By)S 4408(adding)S 4714(rules)S 4943(one)S 5121(can)S 4104 V 1440(remove)S 1773(backtracking)S 2324(states.)S 2629(If)S 2728(all)S 2860(backtracking)S 3411(states)S 3666(are)S 3821(eliminated)S 4277(and)S 10 B 4454(-f)S 10 R 4554(or)S 10 B 4670(-F)S 10 R 4798(is)S 4897(used,)S 5138(the)S 4224 V 1440(generated)S 1861(scanner)S (will)157 2198 A 2384(run)S 2547(faster)S 2801(\(see)S 2993(the)S 10 B 3145(-p)S 10 R 3264(\257ag\).)S 3528(Only)S 3758(users)S 3994(who)S 4196(wish)S 4415(to)S (squeeze)319 4522 A 4869(every)S 5121(last)S 4344 V 1440(cycle)S 1699(out)S 1873(of)S 2004(their)S 2236(scanners)S 2630(need)S 2867(worry)S (about)223 3155 A 3425(this)S 3617(option.)S 3970(\(See)S 4197(the)S 4367(section)S 4699(on)S 4846(PERFOR-)S 4464 V 1440(MANCE)S 1829(CONSIDERATIONS)S 2730(below.\))S 4632 V 10 B 1080(-c)S 10 R 1440(is)S 1532(a)S 1602(do-nothing,)S (deprecated)437 2092 A 2554(option)S 2835(included)S 3206(for)S 3349(POSIX)S 3666(compliance.)S 4800 V 10 B 1440(NOTE:)S 10 R 1787(in)S 1893(previous)S 2267(releases)S 2615(of)S 10 I 2727(flex)S 10 B 2901(-c)S 10 R 3008(specified)S 3400(table-compression)S 4166(options.)S 4539(This)S (functionality)514 4747 A 4920 V 1440(is)S 1535(now)S 1736(given)S 1987(by)S 2114(the)S 10 B 2264(-C)S 10 R 2398(flag.)S 2632(To)S 2771(ease)S 2972(the)S 3122(the)S 3272(impact)S 3573(of)S 3684(this)S 3856(change,)S 4193(when)S 10 I 4438(flex)S 10 R (encounters)436 4611 A 10 B 5074(-c,)S 10 R 5205(it)S 5040 V 1440(currently)S 1829(issues)S 2094(a)S 2164(warning)S 2520(message)S 2887(and)S 3058(assumes)S 3419(that)S 10 B 3596(-C)S 10 R 3729(was)S 3912(desired)S 4229(instead.)S 4590(In)S 4700(the)S 4849(future)S 5116(this)S 5160 V 1440("promotion")S 1984(of)S 10 B 2112(-c)S 10 R 2235(to)S 10 B 2357(-C)S 10 R (will)157 2508 A 2709(go)S 2853(away)S 3110(in)S 3231(the)S 3397(name)S 3658(of)S 3785(full)S 3968(POSIX)S 4303(compliance)S 4810(\(unless)S 5138(the)S 5280 V 1440(POSIX)S 1757(meaning)S 2128(is)S 2220(removed)S 2597(first\).)S 5448 V 10 B 1080(-d)S 10 R 1440(makes)S 1732(the)S 1890(generated)S 2317(scanner)S 2660(run)S 2829(in)S 10 I (debug)245 2942 A 10 R 3222(mode.)S 3530(Whenever)S 3979(a)S 4060(pattern)S 4376(is)S (recognized)442 4479 A 4957(and)S 5138(the)S 5568 V 1440(global)S 10 B (yy_\257ex_debug)614 1719 A 10 R 2361(is)S (non-zero)358 2456 A 2842(\(which)S 3150(is)S 3245(the)S 3396(default\),)S 3762(the)S 3912(scanner)S (will)157 4247 A 4431(write)S 4666(to)S 10 I 4771(stderr)S 10 R 5038(a)S 5110(line)S 5688 V 1440(of)S 1549(the)S 1697(form:)S 5928 V (--accepting)454 1540 A 2019(rule)S 2201(at)S 2299(line)S 2475(53)S 2600(\("the)S 2823(matched)S 3189(text"\))S 6168 V 1440(The)S 1628(line)S 1810(number)S 2148(refers)S 2410(to)S 2519(the)S 2673(location)S 3028(of)S 3143(the)S 3297(rule)S 3485(in)S 3594(the)S 3748(\256le)S 3908(de\256ning)S 4268(the)S 4423(scanner)S 4763(\(i.e.,)S 4977(the)S 5132(\256le)S 6288 V 1440(that)S 1626(was)S 1817(fed)S 1980(to)S 2092(\257ex\).)S 2361(Messages)S 2786(are)S 2944(also)S 3140(generated)S 3566(when)S 3818(the)S 3975(scanner)S 4317(backtracks,)S (accepts)297 4807 A 5138(the)S 6408 V 1440(default)S 1755(rule,)S (reaches)303 1972 A 2310(the)S 2468(end)S 2648(of)S 2767(its)S (input)206 2897 A 3138(buffer)S 3420(\(or)S (encounters)436 3573 A 4044(a)S 4124(NUL;)S 4395(at)S 4503(this)S 4684(point,)S 4951(the)S 5110(two)S 6528 V (look)178 1440 A 1643(the)S 1791(same)S 2023(as)S 2132(far)S 2270(as)S 2379(the)S 2527(scanner's)S 2933(concerned\),)S 3431(or)S (reaches)303 3540 A 3868(an)S 3988(end-of-\256le.)S 6696 V 10 B 1080(-f)S 10 R 1440(speci\256es)S 1817(\(take)S (your)184 2049 A 2263(pick\))S 10 I 2500(full)S 2664(table)S 10 R 2895(or)S 10 I 3009(fast)S (scanner.)343 3184 A 10 R 3557(No)S 3710(table)S 3936(compression)S 4475(is)S (done.)220 4573 A 4849(The)S 5037(result)S 6816 V 1440(is)S 1532(large)S 1759(but)S 1912(fast.)S 2133(This)S 2337(option)S 2618(is)S 2710(equivalent)S 3154(to)S 10 B 3257(-Cf)S 10 R 3423(\(see)S 3611(below\).)S 6984 V 10 B 1080(-i)S 10 R 1440(instructs)S 10 I 1810(\257ex)S 10 R 1979(to)S 2086(generate)S 2458(a)S 10 I (case-insensitive)638 2533 A 10 R 3201(scanner.)S 3589(The)S 3776(case)S 3980(of)S 4094(letters)S 4371(given)S 4624(in)S 4732(the)S 10 I 4885(\257ex)S 10 R (input)206 5055 A 7104 V 1440(patterns)S (will)157 1802 A 2002(be)S (ignored,)332 2140 A 2515(and)S 2703(tokens)S 3008(in)S 3129(the)S (input)206 3294 A (will)157 3542 A 3741(be)S 3878(matched)S 4261(regardless)S 4712(of)S 4838(case.)S 5104(The)S 7224 V 1440(matched)S 1806(text)S 1982(given)S 2230(in)S 10 I 2333(yytext)S 10 R (will)157 2594 A 2776(have)S 2991(the)S 3139(preserved)S 3556(case)S 3755(\(i.e.,)S 3962(it)S (will)157 4043 A 4225(not)S 4378(be)S 4498(folded\).)S 7392 V 10 B 1080(-n)S 10 R 1440(is)S 1532(another)S 1859(do-nothing,)S (deprecated)437 2349 A 2811(option)S 3092(included)S 3463(only)S 3666(for)S 3809(POSIX)S 4126(compliance.)S 7903 V 720(Page)S 941(15)S 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4455(September)S 4911(13,)S (1996)200 5061 A 8143 V EP %%Page: 16 16 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 10 B 1080(-p)S 10 R 1440(generates)S 1851(a)S 1926(performance)S 2466(report)S 2737(to)S 2845(stderr.)S 3156(The)S 3344(report)S 3616(consists)S 3965(of)S 4080(comments)S 4524(regarding)S 4941(features)S 1080 V 1440(of)S 1551(the)S 10 I 1701(\257ex)S 10 R (input)206 1868 A 2101(\256le)S 2257(which)S (will)157 2530 A 2714(cause)S 2965(a)S 3037(loss)S 3220(of)S 3331(performance)S 3868(in)S 3973(the)S (resulting)352 4123 A 4502(scanner.)S 4887(Note)S 5110(that)S 1200 V 1440(the)S 1599(use)S 1769(of)S 10 I 1889(REJECT)S 10 R 2279(and)S 2460(variable)S (trailing)291 2821 A 3148(context)S 3480(\(see)S 3679(the)S 3838(BUGS)S 4143(section)S 4464(in)S 4578(\257ex\(1\)\))S 4917(entails)S 5216(a)S 1320 V 1440(substantial)S 1904(performance)S 2448(penalty;)S 2806(use)S 2974(of)S 10 I 3092(yymore\(\),)S 10 R 3516(the)S 10 B 3673(\303)S 10 R 3741(operator,)S 4136(and)S 4315(the)S 10 B 4472(-I)S 10 R 4579(\257ag)S 4764(entail)S 5021(minor)S 1440 V 1440(performance)S (penalties.)383 1975 A 1608 V 10 B 1080(-s)S 10 R 1440(causes)S 1730(the)S 10 I 1880(default)S 2186(rule)S 10 R 2375(\(that)S 2587(unmatched)S 3055(scanner)S (input)206 3390 A 3624(is)S 3719(echoed)S 4032(to)S 10 I (stdout\))279 4138 A 10 R 4445(to)S 4551(be)S (suppressed.)466 4674 A 5193(If)S 1728 V 1440(the)S 1592(scanner)S (encounters)436 1929 A (input)206 2394 A 2629(that)S 2809(does)S 3022(not)S 3179(match)S 3454(any)S 3628(of)S 3741(its)S 3865(rules,)S 4115(it)S 4200(aborts)S 4475(with)S 4683(an)S 4807(error.)S 5082(This)S 1848 V 1440(option)S 1721(is)S 1813(useful)S 2084(for)S 2227(\256nding)S 2536(holes)S 2773(in)S 2876(a)S 2946(scanner's)S 3352(rule)S 3534(set.)S 2016 V 10 B 1080(-t)S 10 R 1440(instructs)S 10 I 1806(\257ex)S 10 R 1971(to)S 2074(write)S 2307(the)S 2455(scanner)S 2788(it)S 2869(generates)S 3275(to)S 3378(standard)S 3744(output)S 4025(instead)S 4335(of)S 10 B 4444(lex.yy.c.)S 2184 V 1080(-v)S 10 R 1440(speci\256es)S 1819(that)S 10 I 2002(\257ex)S 10 R (should)267 2174 A 2473(write)S 2713(to)S 10 I 2823(stderr)S 10 R 3095(a)S 3173(summary)S 3580(of)S 3697(statistics)S 4077(regarding)S 4496(the)S 4652(scanner)S 4993(it)S 5082(gen-)S 2304 V 1440(erates.)S 1754(Most)S 1988(of)S 2100(the)S 2251(statistics)S 2626(are)S 2778(meaningless)S 3303(to)S 3409(the)S 3559(casual)S 10 I 3838(\257ex)S 10 R 4005(user,)S 4225(but)S 4380(the)S 4530(\256rst)S 4714(line)S 4892(identi\256es)S 2424 V 1440(the)S 1588(version)S 1909(of)S 10 I 2018(\257ex,)S 10 R 2208(which)S 2479(is)S 2571(useful)S 2842(for)S 2985(\256guring)S 3328(out)S 3481(where)S (you)150 3753 A 3929(stand)S 4167(with)S 4372(respect)S 4684(to)S 4788(patches)S 5116(and)S 2544 V 1440(new)S 1642(releases,)S 2021(and)S 2200(the)S 2357(next)S 2564(two)S 2749(lines)S 2973(give)S 3180(the)S 3337(date)S 3539(when)S 3791(the)S 3948(scanner)S 4289(was)S 4479(created)S 4804(and)S 4982(a)S 5060(sum-)S 2664 V 1440(mary)S 1672(of)S 1781(the)S 1929(\257ags)S 2144(which)S 2415(were)S 2637(in)S 2740(effect.)S 2832 V 10 B 1080(-F)S 10 R 1440(speci\256es)S 1813(that)S 1990(the)S 10 I 2139(fast)S 10 R 2310(scanner)S 2644(table)S 2866(representation)S (should)267 3463 A 3757(be)S 3879(used.)S 4140(This)S 4346(representation)S 4944(is)S (about)223 5038 A 2952 V 1440(as)S 1556(fast)S 1734(as)S 1849(the)S 2003(full)S 2174(table)S 2401(representation)S 3003(\()S 10 B-1 3037(-)S 10 B 3094(f)S 10 R 3128(\),)S 3218(and)S 3394(for)S 3543(some)S 3786(sets)S 3968(of)S 4083(patterns)S (will)157 4433 A 4621(be)S 4747(considerably)S 3072 V 1440(smaller)S 1768(\(and)S 1978(for)S 2127(others,)S 2430(larger\).)S 2782(In)S 2898(general,)S 3252(if)S 3346(the)S 3501(pattern)S 3813(set)S 3957(contains)S 4324(both)S 4534("keywords")S 5039(and)S 5216(a)S 3192 V 1440(catch-all,)S 1838("identi\256er")S 2309(rule,)S 2516(such)S 2725(as)S 2834(in)S 2937(the)S 3085(set:)S 3432 V 1540("case")S 1896(return)S 2162(TOK_CASE;)S 3552 V 1540("switch")S 1935(return)S 2201(TOK_SWITCH;)S 3672 V (...)75 1540 A 3792 V 1540("default")S 1927(return)S 2193(TOK_DEFAULT;)S 3912 V 1540([a-z]+)S 1889(return)S 2155(TOK_ID;)S 4152 V 1440(then)S (you're)263 1640 A 1930(better)S 2187(off)S 2332(using)S 2576(the)S 2726(full)S 2893(table)S 3116(representation.)S 3764(If)S 3859(only)S 4065(the)S 4216("identi\256er")S 4690(rule)S 4875(is)S 4970(present)S 4272 V 1440(and)S (you)150 1610 A 1785(then)S 1983(use)S 2142(a)S 2212(hash)S 2421(table)S 2642(or)S 2751(some)S 2988(such)S 3197(to)S 3300(detect)S 3566(the)S 3714(keywords,)S (you're)263 4155 A 4443(better)S 4698(off)S 4841(using)S 10 B-1 5083(-)S 10 B 5140(F)S 10 R 5202(.)S 4440 V 1440(This)S 1644(option)S 1925(is)S 2017(equivalent)S 2461(to)S 10 B 2564(-CF)S 10 R 2758(\(see)S 2946(below\).)S 4608 V 10 B 1080(-I)S 10 R 1440(instructs)S 10 I 1811(\257ex)S 10 R 1981(to)S 2089(generate)S 2461(an)S 10 I 2586(interactive)S 10 R 3047(scanner.)S 3436(Normally,)S 3878(scanners)S 4256(generated)S 4679(by)S 10 I 4810(\257ex)S 10 R 4981(always)S 4728 V (look)178 1440 A 1652(ahead)S 1921(one)S 2100(character)S 2505(before)S 2797(deciding)S 3177(that)S 3362(a)S 3441(rule)S 3632(has)S 3800(been)S 4023(matched.)S 4447(At)S 4581(the)S 4737(cost)S 4932(of)S 5049(some)S 4848 V 1440(scanning)S 1831(overhead,)S 10 I 2259(\257ex)S 10 R (will)157 2433 A 2624(generate)S 3000(a)S 3079(scanner)S 3421(which)S 3702(only)S (looks)217 3915 A 4167(ahead)S 4437(when)S 4690(needed.)S 5060(Such)S 4968 V 1440(scanners)S 1814(are)S 1965(called)S 10 I 2233(interactive)S 10 R (because)319 2691 A 3036(if)S (you)150 3124 A 3300(want)S 3522(to)S 3626(write)S 3860(a)S 3931(scanner)S 4265(for)S 4409(an)S 4530(interactive)S 4982(system)S 5088 V 1440(such)S 1649(as)S 1758(a)S 1828(command)S 2249(shell,)S (you)150 2489 A (will)157 2665 A 2848(probably)S 3231(want)S 3453(the)S 3602(user's)S (input)206 3869 A 4101(to)S 4205(be)S 4326(terminated)S 4783(with)S 4988(a)S 5059(new-)S 5208 V 1440(line,)S 1644(and)S (without)307 1817 A 10 B 2152(-I)S 10 R 2253(the)S 2404(user)S (will)157 2600 A 2784(have)S 3001(to)S 3106(type)S 3306(a)S 3378(character)S 3776(in)S (addition)329 3881 A 4237(to)S 4342(the)S 4492(newline)S 4838(in)S 4943(order)S 5183(to)S 5328 V 1440(have)S 1655(the)S 1803(newline)S (recognized.)467 2147 A 2664(This)S 2868(leads)S 3100(to)S 3203(dreadful)S 3564(interactive)S 4015(performance.)S 5496 V 1440(If)S 1533(all)S 1659(this)S 1829(seems)S 2100(to)S 2203(confusing,)S 2649(here's)S 2921(the)S 3069(general)S 3391(rule:)S 3601(if)S 3688(a)S 3758(human)S (will)157 4056 A 4238(be)S 4358(typing)S 4639(in)S (input)206 4742 A 4973(to)S (your)184 5077 A 5616 V 1440(scanner,)S 1812(use)S 10 B 1985(-I,)S 10 R 2122(otherwise)S (don't;)240 2553 A 2832(if)S (you)150 2933 A (don't)212 3121 A 3371(care)S (about)223 3578 A (squeezing)402 3839 A 4279(the)S 4440(utmost)S 4751(performance)S 5736 V 1440(from)S (your)184 1681 A 1910(scanner)S 2263(and)S (you)150 2453 A (don't)212 2648 A 2905(want)S 3146(to)S 3269(make)S 3532(any)S 3722(assumptions)S (about)223 4263 A 4532(the)S (input)206 4701 A 4953(to)S (your)184 5077 A 5856 V 1440(scanner,)S 1798(use)S 10 B 1957(-I.)S 6024 V 10 R 1440(Note,)S 10 B 1686(-I)S 10 R (cannot)268 1784 A 2077(be)S 2197(used)S 2406(in)S 2509(conjunction)S 3008(with)S 10 I 3212(full)S 10 R 3371(or)S 10 I 3480(fast)S 3650(tables,)S 10 R 3940(i.e.,)S 4113(the)S 10 B 4261(-f,)S 4379(-F,)S 4525(-Cf,)S 10 R 4716(or)S 10 B 4825(-CF)S 10 R 5019(flags.)S 6192 V 10 B 1080(-L)S 10 R 1440(instructs)S 10 I 1813(\257ex)S 10 R 1985(not)S 2145(to)S 2255(generate)S 10 B 2629(#line)S 10 R 2868(directives.)S (Without)329 3342 A 3703(this)S 3880(option,)S 10 I 4194(\257ex)S 10 R 4367(peppers)S 4713(the)S 4869(generated)S 6312 V 1440(scanner)S 1785(with)S 2001(#line)S 2239(directives)S 2668(so)S 2793(error)S 3026(messages)S 3442(in)S 3556(the)S 3715(actions)S (will)157 4036 A 4229(be)S 4360(correctly)S 4755(located)S 5082(with)S 6432 V 1440(respect)S 1751(to)S 1854(the)S 2002(original)S 10 I 2340(\257ex)S 10 R (input)206 2505 A 2736(\256le,)S 2915(and)S 3085(not)S 3238(to)S 3342(the)S 3491(fairly)S 3736(meaningless)S 4259(line)S 4436(numbers)S 4808(of)S 10 B 4918(lex.yy.c.)S 6552 V 10 R 1440(\(Unfortunately)S 10 I 2074(\257ex)S 10 R 2248(does)S 2466(not)S 2628(presently)S 3031(generate)S 3407(the)S (necessary)392 3564 A 3990(directives)S 4416(to)S 4528("retarget")S 4953(the)S 5110(line)S 6672 V 1440(numbers)S 1814(for)S 1960(those)S 2200(parts)S 2424(of)S 10 B 2536(lex.yy.c)S 10 R 2882(which)S 3156(it)S 3240(generated.)S 3710(So)S 3844(if)S 3934(there)S 4164(is)S 4260(an)S 4384(error)S 4610(in)S 4717(the)S 4869(generated)S 6792 V 1440(code,)S 1680(a)S 1750(meaningless)S 2272(line)S 2448(number)S 2780(is)S 2872(reported.\))S 6960 V 10 B 1080(-T)S 10 R 1440(makes)S 10 I 1724(\257ex)S 10 R 1891(run)S 2052(in)S 10 I 2157(trace)S 10 R 2391(mode.)S 2691(It)S (will)157 2780 A 2964(generate)S 3333(a)S 3406(lot)S 3540(of)S 3652(messages)S 4060(to)S 10 I (stdout)245 4166 A 10 R 4439(concerning)S 4914(the)S 5065(form)S 7080 V 1440(of)S 1554(the)S (input)206 1707 A 1943(and)S 2117(the)S 2269(resultant)S (non-deterministic)710 2645 A 3384(and)S 3558(deterministic)S 4113(\256nite)S 4349(automata.)S 4797(This)S 5005(option)S 7200 V 1440(is)S 1532(mostly)S 1830(for)S 1973(use)S 2132(in)S 2235(maintaining)S 10 I 2740(\257ex.)S 7368 V 10 B 1080(-8)S 10 R 1440(instructs)S 10 I 1813(\257ex)S 10 R 1985(to)S 2095(generate)S 2469(an)S 2597(8-bit)S 2820(scanner,)S 3186(i.e.,)S 3367(one)S 3545(which)S 3824(can)S (recognize)392 3997 A 4422(8-bit)S 4645(characters.)S 5138(On)S 7488 V 1440(some)S 1695(sites,)S 10 I 1942(\257ex)S 10 R 2125(is)S 2235(installed)S 2619(with)S 2841(this)S 3029(option)S 3328(as)S 3455(the)S 3621(default.)S 3994(On)S 4160(others,)S 4474(the)S 4640(default)S 4962(is)S 5071(7-bit)S 7903 V 720(September)S 1176(13,)S (1996)200 1326 A 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4940(Page)S 5161(16)S 8143 V EP %%Page: 17 17 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1440(characters.)S 1934(To)S 2080(see)S 2243(which)S 2523(is)S 2625(the)S 2783(case,)S 3017(check)S 3287(the)S 3445(verbose)S 10 B 3793(\(-v\))S 10 R 3980(output)S 4271(for)S 4424("equivalence)S 4981(classes)S 1080 V 1440(created".)S 1852(If)S 1949(the)S 2101(denominator)S 2638(of)S 2750(the)S 2901(number)S 3236(shown)S 3526(is)S (128,)175 3621 A 3824(then)S 4025(by)S 4153(default)S 10 I 4461(\257ex)S 10 R 4629(is)S 4724(generating)S 5177(7-)S 1200 V 1440(bit)S 1580(characters.)S 2074(If)S 2176(it)S 2266(is)S (256,)175 2367 A 2576(then)S 2783(the)S 2940(default)S 3254(is)S 3355(8-bit)S 3579(characters)S 4023(and)S 4202(the)S 10 B 4359(-8)S 10 R 4477(\257ag)S 4662(is)S 4763(not)S 4925(required)S 1320 V 1440(\(but)S 1635(may)S 1841(be)S 1969(a)S (good)200 2047 A 2280(idea)S 2481(to)S 2592(keep)S 2815(the)S 2971(scanner)S 3311(speci\256cation)S 3852(portable\).)S 4298(Feeding)S 4654(a)S 4731(7-bit)S 4953(scanner)S 1440 V 1440(8-bit)S 1667(characters)S (will)157 2115 A 2310(result)S 2572(in)S 2688(in\256nite)S (loops,)242 3011 A 3291(bus)S 3468(errors,)S 3767(or)S 3889(other)S 4134(such)S 4356(\256reworks,)S 4800(so)S 4927(when)S 5183(in)S 1560 V (doubt,)253 1440 A 1722(use)S 1885(the)S 2037(\257ag.)S 2266(Note)S 2490(that)S 2669(if)S 2759(equivalence)S 3268(classes)S 3576(are)S 3728(used,)S 3965(8-bit)S 4183(scanners)S 4558(take)S 4754(only)S 4960(slightly)S 1680 V 1440(more)S 1683(table)S (space)224 1915 A 2175(than)S 2384(7-bit)S 2610(scanners)S (\(128)184 2993 A 3213(bytes,)S 3486(to)S 3600(be)S 3731(exact\);)S 4042(if)S 4140(equivalence)S 4657(classes)S 4973(are)S 5133(not)S 1800 V 1440(used,)S 1674(however,)S 2071(then)S 2269(the)S 2417(tables)S 2677(may)S 2875(grow)S 3107(up)S 3232(to)S 3335(twice)S 3579(their)S 3789(7-bit)S 4004(size.)S 1968 V 10 B 1080(-C[efmF])S 2088 V 10 R 1440(controls)S 1789(the)S 1937(degree)S 2231(of)S 2340(table)S 2561(compression.)S 2256 V 10 B 1440(-Ce)S 10 R 1625(directs)S 10 I 1927(flex)S 10 R 2107(to)S 2219(construct)S 10 I 2622(equivalence)S 3137(classes,)S 10 R 3481(i.e.,)S 3663(sets)S 3848(of)S 3966(characters)S 4410(which)S 4690(have)S 4914(identical)S 2376 V 1440(lexical)S 1738(properties)S 2170(\(for)S 2350(example,)S 2744(if)S 2834(the)S 2985(only)S 3191(appearance)S 3673(of)S 3785(digits)S 4036(in)S 4142(the)S 10 I 4293(flex)S 10 R (input)206 4467 A 4701(is)S 4796(in)S 4902(the)S 5053(char-)S 2496 V 1440(acter)S 1664(class)S 1887("[0-9]")S 2198(then)S 2398(the)S 2548(digits)S 2798('0',)S 2968('1',)S (...,)100 3138 A 3266('9')S (will)157 3412 A 3597(all)S 3726(be)S 3849(put)S 4005(in)S 4111(the)S 4262(same)S 4497(equivalence)S 5006(class\).)S 2616 V 1440(Equivalence)S 1972(classes)S 2285(usually)S 2608(give)S 2814(dramatic)S 3200(reductions)S 3652(in)S 3763(the)S 3919(final)S 4137(table/object)S 4640(file)S 4808(sizes)S 5037(\(typi-)S 2736 V 1440(cally)S 1666(a)S 1741(factor)S 2007(of)S 2121(2-5\))S 2319(and)S 2494(are)S 2648(pretty)S 2913(cheap)S 3178(performance-wise)S 3938(\(one)S 4148(array)S (look-up)312 4387 A 4730(per)S 4890(character)S 2856 V 1440(scanned\).)S 3024 V 10 B 1440(-Cf)S 10 R 1617(specifies)S 2006(that)S 2193(the)S 10 I 2352(full)S 10 R 2522(scanner)S 2866(tables)S (should)267 3137 A 3440(be)S 3571(generated)S 3999(-)S 10 I 4069(flex)S 10 R (should)267 4252 A 4556(not)S 4721(compress)S 5138(the)S 3144 V 1440(tables)S 1700(by)S 1825(taking)S 2101(advantages)S 2573(of)S 2682(similar)S (transition)380 2987 A 3392(functions)S 3791(for)S 3934(different)S 4307(states.)S 3312 V 10 B 1440(-CF)S 10 R 1636(specifies)S 2016(that)S 2194(the)S 2344(alternate)S 2719(fast)S 2892(scanner)S 3227(representation)S 3825(\(described)S (above)240 4272 A (under)229 4539 A 4795(the)S 10 B 4946(-F)S 10 R 5070(flag\))S 3432 V (should)267 1440 A 1732(be)S 1852(used.)S 3600 V 10 B 1440(-Cm)S 10 R 1662(directs)S 10 I 1962(flex)S 10 R 2139(to)S 2249(construct)S 10 I 2650(meta-equivalence)S 3393(classes,)S 10 R 3735(which)S 4013(are)S 4169(sets)S 4352(of)S 4468(equivalence)S 4981(classes)S 3720 V 1440(\(or)S 1598(characters,)S 2073(if)S 2174(equivalence)S 2694(classes)S 3013(are)S 3176(not)S 3343(being)S 3605(used\))S 3862(that)S 4052(are)S 4215(commonly)S 4683(used)S 4906(together.)S 3840 V 1440(Meta-equivalence)S 2194(classes)S 2506(are)S 2662(often)S 2901(a)S 2979(big)S 3140(win)S 3324(when)S 3575(using)S 3825(compressed)S 4333(tables,)S 4626(but)S 4787(they)S 4993(have)S 5216(a)S 3960 V 1440(moderate)S 1863(performance)S 2421(impact)S 2743(\(one)S 2970(or)S 3101(two)S 3299("if")S 3490(tests)S 3716(and)S 3908(one)S 4100(array)S (look-up)312 4355 A 4714(per)S 4890(character)S 4080 V 1440(scanned\).)S 4248 V 1440(A)S 1557(lone)S 10 B 1774(-C)S 10 R 1925(specifies)S 2322(that)S 2517(the)S 2684(scanner)S 3036(tables)S (should)267 3315 A 3626(be)S 3765(compressed)S 4284(but)S 4456(neither)S 4780(equivalence)S 4368 V 1440(classes)S 1745(nor)S 1904(meta-equivalence)S 2640(classes)S (should)267 2945 A 3237(be)S 3357(used.)S 4536 V 1440(The)S 1635(options)S 10 B 1968(-Cf)S 10 R 2147(or)S 10 B 2269(-CF)S 10 R 2476(and)S 10 B 2659(-Cm)S 10 R 2888(do)S 3027(not)S 3194(make)S 3451(sense)S 3708(together)S 4077(-)S 4150(there)S 4391(is)S 4497(no)S (opportunity)468 4636 A 5143(for)S 4656 V 1440(meta-equivalence)S 2183(classes)S 2495(if)S 2588(the)S 2742(table)S 2969(is)S 3067(not)S 3226(being)S 3480(compressed.)S 4036(Otherwise)S 4482(the)S 4636(options)S 4962(may)S 5166(be)S 4776 V 1440(freely)S 1701(mixed.)S 4944 V 1440(The)S 1626(default)S (setting)268 1935 A 2232(is)S 10 B 2328(-Cem,)S 10 R 2618(which)S 2893(specifies)S 3275(that)S 10 I 3455(flex)S 10 R (should)267 3630 A 3926(generate)S 4297(equivalence)S 4807(classes)S 5116(and)S 5064 V 1440(meta-equivalence)S 2178(classes.)S 2535(This)S (setting)268 2741 A 3036(provides)S 3409(the)S 3559(highest)S 3876(degree)S 4172(of)S 4282(table)S 4504(compression.)S 5088(You)S 5184 V 1440(can)S 1607(trade)S 1836(off)S 1981(faster-executing)S 2658(scanners)S 3032(at)S 3132(the)S 3282(cost)S 3471(of)S 3582(larger)S 3846(tables)S 4109(with)S 4316(the)S 4467(following)S 4886(generally)S 5304 V 1440(being)S 1688(true:)S 5544 V 1540(slowest)S 1867(&)S 1970(smallest)S 5664 V 1690(-Cem)S 5784 V 1690(-Cm)S 5904 V 1690(-Ce)S 6024 V 1690(-C)S 6144 V 1690(-C{f,F}e)S 6264 V 1690(-C{f,F})S 6384 V 1540(fastest)S 1823(&)S 1926(largest)S 6624 V 1440(Note)S 1661(that)S 1838(scanners)S 2211(with)S 2416(the)S 2565(smallest)S 2921(tables)S 3182(are)S 3332(usually)S 3648(generated)S 4066(and)S 4237(compiled)S 4637(the)S 4786(quickest,)S 5172(so)S 6744 V 1440(during)S 1727(development)S (you)150 2271 A (will)157 2446 A 2628(usually)S 2943(want)S 3164(to)S 3267(use)S 3426(the)S 3574(default,)S 3904(maximal)S 4281(compression.)S 6912 V 10 B 1440(-Cfe)S 10 R 1651(is)S 1743(often)S 1975(a)S (good)200 2045 A 2270(compromise)S 2792(between)S 3153(speed)S 3407(and)S 3577(size)S 3759(for)S (production)435 3902 A 4362(scanners.)S 7080 V 10 B 1440(-C)S 10 R 1578(options)S 1904(are)S 2059(not)S 2218(cumulative;)S 2724(whenever)S 3147(the)S 3301(flag)S 3489(is)S (encountered,)517 3587 A 4135(the)S 4289(previous)S 4666(-C)S (settings)307 4798 A 5137(are)S 7200 V 1440(forgotten.)S 7368 V 10 B 1080(-Sskeleton_file)S 7488 V 10 R 1440(overrides)S 1847(the)S 2002(default)S 2314(skeleton)S 2681(\256le)S 2842(from)S 3070(which)S 10 I 3348(\257ex)S 10 R 3520(constructs)S 3960(its)S 4088(scanners.)S 4518(You'll)S 4814(never)S 5071(need)S 7903 V 720(Page)S 941(17)S 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4455(September)S 4911(13,)S (1996)200 5061 A 8143 V EP %%Page: 18 18 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1440(this)S 1610(option)S 1891(unless)S (you)150 2167 A 2342(are)S 2491(doing)S 10 I 2744(\257ex)S 10 R 2909(maintenance)S 3443(or)S 3552(development.)S 1128 V 9 R 720(P)S 722(PE)S 774(ER)S 832(RF)S 894(FO)S 946(OR)S 1014(RM)S 1076(MA)S 1158(AN)S 1226(NC)S 1294(CE)S 1356(E)S 1452(C)S 1454(CO)S 1516(ON)S 1584(NS)S 1652(SI)S 1704(ID)S 1737(DE)S 1805(ER)S 1863(RA)S 1925(AT)S 1993(TI)S 2051(IO)S 2084(ON)S 2152(NS)S 2220(S)S 1248 V 10 R 1080(The)S 1269(main)S 1502(design)S 1796(goal)S 2001(of)S 10 I 2117(\257ex)S 10 R 2290(is)S 2390(that)S 2574(it)S 2663(generate)S 3038(high-performance)S 3793(scanners.)S 4223(It)S 4318(has)S 4485(been)S 4708(optimized)S 5143(for)S 1368 V 1080(dealing)S 1402(well)S 1602(with)S 1807(large)S 2035(sets)S 2212(of)S 2322(rules.)S 2594(Aside)S 2855(from)S 3077(the)S 3226(effects)S 3522(of)S 3632(table)S 3854(compression)S 4387(on)S 4512(scanner)S 4845(speed)S 5099(out-)S 1488 V 1080(lined)S (above,)265 1312 A 1608(there)S 1841(are)S 1996(a)S 2072(number)S 2410(of)S 2525(options/actions)S 3164(which)S 3441(degrade)S 3792(performance.)S 4384(These)S 4657(are,)S 4838(from)S 5066(most)S 1608 V 1080(expensive)S 1507(to)S 1610(least:)S 1848 V 1180(REJECT)S 2088 V 1180(pattern)S 1485(sets)S 1661(that)S 1837(require)S 2148(backtracking)S 2208 V 1180(arbitrary)S (trailing)291 1553 A 1869(context)S 2448 V ('\303')102 1180 A 1307(beginning-of-line)S 2036(operator)S 2568 V 1180(yymore\(\))S 2808 V 1080(with)S 1284(the)S 1432(\256rst)S 1614(three)S 1841(all)S 1967(being)S 2215(quite)S 2441(expensive)S 2868(and)S 3038(the)S 3186(last)S 3351(two)S 3527(being)S 3775(quite)S 4001(cheap.)S 2976 V 10 B 1080(REJECT)S 10 R (should)267 1507 A 1804(be)S 1929(avoided)S 2277(at)S 2380(all)S 2511(costs)S 2742(when)S 2990(performance)S 3530(is)S 3627(important.)S 4098(It)S 4190(is)S 4287(a)S 4363(particularly)S 4859(expensive)S 3096 V 1080(option.)S 3264 V (Getting)302 1080 A 1410(rid)S 1550(of)S 1662(backtracking)S 2210(is)S 2305(messy)S 2584(and)S 2758(often)S 2994(may)S 3196(be)S 3320(an)S 3444(enormous)S (amount)301 3869 A 4199(of)S 4312(work)S 4548(for)S 4695(a)S 4769(complicated)S 3384 V 1080(scanner.)S 1467(In)S 1580(principal,)S 1991(one)S 2164(begins)S 2454(by)S 2582(using)S 2827(the)S 10 B 2978(-b)S 10 R 3096(\257ag)S 3275(to)S 3381(generate)S 3751(a)S 10 I 3824(lex.backtrack)S 10 R 4392(\256le.)S 4599(For)S 4767(example,)S 5161(on)S 3504 V 1080(the)S (input)206 1228 A 3744 V 1180(%%)S 3864 V 1180(foo)S 1514(return)S 1780(TOK_KEYWORD;)S 3984 V (foobar)263 1180 A 1568(return)S 1834(TOK_KEYWORD;)S 4224 V 1080(the)S 1228(\256le)S (looks)217 1382 A 1624(like:)S 4464 V 1180(State)S 1407(#6)S 1532(is)S (non-accepting)570 1624 A 2219(-)S 4584 V 1205(associated)S 1644(rule)S 1826(line)S 2002(numbers:)S 4704 V 1355(2)S 1580(3)S 4824 V (out-transitions:)609 1205 A 1839([)S 1898(o)S 1973(])S 4944 V (jam-transitions:)632 1205 A 1862(EOF)S 2078([)S (\\001-n)262 2137 A (p-\\177)262 2449 A 2736(])S 5184 V 1180(State)S 1407(#8)S 1532(is)S (non-accepting)570 1624 A 2219(-)S 5304 V 1205(associated)S 1644(rule)S 1826(line)S 2002(numbers:)S 5424 V 1355(3)S 5544 V (out-transitions:)609 1205 A 1839([)S 1898(a)S 1968(])S 5664 V (jam-transitions:)632 1205 A 1862(EOF)S 2078([)S (\\001-`)246 2137 A (b-\\177)262 2433 A 2720(])S 5904 V 1180(State)S 1407(#9)S 1532(is)S (non-accepting)570 1624 A 2219(-)S 6024 V 1205(associated)S 1644(rule)S 1826(line)S 2002(numbers:)S 6144 V 1355(3)S 6264 V (out-transitions:)609 1205 A 1839([)S 1898(r)S 1957(])S 6384 V (jam-transitions:)632 1205 A 1862(EOF)S 2078([)S (\\001-q)262 2137 A (s-\\177)251 2449 A 2725(])S 6624 V 1180(Compressed)S 1702(tables)S 1962(always)S 2267(backtrack.)S 6864 V 1080(The)S 1264(\256rst)S 1448(few)S 1627(lines)S 1844(tell)S 2000(us)S 2117(that)S 2296(there's)S 2599(a)S 2672(scanner)S 3008(state)S 3221(in)S 3327(which)S 3601(it)S 3685(can)S 3853(make)S 4099(a)S (transition)380 4172 A 4580(on)S 4708(an)S 4831('o')S 4977(but)S 5133(not)S 6984 V 1080(on)S 1213(any)S 1391(other)S 1631(character,)S 2060(and)S 2238(that)S 2422(in)S 2533(that)S 2717(state)S 2935(the)S 3091(currently)S 3488(scanned)S 3845(text)S 4029(does)S 4246(not)S 4407(match)S 4686(any)S 4864(rule.)S 5104(The)S 7104 V 1080(state)S 1295(occurs)S 1588(when)S 1836(trying)S 2106(to)S 2214(match)S 2490(the)S 2643(rules)S (found)234 2869 A 3133(at)S 3236(lines)S 3456(2)S 3536(and)S 3711(3)S 3791(in)S 3899(the)S (input)206 4052 A 4288(\256le.)S 4497(If)S 4595(the)S 4748(scanner)S 5086(is)S 5183(in)S 7224 V 1080(that)S 1264(state)S 1482(and)S 1660(then)S 1866(reads)S 2112(something)S 2563(other)S 2803(than)S 3009(an)S 3137('o',)S 3313(it)S (will)157 3402 A 3592(have)S 3815(to)S 3926(backtrack)S 4351(to)S 4462(\256nd)S 4650(a)S 4727(rule)S 4916(which)S 5194(is)S 7344 V 1080(matched.)S 1503(With)S 1736(a)S 1813(bit)S 1951(of)S 2067(headscratching)S 2703(one)S 2880(can)S 3052(see)S 3213(that)S 3396(this)S 3573(must)S 3800(be)S 3928(the)S 4084(state)S 4302(it's)S 4464(in)S 4575(when)S 4826(it)S 4915(has)S 5082(seen)S 7464 V 1080("fo".)S 1325(When)S 1594(this)S 1767(has)S 1929(happened,)S 2367(if)S 2457(anything)S 2836(other)S 3071(than)S 3272(another)S 3602('o')S 3748(is)S 3843(seen,)S 4075(the)S 4226(scanner)S (will)157 4562 A 4747(have)S 4965(to)S 5071(back)S 7903 V 720(September)S 1176(13,)S (1996)200 1326 A 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4940(Page)S 5161(18)S 8143 V EP %%Page: 19 19 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1080(up)S 1205(to)S 1308(simply)S 1606(match)S 1877(the)S ('f')102 2025 A 2152(\(by)S 2311(the)S 2459(default)S 2764(rule\).)S 1128 V 1080(The)S 1270(comment)S 1677(regarding)S 2096(State)S 2331(#8)S 2464(indicates)S 2855(there's)S 3163(a)S 3241(problem)S 3610(when)S ("foob")266 3862 A 4162(has)S 4330(been)S 4554(scanned.)S 4962(Indeed,)S 1248 V 1080(on)S 1208(any)S 1381(character)S 1780(other)S 2015(than)S 2216(a)S 2289('b',)S 2459(the)S 2609(scanner)S (will)157 2944 A 3128(have)S 3345(to)S 3450(back)S 3667(up)S 3794(to)S (accept)258 3899 A 4184("foo".)S 4477(Similarly,)S 4904(the)S 5054(com-)S 1368 V 1080(ment)S 1306(for)S 1449(State)S 1676(#9)S 1801(concerns)S 2184(when)S ("fooba")311 2427 A 2763(has)S 2922(been)S 3137(scanned.)S 1536 V 1080(The)S 1269(\256nal)S 1480(comment)S 1886(reminds)S 2242(us)S 2363(that)S 2546(there's)S 2854(no)S 2987(point)S 3226(going)S 3487(to)S 3598(all)S 3732(the)S (trouble)285 3888 A 4206(of)S 4323(removing)S 4741(backtracking)S 1656 V 1080(from)S 1303(the)S 1453(rules)S 1676(unless)S 1954(we're)S 2212(using)S 10 B 2456(-f)S 10 R 2551(or)S 10 B 2662(-F,)S 10 R 2810(since)S 3044(there's)S 3346(no)S 3473(performance)S 4010(gain)S 4210(doing)S 4465(so)S 4581(with)S 4786(compressed)S 1776 V 1080(scanners.)S 1944 V 1080(The)S 1262(way)S 1455(to)S 1558(remove)S 1885(the)S 2033(backtracking)S 2578(is)S 2670(to)S 2773(add)S 2943("error")S 3247(rules:)S 2184 V 1180(%%)S 2304 V 1180(foo)S 1539(return)S 1805(TOK_KEYWORD;)S 2424 V (foobar)263 1180 A 1593(return)S 1859(TOK_KEYWORD;)S 2664 V (fooba)229 1180 A 1584(|)S 2784 V (foob)184 1180 A 1564(|)S 2904 V 1180(fo)S 1514({)S 3024 V 1480(/*)S 1583(false)S 1799(alarm,)S 2079(not)S 2232(really)S 2487(a)S 2557(keyword)S 2934(*/)S 3144 V 1480(return)S 1746(TOK_ID;)S 3264 V 1480(})S 3552 V 1080(Eliminating)S 1580(backtracking)S (among)273 2125 A 2423(a)S 2493(list)S 2641(of)S 2750(keywords)S 3166(can)S 3331(also)S 3518(be)S (done)195 3638 A 3858(using)S 4100(a)S 4170("catch-all")S 4625(rule:)S 3792 V 1180(%%)S 3912 V 1180(foo)S 1539(return)S 1805(TOK_KEYWORD;)S 4032 V (foobar)263 1180 A 1593(return)S 1859(TOK_KEYWORD;)S 4272 V 1180([a-z]+)S 1579(return)S 1845(TOK_ID;)S 4512 V 1080(This)S 1284(is)S 1376(usually)S 1691(the)S 1839(best)S 2026(solution)S 2374(when)S 2617(appropriate.)S 4680 V 1080(Backtracking)S 1643(messages)S 2049(tend)S 2248(to)S 2352(cascade.)S 2742(With)S 2969(a)S 3041(complicated)S 3560(set)S 3699(of)S 3810(rules)S 4033(it's)S 4189(not)S 4344(uncommon)S 4822(to)S 4927(get)S (hun-)184 5077 A 4800 V 1080(dreds)S 1331(of)S 1448(messages.)S 1911(If)S 2012(one)S 2190(can)S 2363(decipher)S 2743(them,)S (though,)303 3002 A 3338(it)S 3427(often)S 3667(only)S 3878(takes)S 4118(a)S 4196(dozen)S 4469(or)S 4586(so)S 4708(rules)S 4937(to)S 5048(elim-)S 4920 V 1080(inate)S 1305(the)S 1457(backtracking)S (\(though)312 2006 A 2347(it's)S 2506(easy)S 2715(to)S 2823(make)S 3071(a)S 3146(mistake)S 3489(and)S 3664(have)S 3884(an)S 4009(error)S 4236(rule)S (accidentally)487 4423 A 4940(match)S 5216(a)S 5040 V 1080(valid)S 1306(token.)S 1604(A)S 1702(possible)S 2056(future)S 10 I 2322(\257ex)S 10 R 2487(feature)S (will)157 2793 A 2975(be)S 3095(to)S 3198(automatically)S 3771(add)S 3941(rules)S 4162(to)S 4265(eliminate)S 4665(backtracking\).)S 5208 V 10 I 1080(Variable)S 10 R (trailing)291 1464 A 1787(context)S 2115(\(where)S 2428(both)S 2638(the)S 2793(leading)S 3121(and)S (trailing)291 3298 A 3622(parts)S 3851(do)S 3984(not)S 4145(have)S 4368(a)S 4446(\256xed)S 4680(length\))S 4998(entails)S 5328 V 1080(almost)S 1373(the)S 1521(same)S 1753(performance)S 2288(loss)S 2469(as)S 10 I 2578(REJECT)S 10 R 2957(\(i.e.,)S 3164(substantial\).)S 3703(So)S 3834(when)S 4077(possible)S 4431(a)S 4501(rule)S 4683(like:)S 5568 V 1180(%%)S 5688 V (mouse|rat/\(cat|dog\))773 1180 A 2028(run\(\);)S 5928 V 1080(is)S 1172(better)S (written:)314 1427 A 6168 V 1180(%%)S 6288 V (mouse/cat|dog)578 1180 A 1983(run\(\);)S 6408 V (rat/cat|dog)423 1180 A 1878(run\(\);)S 6648 V 1080(or)S 1189(as)S 6888 V 1180(%%)S 7008 V 1180(mouse|rat/cat)S 1940(run\(\);)S 7128 V (mouse|rat/dog)567 1180 A 1972(run\(\);)S 7368 V 1080(Note)S 1303(that)S 1481(here)S 1682(the)S 1832(special)S 2139('|')S 2254(action)S 2527(does)S 10 I 2738(not)S 10 R 2893(provide)S 3227(any)S 3399(savings,)S 3752(and)S 3924(can)S 4092(even)S 4310(make)S 4556(things)S 4829(worse)S 5098(\(see)S 7488 V 10 B 1080(BUGS)S 10 R 1379(in)S 1482(\257ex\(1\)\).)S 7903 V 720(Page)S 941(19)S 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4455(September)S 4911(13,)S (1996)200 5061 A 8143 V EP %%Page: 20 20 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1080(Another)S 1437(area)S 1633(where)S 1907(the)S 2057(user)S 2252(can)S 2419(increase)S 2777(a)S 2849(scanner's)S 3257(performance)S 3795(\(and)S 4002(one)S 4175(that's)S 4427(easier)S 4691(to)S 4797(implement\))S 1080 V 1080(arises)S 1339(from)S 1564(the)S 1716(fact)S 1897(that)S 2077(the)S (longer)257 2229 A 2515(the)S 2667(tokens)S 2958(matched,)S 3352(the)S 3503(faster)S 3756(the)S 3907(scanner)S (will)157 4243 A 4428(run.)S 4640(This)S 4847(is)S (because)319 4942 A 1200 V 1080(with)S (long)178 1287 A 1493(tokens)S 1783(the)S 1934(processing)S 2392(of)S 2504(most)S (input)206 2727 A 2962(characters)S 3401(takes)S (place)213 3637 A 3879(in)S 3986(the)S 4138(\(short\))S 4436(inner)S 4672(scanning)S (loop,)203 5058 A 1320 V 1080(and)S 1253(does)S 1465(not)S 1620(often)S 1854(have)S 2071(to)S 2176(go)S (through)312 2303 A 2642(the)S (additional)402 2792 A 3221(work)S 3455(of)S (setting)268 3566 A 3861(up)S 3988(the)S 4138(scanning)S 4522(environment)S 5057(\(e.g.,)S 1440 V 10 B 1080(yytext\))S 10 R 1402(for)S 1545(the)S 1693(action.)S (Recall)258 2014 A 2297(the)S 2445(scanner)S 2778(for)S 2921(C)S 3013(comments:)S 1680 V 1180(%x)S 1339(comment)S 1800 V 1180(%%)S 1920 V 1380(int)S (line_num)379 1511 A 1915(=)S 1997(1;)S 2160 V 1180("/*")S 1565(BEGIN\(comment\);)S 2400 V 1180([\303*\\n]*)S 2520 V 1180("*"+[\303*/\\n]*)S 2640 V 1180(\\n)S (++line_num;)521 2071 A 2760 V 1180("*"+"/")S 2167(BEGIN\(INITIAL\);)S 3000 V 1080(This)S 1284(could)S 1532(be)S 1652(sped)S 1861(up)S 1986(by)S (writing)291 2111 A 2427(it)S 2508(as:)S 3240 V 1180(%x)S 1339(comment)S 3360 V 1180(%%)S 3480 V 1380(int)S (line_num)379 1511 A 1915(=)S 1997(1;)S 3720 V 1180("/*")S 1565(BEGIN\(comment\);)S 3960 V 1180([\303*\\n]*)S 4080 V 1180([\303*\\n]*\\n)S (++line_num;)521 2176 A 4200 V 1180("*"+[\303*/\\n]*)S 4320 V 1180("*"+[\303*/\\n]*\\n)S (++line_num;)521 2268 A 4440 V 1180("*"+"/")S 2167(BEGIN\(INITIAL\);)S 4680 V 1080(Now)S 1312(instead)S 1633(of)S (each)185 1753 A 1974(newline)S 2329(requiring)S 2734(the)S 2893(processing)S 3359(of)S 3480(another)S 3819(action,)S (recognizing)475 4127 A 4639(the)S 4799(newlines)S 5194(is)S 4800 V 1080("distributed")S 1624(over)S 1835(the)S 1990(other)S 2229(rules)S 2457(to)S 2567(keep)S 2789(the)S 2944(matched)S 3316(text)S 3498(as)S (long)178 3613 A 3822(as)S 3937(possible.)S 4347(Note)S 4574(that)S 10 I (adding)278 4756 A 10 R 5065(rules)S 4920 V 1080(does)S 10 I 1298(not)S 10 R 1461(slow)S 1686(down)S 1944(the)S 2102(scanner!)S 2504(The)S 2696(speed)S 2960(of)S 3079(the)S 3237(scanner)S 3580(is)S 3682(independent)S 4208(of)S 4327(the)S 4485(number)S 4827(of)S 4946(rules)S 5177(or)S 5040 V (\(modulo)340 1080 A 1453(the)S 1609(considerations)S 2222(given)S 2477(at)S 2582(the)S 2737(beginning)S 3170(of)S 3286(this)S 3463(section\))S 3814(how)S 4019(complicated)S 4543(the)S 4698(rules)S 4926(are)S 5082(with)S 5160 V 1080(regard)S 1363(to)S 1466(operators)S 1866(such)S 2075(as)S 2184('*')S 2327(and)S 2497('|'.)S 5328 V 1080(A)S 1178(\256nal)S 1382(example)S 1748(in)S 1851(speeding)S 2233(up)S 2358(a)S 2428(scanner:)S (suppose)323 2789 A (you)150 3137 A 3313(want)S 3535(to)S 3639(scan)S (through)312 3844 A 4182(a)S 4253(\256le)S 4408(containing)S 4858(identi\256ers)S 5448 V 1080(and)S 1252(keywords,)S 1695(one)S 1866(per)S 2021(line)S 2198(and)S 2369(with)S 2574(no)S 2700(other)S 2933(extraneous)S 3395(characters,)S 3856(and)S (recognize)392 4027 A 4445(all)S 4572(the)S 4721(keywords.)S 5188(A)S 5568 V 1080(natural)S 1385(\256rst)S 1567(approach)S 1961(is:)S 5808 V 1180(%%)S 5928 V 1180(asm)S 1492(|)S 6048 V 1180(auto)S 1478(|)S 6168 V 1180(break)S 1504(|)S 6288 V (...)75 1180 A 1280(etc)S (...)75 1423 A 6408 V (volatile)302 1180 A 1507(|)S 6528 V 1180(while)S 1504(/*)S 1607(it's)S 1761(a)S 1831(keyword)S 2208(*/)S 6768 V 1180(.|\\n)S 1428(/*)S 1531(it's)S 1685(not)S 1838(a)S 1908(keyword)S 2285(*/)S 7008 V 1080(To)S 1217(eliminate)S 1617(the)S 1765(back-tracking,)S (introduce)380 2369 A 2774(a)S 2844(catch-all)S 3217(rule:)S 7248 V 1180(%%)S 7368 V 1180(asm)S 1492(|)S 7488 V 1180(auto)S 1478(|)S 7903 V 720(September)S 1176(13,)S (1996)200 1326 A 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4940(Page)S 5161(20)S 8143 V EP %%Page: 21 21 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1180(break)S 1504(|)S 1080 V (...)75 1180 A 1280(etc)S (...)75 1423 A 1200 V (volatile)302 1180 A 1507(|)S 1320 V 1180(while)S 1504(/*)S 1607(it's)S 1761(a)S 1831(keyword)S 2208(*/)S 1560 V 1180([a-z]+)S 1504(|)S 1680 V 1180(.|\\n)S 1428(/*)S 1531(it's)S 1685(not)S 1838(a)S 1908(keyword)S 2285(*/)S 1920 V 1080(Now,)S 1332(if)S 1425(it's)S 1585(guaranteed)S 2058(that)S 2240(there's)S 2546(exactly)S 2868(one)S 3044(word)S 3282(per)S 3442(line,)S 3649(then)S 3853(we)S 4002(can)S 4173(reduce)S 4473(the)S 4627(total)S 4838(number)S 5177(of)S 2040 V 1080(matches)S 1435(by)S 1560(a)S 1630(half)S 1812(by)S 1937(merging)S 2297(in)S 2400(the)S (recognition)458 2548 A 3031(of)S 3140(newlines)S 3523(with)S 3727(that)S 3903(of)S 4012(the)S 4160(other)S 4392(tokens:)S 2280 V 1180(%%)S 2400 V 1180(asm\\n)S 1520(|)S 2520 V 1180(auto\\n)S 1506(|)S 2640 V 1180(break\\n)S 1532(|)S 2760 V (...)75 1180 A 1280(etc)S (...)75 1423 A 2880 V (volatile\\n)380 1180 A 1585(|)S 3000 V 1180(while\\n)S 1532(/*)S 1635(it's)S 1789(a)S 1859(keyword)S 2236(*/)S 3240 V 1180([a-z]+\\n)S 1532(|)S 3360 V 1180(.|\\n)S 1428(/*)S 1531(it's)S 1685(not)S 1838(a)S 1908(keyword)S 2285(*/)S 3600 V 1080(One)S 1279(has)S 1444(to)S 1553(be)S 1679(careful)S 1991(here,)S 2221(as)S 2336(we)S 2485(have)S 2706(now)S (reintroduced)509 2910 A 3450(backtracking)S 4001(into)S 4188(the)S 4343(scanner.)S 4733(In)S 4849(particular,)S 3720 V 1080(while)S 10 I 1330(we)S 10 R (know)223 1468 A 1717(that)S 1894(there)S (will)157 2122 A 2305(never)S 2555(be)S 2676(any)S 2847(characters)S 3283(in)S 3387(the)S (input)206 3536 A 3768(stream)S 4063(other)S 4296(than)S 4495(letters)S 4768(or)S 4878(newlines,)S 3840 V 10 I 1080(\257ex)S 10 R 1246(can't)S 1475(\256gure)S 1737(this)S 1909(out,)S 2089(and)S 2261(it)S (will)157 2344 A 2528(plan)S 2728(for)S 2873(possibly)S 3234(needing)S 3579(backtracking)S 4126(when)S 4371(it)S 4454(has)S 4615(scanned)S 4966(a)S 5038(token)S 3960 V 1080(like)S 1272("auto")S 1568(and)S 1754(then)S 1968(the)S 2132(next)S 2346(character)S 2758(is)S 2866(something)S 3324(other)S 3571(than)S 3784(a)S 3869(newline)S 4228(or)S 4352(a)S 4437(letter.)S 4735(Previously)S 5205(it)S 4080 V 1080(would)S 1361(then)S 1564(just)S 1739(match)S 2015(the)S 2168("auto")S 2453(rule)S 2640(and)S 2815(be)S (done,)220 2940 A 3190(but)S 3348(now)S 3551(it)S 3637(has)S 3801(no)S 3931("auto")S 4217(rule,)S 4430(only)S 4639(a)S 4715("auto\\n")S 5079(rule.)S 4200 V 1080(To)S 1224(eliminate)S 1631(the)S (possibility)418 1786 A 2236(of)S 2352(backtracking,)S 2929(we)S 3078(could)S 3332(either)S (duplicate)369 3593 A 3993(all)S 4125(rules)S 4352(but)S (without)307 4511 A 4849(\256nal)S 5059(new-)S 4320 V 1080(lines,)S 1326(or,)S 1467(since)S 1706(we)S 1856(never)S 2112(expect)S 2407(to)S (encounter)397 2517 A 2946(such)S 3162(an)S (input)206 3289 A 3527(and)S 3704(therefore)S (don't)212 4101 A 4345(how)S 4550(it's)S 4711(classi\256ed,)S 5143(we)S 4440 V 1080(can)S (introduce)380 1245 A 1650(one)S 1820(more)S 2052(catch-all)S 2425(rule,)S 2632(this)S 2802(one)S 2972(which)S 3243(doesn't)S 3564(include)S 3885(a)S 3955(newline:)S 4680 V 1180(%%)S 4800 V 1180(asm\\n)S 1520(|)S 4920 V 1180(auto\\n)S 1506(|)S 5040 V 1180(break\\n)S 1532(|)S 5160 V (...)75 1180 A 1280(etc)S (...)75 1423 A 5280 V (volatile\\n)380 1180 A 1585(|)S 5400 V 1180(while\\n)S 1532(/*)S 1635(it's)S 1789(a)S 1859(keyword)S 2236(*/)S 5640 V 1180([a-z]+\\n)S 1532(|)S 5760 V 1180([a-z]+)S 1504(|)S 5880 V 1180(.|\\n)S 1428(/*)S 1531(it's)S 1685(not)S 1838(a)S 1908(keyword)S 2285(*/)S 6120 V 1080(Compiled)S 1501(with)S 10 B 1705(-Cf,)S 10 R 1896(this)S 2066(is)S (about)223 2158 A 2406(as)S 2515(fast)S 2686(as)S 2795(one)S 2965(can)S 3130(get)S 3278(a)S 10 I 3348(\257ex)S 10 R 3513(scanner)S 3846(to)S 3949(go)S 4074(for)S 4217(this)S 4387(particular)S 4799(problem.)S 6288 V 1080(A)S 1186(\256nal)S 1398(note:)S 10 I 1632(\257ex)S 10 R 1805(is)S 1906(slow)S 2130(when)S 2382(matching)S 2790(NUL's,)S 3130(particularly)S 3629(when)S 3881(a)S 3960(token)S 4217(contains)S (multiple)335 4586 A 4955(NUL's.)S 6408 V 1080(It's)S 1255(best)S 1457(to)S 1575(write)S 1823(rules)S 2059(which)S 2344(match)S 10 I 2629(short)S 10 R (amounts)340 2874 A 3253(of)S 3376(text)S 3566(if)S 3667(it's)S 3835(anticipated)S 4316(that)S 4506(the)S 4668(text)S (will)157 4858 A 5054(often)S 6528 V 1080(include)S 1401(NUL's.)S 6696 V 9 R 720(I)S 722(IN)S 755(NC)S 823(CO)S 885(OM)S 953(MP)S 1035(PA)S 1087(AT)S 1155(TI)S 1213(IB)S 1246(BI)S 1308(IL)S 1341(LI)S 1399(IT)S 1432(TI)S 1490(IE)S 1523(ES)S 1581(S)S 1671(W)S 1673(WI)S 1761(IT)S 1794(TH)S 1852(H)S 1958(L)S 1960(LE)S 2018(EX)S 2076(X)S 2182(A)S 2184(AN)S 2252(ND)S 2320(D)S 2426(P)S 2428(PO)S 2480(OS)S 2548(SI)S 2600(IX)S 2633(X)S 6816 V 10 I 1080(\257ex)S 10 R 1256(is)S 1360(a)S 1442(rewrite)S 1766(of)S 1887(the)S 2047(Unix)S 10 I 2285(lex)S 10 R 2440(tool)S 2633(\(the)S 2827(two)S 3015(implementations)S 3722(do)S 3859(not)S 4024(share)S 4274(any)S 4456(code,)S (though\),)337 4708 A 5082(with)S 6936 V 1080(some)S 1341(extensions)S 1814(and)S (incompatibilities,)701 2008 A 2758(both)S 2985(of)S 3117(which)S 3411(are)S 3583(of)S 3715(concern)S 4082(to)S 4208(those)S 4468(who)S 4689(wish)S 4927(to)S 5053(write)S 7056 V 1080(scanners)S (acceptable)426 1452 A 1903(to)S 2006(either)S 2261(implementation.)S 2967(At)S 3093(present,)S 3434(the)S 3582(POSIX)S 10 I 3899(lex)S 10 R 4042(draft)S 4258(is)S 4350(very)S 4554(close)S 4786(to)S 4889(the)S 5037(origi-)S 7176 V 1080(nal)S 10 I 1239(lex)S 10 R 1393(implementation,)S 2085(so)S 2210(some)S 2458(of)S 2578(these)S (incompatibilities)676 2821 A 3533(are)S 3693(also)S 3891(in)S 4005(con\257ict)S 4343(with)S 4558(the)S 4717(POSIX)S 5045(draft.)S 7296 V 1080(But)S 1251(the)S 1400(intent)S 1655(is)S 1748(that)S 1925(except)S 2214(as)S 2324(noted)S 2573(below,)S 10 I 2870(\257ex)S 10 R 3036(as)S 3147(it)S 3230(presently)S 3626(stands)S (will)157 3904 A (ultimately)408 4088 A 4523(be)S 4645(POSIX)S 4964(confor-)S 7416 V 1080(mant)S 1318(\(i.e.,)S 1537(that)S 1725(those)S 1974(areas)S 2219(of)S 2339(con\257ict)S 2677(with)S 2892(the)S 3051(POSIX)S 3379(draft)S (will)157 3606 A 3799(be)S 3930(resolved)S 4307(in)S 10 I 4421(\257ex's)S 10 R 4670(favor\).)S 5003(Please)S 7536 V 1080(bear)S 1298(in)S 1420(mind)S 1670(that)S 1865(all)S 2010(the)S 2177(comments)S 2634(which)S 2924(follow)S 3231(are)S 3399(with)S 3622(regard)S 3924(to)S 4046(the)S 4214(POSIX)S 10 I 4551(draft)S 10 R 4791(standard)S 5177(of)S 7903 V 720(Page)S 941(21)S 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4455(September)S 4911(13,)S (1996)200 5061 A 8143 V EP %%Page: 22 22 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1080(Summer)S (1989,)225 1449 A 1702(and)S 1875(not)S 2031(the)S 2182(\256nal)S 2389(document)S 2813(\(or)S 2959(subsequent)S 3433(drafts\);)S 3753(they)S 3954(are)S 4106(included)S 4480(so)S 10 I 4597(\257ex)S 10 R 4765(users)S 4999(can)S 5166(be)S 1080 V 1080(aware)S 1352(of)S 1466(the)S 1619(standardization)S 2264(issues)S 2534(and)S 2709(those)S 2951(areas)S 3189(where)S 10 I 3466(\257ex)S 10 R 3636(may)S 3839(in)S 3947(the)S 4100(near)S 4305(future)S (undergo)329 4577 A 4937(changes)S 1200 V 1080(incompatible)S 1630(with)S 1834(its)S 1954(current)S (de\256nition.)410 2265 A 1368 V 10 I 1080(\257ex)S 10 R 1245(is)S 1337(fully)S 1552(compatible)S 2024(with)S 10 I 2228(lex)S 10 R 2371(with)S 2575(the)S 2723(following)S 3139(exceptions:)S 1536 V 1080(-)S 1440(The)S (undocumented)591 1634 A 10 I 2262(lex)S 10 R 2417(scanner)S 2762(internal)S 3107(variable)S 10 B 3469(yylineno)S 10 R 3869(is)S 3973(not)S (supported.)421 4138 A 4621(It)S 4721(is)S 4826(dif\256cult)S 5183(to)S 1656 V (support)301 1440 A 1771(this)S 1946(option)S 2232(ef\256ciently,)S 2696(since)S 2933(it)S 3019(requires)S 3374(examining)S 3828(every)S 4081(character)S 4481(scanned)S 4834(and)S 5008(reexa-)S 1776 V 1440(mining)S 1751(the)S 1901(characters)S 2338(when)S 2584(the)S 2735(scanner)S 3071(backs)S 3328(up.)S 3506(Things)S 3813(get)S 3964(more)S 4199(complicated)S 4719(when)S 4965(the)S 5116(end)S 1896 V 1440(of)S 1551(buffer)S 1825(or)S 1936(\256le)S 2092(is)S (reached)314 2186 A 2527(or)S 2638(a)S 2710(NUL)S 2945(is)S 3039(scanned)S 3390(\(since)S 3658(the)S 3808(scan)S 4014(must)S 4236(then)S 4436(be)S 4558(restarted)S 4933(with)S 5138(the)S 2016 V 1440(proper)S 1737(line)S 1922(number)S (count\),)282 2263 A 2580(or)S 2699(the)S 2857(user)S 3060(uses)S 3268(the)S 3426(yyless\(\),)S (unput\(\),)321 3805 A 4161(or)S 4280(REJECT)S 4674(actions,)S 5019(or)S 5138(the)S 2136 V (multiple)335 1440 A (input)206 1800 A 2031(buffer)S 2303(functions.)S 2304 V 1440(The)S 1629(fix)S 1773(is)S 1872(to)S 1982(add)S 2159(rules)S 2387(which,)S (upon)200 2690 A 2922(seeing)S 3211(a)S 3288(newline,)S 3664(increment)S 4099(yylineno.)S 4532(This)S 4743(is)S 4843(usually)S 5166(an)S 2424 V 1440(easy)S 1660(process,)S (though)278 2028 A 2347(it)S 2443(can)S 2623(be)S 2758(a)S 2843(drag)S 3062(if)S 3164(some)S 3416(of)S 3540(the)S 3703(patterns)S 4062(can)S 4242(match)S (multiple)335 4528 A 4903(newlines)S 2544 V (along)223 1440 A 1688(with)S 1892(other)S 2124(characters.)S 2712 V 1440(yylineno)S 1816(is)S 1908(not)S 2061(part)S 2243(of)S 2352(the)S 2500(POSIX)S 2817(draft.)S 2880 V 1080(-)S 1440(The)S 10 B (input\(\))298 1633 A 10 R 1968(routine)S 2290(is)S 2394(not)S 2559(rede\256nable,)S (though)278 3069 A 3384(it)S 3477(may)S 3687(be)S 3819(called)S 4097(to)S 4212(read)S 4423(characters)S 4870(following)S 3000 V 1440(whatever)S 1865(has)S 2053(been)S 2297(matched)S 2692(by)S 2846(a)S 2945(rule.)S 3206(If)S 10 B (input\(\))298 3328 A 10 R (encounters)436 3680 A 4170(an)S 4319(end-of-\256le)S 4799(the)S 4976(normal)S 3120 V 10 B 1440(yywrap\(\))S 10 R 1857(processing)S 2312(is)S (done.)220 2404 A 2674(A)S (``real'')288 2772 A 3085(end-of-\256le)S 3536(is)S 3628(returned)S 3989(by)S 10 B (input\(\))298 4114 A 10 R 4437(as)S 10 I 4546(EOF.)S 3288 V 10 R (Input)212 1440 A 1677(is)S 1769(instead)S 2079(controlled)S 2512(by)S 2637(redefining)S 3076(the)S 10 B 3224(YY_INPUT)S 10 R 3759(macro.)S 3456 V 1440(The)S 10 I 1622(flex)S 10 R 1793(restriction)S 2227(that)S 10 B (input\(\))298 2403 A 10 R (cannot)268 2726 A 3019(be)S 3139(redefined)S 3545(is)S 3637(in)S (accordance)454 3740 A 4219(with)S 4424(the)S 4573(POSIX)S 4891(draft,)S 5133(but)S 3576 V 10 B 1440(YY_INPUT)S 10 R 1988(has)S 2160(not)S 2326(yet)S 2487(been)S (accepted)353 2715 A 3106(into)S 3300(the)S 3461(draft)S 3690(\(and)S 3907(probably)S 4302(won't;)S 4603(it)S (looks)217 4696 A 4950(like)S 5138(the)S 3696 V 1440(draft)S (will)157 1661 A 1848(simply)S 2151(not)S 2309(specify)S 2630(any)S 2805(way)S 3003(of)S (controlling)441 3117 A 3588(the)S 3741(scanner's)S (input)206 4152 A 4388(other)S 4625(than)S 4829(by)S 4960(making)S 3816 V 1440(an)S (initial)235 1560 A 1820(assignment)S 2297(to)S 10 I 2400(yyin\).)S 3984 V 10 R 1080(-)S 10 I 1440(\257ex)S 10 R 1611(scanners)S 1989(do)S 2120(not)S 2279(use)S 2444(stdio)S 2671(for)S (input.)231 2821 A (Because)336 3109 A 3477(of)S 3593(this,)S 3795(when)S (writing)291 4045 A 4368(an)S 4495(interactive)S 4953(scanner)S 4104 V 1440(one)S 1616(must)S (explicitly)380 1842 A 2253(call)S 2430(f\257ush\(\))S 2758(on)S 2889(the)S 3043(stream)S 3343(associated)S 3788(with)S 3998(the)S 4152(terminal)S 4519(after)S (writing)291 4736 A 5058(out)S 5216(a)S 4224 V 1440(prompt.)S 1814(With)S 10 I 2049(lex)S 10 R 2201(such)S 2420(writes)S 2702(are)S 2861(automatically)S 3444(\257ushed)S 3769(since)S 10 I 4011(lex)S 10 R 4164(scanners)S 4546(use)S 10 B 4715(getchar\(\))S 10 R 5143(for)S 4344 V 1440(their)S (input.)231 1650 A 1931(Also,)S 2171(when)S (writing)291 2414 A 2730(interactive)S 3181(scanners)S 3553(with)S 10 I 3757(\257ex,)S 10 R 3947(the)S 10 B 4095(-I)S 10 R 4193(\257ag)S 4369(must)S 4589(be)S 4709(used.)S 4512 V 1080(-)S 10 I 1440(\257ex)S 10 R 1621(scanners)S 2009(are)S 2174(not)S 2343(as)S 2468(reentrant)S 2868(as)S 10 I 2993(lex)S 10 R 3152(scanners.)S 3590(In)S 3716(particular,)S 4170(if)S (you)150 4274 A 4466(have)S 4698(an)S 4835(interactive)S 4632 V 1440(scanner)S 1778(and)S 1953(an)S 2077(interrupt)S 2453(handler)S 2784(which)S (long-jumps)457 3059 A 3545(out)S 3702(of)S 3815(the)S 3967(scanner,)S 4329(and)S 4503(the)S 4655(scanner)S 4992(is)S 5088(sub-)S 4752 V 1440(sequently)S 1850(called)S 2116(again,)S (you)150 2384 A 2559(may)S 2757(get)S 2905(the)S 3053(following)S 3469(message:)S 4992 V 1540(fatal)S 1745(\257ex)S 1921(scanner)S 2254(internal)S (error--end)410 2587 A 3022(of)S 3131(buffer)S 3403(missed)S 5232 V 1440(To)S 1577(reenter)S 1883(the)S 2031(scanner,)S 2389(\256rst)S 2571(use)S 5472 V 1540(yyrestart\()S 1952(yyin)S 2155(\);)S 5760 V 1080(-)S 10 B (output\(\))354 1440 A 10 R 1833(is)S 1939(not)S (supported.)421 2106 A 2591(Output)S 2909(from)S 3144(the)S 10 B 3306(ECHO)S 10 R 3641(macro)S 3932(is)S (done)195 4039 A 4274(to)S 4392(the)S 4555(\256le-pointer)S 10 I 5043(yyout)S 5880 V 10 R 1440(\(default)S 10 I (stdout\).)304 1779 A 6048 V 10 R 1440(The)S 1628(POSIX)S 1951(draft)S 2173(mentions)S 2572(that)S 2754(an)S 10 B (output\(\))354 2880 A 10 R 3265(routine)S 3581(exists)S 3841(but)S 4000(currently)S 4396(gives)S 4640(no)S 4772(details)S 5067(as)S 5183(to)S 6168 V 1440(what)S 1661(it)S 1742(does.)S 6336 V 1080(-)S 10 I 1440(lex)S 10 R 1596(does)S 1818(not)S (support)301 1984 A 2323(exclusive)S 2741(start)S (conditions)418 2953 A 3409(\(%x\),)S (though)278 3674 A 3990(they)S 4202(are)S 4365(in)S 4482(the)S 4644(current)S 4969(POSIX)S 6456 V 1440(draft.)S 6624 V 1080(-)S 1440(When)S (de\256nitions)424 1705 A 2154(are)S 2303(expanded,)S 10 I 2738(\257ex)S 10 R 2903(encloses)S 3269(them)S 3495(in)S 3598(parentheses.)S 4143(With)S 4369(lex,)S 4542(the)S 4690(following:)S 6864 V 1540(NAME)S 1937([A-Z][A-Z0-9]*)S 6984 V 1540(%%)S 7104 V 1540(foo{NAME}?)S 2262(printf\()S ("Found)297 2545 A (it\\n")175 2867 A 3067(\);)S 7224 V 1540(%%)S 7464 V (will)157 1440 A 1629(not)S 1789(match)S 2067(the)S 2222(string)S 2483("foo")S (because)319 2731 A 3082(when)S 3332(the)S 3487(macro)S 3771(is)S 3870(expanded)S 4287(the)S 4442(rule)S 4631(is)S 4731(equivalent)S 5183(to)S 7903 V 720(September)S 1176(13,)S (1996)200 1326 A 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4940(Page)S 5161(22)S 8143 V EP %%Page: 23 23 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1440("foo[A-Z][A-Z0-9]*?")S 2412(and)S 2585(the)S (precedence)454 2736 A 3218(is)S 3313(such)S 3524(that)S 3702(the)S 3852('?')S 3992(is)S 4086(associated)S 4527(with)S 4733("[A-Z0-9]*".)S 1080 V 1440(With)S 10 I 1677(\257ex,)S 10 R 1878(the)S 2037(rule)S (will)157 2230 A 2424(be)S 2556(expanded)S 2978(to)S 3093("foo\([A-Z][A-Z0-9]*\)?")S 4117(and)S 4299(so)S 4425(the)S 4585(string)S 4851("foo")S (will)157 5104 A 1200 V 1440(match.)S 1764(Note)S 1988(that)S (because)319 2167 A 2514(of)S 2626(this,)S 2824(the)S 10 B 2974(\303,)S 3060($,)S 3162(,)S 3367(/,)S 10 R 3447(and)S 10 B 3619(<>)S 10 R 4081(operators)S (cannot)268 4483 A 4778(be)S 4900(used)S 5111(in)S 5216(a)S 1320 V 10 I 1440(\257ex)S 10 R (de\256nition.)410 1605 A 1488 V 1440(The)S 1622(POSIX)S 1939(draft)S 2155(interpretation)S 2723(is)S 2815(the)S 2963(same)S 3195(as)S 10 I 3304(flex's.)S 1656 V 10 R 1080(-)S 1440(To)S 1579(specify)S 1897(a)S 1969(character)S 2367(class)S 2590(which)S 2863(matches)S 3220(anything)S 3598(but)S 3753(a)S 3825(left)S 3987(bracket)S (\(']'\),)195 4311 A 4534(in)S 10 I 4640(lex)S 10 R 4786(one)S 4959(can)S 5127(use)S 1776 V ("[\303]]")218 1440 A 1683(but)S 1836(with)S 10 I 2040(\257ex)S 10 R 2205(one)S 2375(must)S 2595(use)S 2754("[\303\\]]".)S 3075(The)S 3257(latter)S 3490(works)S 3761(with)S 10 I 3965(lex,)S 10 R 4133(too.)S 1944 V 1080(-)S 1440(The)S 10 I 1630(lex)S 10 B 1781(%r)S 10 R 1959(\(generate)S 2368(a)S 2446(Ratfor)S 2737(scanner\))S 3112(option)S 3401(is)S 3502(not)S (supported.)421 3664 A 4144(It)S 4240(is)S 4341(not)S 4503(part)S 4694(of)S 4812(the)S 4969(POSIX)S 2064 V 1440(draft.)S 2232 V 1080(-)S 1440(If)S (you)150 1541 A 1724(are)S 1881(providing)S (your)184 2304 A 2521(own)S 2727(yywrap\(\))S 3130(routine,)S (you)150 3473 A 3657(must)S 3886(include)S 4216(a)S ("#undef)320 4295 A 4649(yywrap")S 5026(in)S 5138(the)S 2352 V (de\256nitions)424 1440 A 1889(section)S 2199(\(section)S 2543(1\).)S 2702(Note)S 2923(that)S 3099(the)S ("#undef")361 3247 A (will)157 3633 A 3815(have)S 4030(to)S 4133(be)S 4253(enclosed)S 4630(in)S 4733(%{}'s.)S 2520 V 1440(The)S 1629(POSIX)S 1953(draft)S 2176(specifies)S 2561(that)S 2744(yywrap\(\))S 3146(is)S 3245(a)S 3322(function)S 3689(and)S 3866(this)S 4043(is)S 4142(very)S 4353(unlikely)S 4715(to)S 4826(change;)S 5172(so)S 2640 V 10 I 1440(flex)S 1611(users)S 1848(are)S 2007(warned)S 10 R 2333(that)S 10 B 2509(yywrap\(\))S 10 R 2926(is)S 3018(likely)S 3272(to)S 3375(be)S 3495(changed)S 3855(to)S 3958(a)S 4028(function)S 4388(in)S 4491(the)S 4639(near)S 4838(future.)S 2808 V 1080(-)S 1440(After)S 1684(a)S 1759(call)S 1935(to)S 10 B (unput\(\),)351 2043 A 10 I 2424(yytext)S 10 R 2690(and)S 10 I 2865(yyleng)S 10 R 3158(are)S (unde\256ned)396 3312 A (until)184 3738 A 3952(the)S 4105(next)S 4308(token)S 4562(is)S 4660(matched.)S 5082(This)S 2928 V 1440(is)S 1532(not)S 1685(the)S 1833(case)S 2032(with)S 10 I 2236(lex)S 10 R 2379(or)S 2488(the)S 2636(present)S 2952(POSIX)S 3269(draft.)S 3096 V 1080(-)S 1440(The)S (precedence)454 1633 A 2123(of)S 2243(the)S 10 B 2402({})S 10 R 2518(\(numeric)S 2918(range\))S 3212(operator)S 3585(is)S 3689(different.)S 10 I 4124(lex)S 10 R 4279(interprets)S 4697("abc{1,3}")S 5177(as)S 3216 V 1440("match)S 1759(one,)S 1961(two,)S 2169(or)S 2285(three)S 2519(occurrences)S 3033(of)S 3149('abc'",)S 3455(whereas)S 10 I 3818(\257ex)S 10 R 3989(interprets)S 4401(it)S 4488(as)S 4603("match)S 4921('ab')S 5115(fol-)S 3336 V 1440(lowed)S 1720(by)S 1854(one,)S 2058(two,)S 2268(or)S 2386(three)S 2623(occurrences)S 3140(of)S 3259('c'".)S 3498(The)S 3690(latter)S 3933(is)S 4035(in)S 4148(agreement)S 4603(with)S 4817(the)S 4975(current)S 3456 V 1440(POSIX)S 1757(draft.)S 3624 V 1080(-)S 1440(The)S (precedence)454 1623 A 2103(of)S 2213(the)S 10 B 2362(\303)S 10 R 2422(operator)S 2784(is)S 2877(different.)S 10 I 3301(lex)S 10 R 3445(interprets)S 3852("\303foo|bar")S 4277(as)S 4388("match)S 4702(either)S 4959('foo')S 5188(at)S 3744 V 1440(the)S 1592(beginning)S 2022(of)S 2135(a)S 2209(line,)S 2414(or)S 2527('bar')S 2753(anywhere",)S 3240(whereas)S 10 I 3600(\257ex)S 10 R 3769(interprets)S 4178(it)S 4262(as)S 4374("match)S 4689(either)S 4947('foo')S 5177(or)S 3864 V 1440('bar')S 1677(if)S 1779(they)S 1992(come)S 2250(at)S 2363(the)S 2526(beginning)S 2967(of)S 3091(a)S 3176(line".)S 3458(The)S 3655(latter)S 3903(is)S 4011(in)S 4130(agreement)S 4591(with)S 4811(the)S 4975(current)S 3984 V 1440(POSIX)S 1757(draft.)S 4152 V 1080(-)S 1440(To)S 1583(refer)S 1806(to)S 1915(yytext)S 2197(outside)S 2518(of)S 2633(the)S 2787(scanner)S 3126(source)S 3420(\256le,)S 3605(the)S 3759(correct)S (de\256nition)385 4071 A 4487(with)S 10 I 4697(\257ex)S 10 R 4869(is)S 4968("extern)S 4272 V 1440(char)S (*yytext")342 1648 A 2024(rather)S 2294(than)S 2501("extern)S 2828(char)S 3035(yytext[]".)S 3478(This)S 3690(is)S 3790(contrary)S 4159(to)S 4270(the)S 4426(current)S 4745(POSIX)S 5070(draft)S 4392 V 1440(but)S 1593(a)S 1664(point)S 1896(on)S 2022(which)S 10 I 2294(\257ex)S 10 R (will)157 2460 A 2643(not)S 2797(be)S 2918(changing,)S 3337(as)S 3447(the)S 3596(array)S 3830(representation)S 4427(entails)S 4716(a)S 4787(serious)S 5098(per-)S 4512 V 1440(formance)S 1848(penalty.)S 2221(It)S 2310(is)S (hoped)245 2404 A 2676(that)S 2854(the)S 3004(POSIX)S 3323(draft)S (will)157 3541 A 3725(be)S 3846(emended)S 4235(to)S (support)301 4339 A 4666(the)S 10 I 4815(\257ex)S 10 R 4981(variety)S 4632 V 1440(of)S 1549(declaration)S 2022(\(as)S 2165(this)S 2335(is)S 2427(a)S 2497(fairly)S 2741(painless)S 3090(change)S 3400(to)S 3503(require)S 3814(of)S 10 I 3923(lex)S 10 R 4066(users\).)S 4800 V 1080(-)S 10 I 1440(yyin)S 10 R 1637(is)S 10 I (initialized)402 1733 A 10 R 2164(by)S 10 I 2293(lex)S 10 R 2440(to)S 2547(be)S 10 I 2671(stdin;)S 2929(\257ex,)S 10 R 3123(on)S 3252(the)S 3404(other)S 3640(hand,)S (initializes)392 3889 A 10 I 4310(yyin)S 10 R 4507(to)S 4614(NULL)S 4913(and)S 5088(then)S 4920 V 10 I 1440(assigns)S 10 R 1777(it)S 1875(to)S 10 I 1995(stdin)S 10 R 2232(the)S 2397(\256rst)S 2596(time)S 2817(the)S 2982(scanner)S 3332(is)S 3441(called,)S 3749(providing)S 10 I 4180(yyin)S 10 R 4389(has)S 4564(not)S 4733(already)S 5071(been)S 5040 V 1440(assigned)S 1822(to)S 1936(a)S (non-NULL)454 2017 A 2508(value.)S 2813(The)S 3007(difference)S 3454(is)S 3558(subtle,)S 3860(but)S 4025(the)S 4185(net)S 4345(effect)S 4613(is)S 4717(that)S 4905(with)S 10 I 5121(\257ex)S 5160 V 10 R 1440(scanners,)S 10 I 1837(yyin)S 10 R 2030(does)S 2239(not)S 2392(have)S 2607(a)S 2677(valid)S 2903(value)S (until)184 3146 A 3355(the)S 3503(scanner)S 3836(has)S 3995(been)S 4210(called.)S 5328 V 1080(-)S 1440(The)S 1643(special)S 1969(table-size)S 2402(declarations)S 2935(such)S 3165(as)S 10 B 3295(%a)S 10 R (supported)396 3491 A 3933(by)S 10 I 4080(lex)S 10 R 4245(are)S 4416(not)S 4591(required)S 4974(by)S 10 I 5121(\257ex)S 5448 V 10 R 1440(scanners;)S 10 I 1840(\257ex)S 10 R (ignores)296 2005 A 2326(them.)S 5616 V 1080(-)S 1440(The)S 1625(name)S 10 B (FLEX_SCANNER)807 1871 A 10 R 2706(is)S 2801(#de\256ne'd)S 3209(so)S 3327(scanners)S 3703(may)S 3905(be)S (written)286 4029 A 4344(for)S 4491(use)S 4654(with)S 4862(either)S 10 I 5121(\257ex)S 5736 V 10 R 1440(or)S 10 I 1549(lex.)S 5904 V 10 R 1080(The)S 1262(following)S 10 I 1678(\257ex)S 10 R 1843(features)S 2188(are)S 2337(not)S 2490(included)S 2861(in)S 10 I 2964(lex)S 10 R 3107(or)S 3216(the)S 3364(POSIX)S 3681(draft)S 3897(standard:)S 6144 V 1180(yyterminate\(\))S 6264 V 1180(<>)S 6384 V 1180(YY_DECL)S 6504 V 1180(#line)S 1406(directives)S 6624 V 1180(%{}'s)S (around)279 1458 A 1762(actions)S 6744 V 1180(yyrestart\(\))S 6864 V 1180(comments)S 1618(beginning)S 2044(with)S 2248('#')S (\(deprecated\))505 2391 A 6984 V (multiple)335 1180 A 1540(actions)S 1850(on)S 1975(a)S 2045(line)S 7224 V 1080(This)S 1285(last)S 1451(feature)S 1758(refers)S 2015(to)S 2119(the)S 2268(fact)S 2446(that)S 2623(with)S 10 I 2828(\257ex)S 10 R (you)150 2994 A 3170(can)S 3337(put)S (multiple)335 3492 A 3854(actions)S 4166(on)S 4293(the)S 4443(same)S 4677(line,)S 4880(separated)S 7344 V 1080(with)S 1284(semi-colons,)S 1820(while)S 2069(with)S 10 I 2273(lex,)S 10 R 2441(the)S 2589(following)S 7903 V 720(Page)S 941(23)S 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4455(September)S 4911(13,)S (1996)200 5061 A 8143 V EP %%Page: 24 24 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1180(foo)S 1414(handle_foo\(\);)S 1987(++num_foos_seen;)S 1200 V 1080(is)S 1172(\(rather)S 1467(surprisingly\))S 2006(truncated)S 2406(to)S 1440 V 1180(foo)S 1414(handle_foo\(\);)S 1680 V 10 I 1080(\257ex)S 10 R 1252(does)S 1468(not)S 1628(truncate)S 1985(the)S 2141(action.)S 2470(Actions)S 2816(that)S 3000(are)S 3157(not)S 3318(enclosed)S 3703(in)S (braces)258 3814 A 4105(are)S 4262(simply)S 4568(terminated)S 5032(at)S 5138(the)S 1800 V 1080(end)S 1250(of)S 1359(the)S 1507(line.)S 1968 V 9 R 720(D)S 722(DI)S 790(IA)S 823(AG)S 891(GN)S 959(NO)S 1027(OS)S 1095(ST)S 1147(TI)S 1205(IC)S 1238(CS)S 1300(S)S 2088 V 10 I (reject_used_but_not_detected)1206 1080 A (unde\256ned)390 2332 A 10 R 2768(or)S 10 I (yymore_used_but_not_detected)1273 2899 A (unde\256ned)390 4219 A 4656(-)S 10 R 4737(These)S 5025(errors)S 2208 V 1080(can)S 1259(occur)S 1522(at)S 1634(compile)S 1997(time.)S 2265(They)S 2511(indicate)S 2869(that)S 3059(the)S 3221(scanner)S 3568(uses)S 10 B 3779(REJECT)S 10 R 4214(or)S 10 B 4336(yymore\(\))S 10 R 4766(but)S 4932(that)S 10 I 5121(\257ex)S 2328 V 10 R 1080(failed)S 1348(to)S 1464(notice)S 1748(the)S 1910(fact,)S 2126(meaning)S 2511(that)S 10 I 2701(\257ex)S 10 R 2880(scanned)S 3243(the)S 3405(\256rst)S 3601(two)S 3791(sections)S (looking)306 4154 A 4499(for)S 4656(occurrences)S 5177(of)S 2448 V 1080(these)S 1315(actions)S 1628(and)S 1801(failed)S 2059(to)S 2165(\256nd)S 2349(any,)S 2547(but)S 2703(somehow)S (you)150 3116 A 3294(snuck)S 3556(some)S 3796(in)S 3902(\(via)S 4087(a)S 4160(#include)S 4534(\256le,)S 4716(for)S 4861(example\).)S 2568 V 1080(Make)S 1341(an)S 1468(explicit)S 1802(reference)S 2212(to)S 2323(the)S 2479(action)S 2758(in)S (your)184 2869 A 10 I 3086(\257ex)S 10 R (input)206 3259 A 3498(\256le.)S 3710(\(Note)S 3973(that)S 4157(previously)S 10 I 4614(\257ex)S 10 R (supported)396 4787 A 5216(a)S 2688 V 10 B (%used/%unused)732 1080 A 10 R 1855(mechanism)S 2356(for)S 2517(dealing)S 2855(with)S 3076(this)S 3263(problem;)S 3668(this)S 3855(feature)S 4178(is)S (still)151 4287 A (supported)396 4480 A 4918(but)S 5088(now)S 2808 V (deprecated,)462 1080 A 1578(and)S (will)157 1759 A 1952(go)S 2088(away)S (soon)189 2337 A 2562(unless)S 2849(the)S 3008(author)S 3301(hears)S 3550(from)S 3782(people)S 4086(who)S 4295(can)S 4471(argue)S (compellingly)530 4731 A 2928 V 1080(that)S 1256(they)S 1454(need)S 1669(it.\))S 3096 V 10 I 1080(\257ex)S (scanner)318 1268 A 1634(jammed)S 2001(-)S 10 R 2083(a)S 2176(scanner)S 2532(compiled)S 2954(with)S 10 B 3181(-s)S 10 R 3302(has)S (encountered)492 3484 A 4024(an)S (input)206 4167 A 4421(string)S 4698(which)S 4992(wasn't)S 3216 V 1080(matched)S 1446(by)S 1571(any)S 1741(of)S 1850(its)S 1970(rules.)S 3384 V 10 I 1080(\257ex)S (input)206 1256 A 1498(buffer)S 1774(over\257owed)S 2251(-)S 10 R 2321(a)S 2402(scanner)S 2746(rule)S 2939(matched)S 3316(a)S 3397(string)S (long)178 3663 A (enough)295 3878 A 4210(to)S 4325(over\257ow)S 4720(the)S 4880(scanner's)S 3504 V 1080(internal)S (input)206 1417 A 1652(buffer)S 1928(\(16K)S 2164(bytes)S 2405(by)S 2534(default)S 2843(-)S 2906(controlled)S 3343(by)S 10 B 3471(YY_BUF_SIZE)S 10 R 4176(in)S 4282("\257ex.skel".)S 4780(Note)S 5004(that)S 5183(to)S 3624 V 1080(rede\256ne)S 1430(this)S 1600(macro,)S (you)150 1902 A 2077(must)S 2297(\256rst)S 10 B (#unde\256ne)420 2479 A 10 R 2924(it\).)S 3792 V 10 I (scanner)318 1080 A 1426(requires)S 1789(-8)S (\257ag)150 1901 A 2080(-)S 10 R 2143(Your)S 2379(scanner)S 2716(speci\256cation)S 3254(includes)S (recognizing)475 3618 A 4122(8-bit)S 4341(characters)S 4780(and)S (you)150 4954 A 5133(did)S 3912 V 1080(not)S 1233(specify)S 1549(the)S 1697(-8)S 1806(\257ag)S 1982(\(and)S (your)184 2186 A 2395(site)S 2560(has)S 2719(not)S 2872(installed)S 3238(\257ex)S 3414(with)S 3618(-8)S 3727(as)S 3836(the)S 3984(default\).)S 4080 V 10 I 1080(fatal)S 1290(\257ex)S (scanner)318 1456 A 1801(internal)S 2146(error--end)S 2598(of)S 2703(buffer)S 2970(missed)S 3271(-)S 10 R 3332(This)S 3538(can)S 3705(occur)S 3956(in)S 4061(an)S 4183(scanner)S 4518(which)S 4791(is)S 4885(reentered)S 4200 V 1080(after)S 1312(a)S (long-jump)418 1403 A 1867(has)S 2047(jumped)S 2394(out)S 2568(\(or)S 2732(over\))S 2991(the)S 3160(scanner's)S 3587(activation)S 4030(frame.)S 4362(Before)S 4683(reentering)S 5138(the)S 4320 V 1080(scanner,)S 1438(use:)S 4560 V 1180(yyrestart\()S 1592(yyin)S 1795(\);)S 4848 V 10 I 1080(too)S 1238(many)S 1486(%t)S 1628(classes!)S 1977(-)S 10 R 2041(You)S 2244(managed)S 2637(to)S 2745(put)S 2903(every)S 3157(single)S 3427(character)S 3828(into)S 4015(its)S 4141(own)S 4345(%t)S 4488(class.)S 10 I 4765(\257ex)S 10 R 4936(requires)S 4968 V 1080(that)S 1256(at)S 1354(least)S 1564(one)S 1734(of)S 1843(the)S 1991(classes)S 2296(share)S 2534(characters.)S 5136 V 9 R 720(D)S 722(DE)S 790(EF)S 848(FI)S 900(IC)S 933(CI)S 995(IE)S 1028(EN)S 1086(NC)S 1154(CI)S 1216(IE)S 1249(ES)S 1307(S)S 1397(/)S 1399(/)S 1464(B)S 1466(BU)S 1528(UG)S 1596(GS)S 1664(S)S 5256 V 10 R 1080(See)S 1251(\257ex\(1\).)S 5424 V 9 R 720(S)S 722(SE)S 774(EE)S 832(E)S 913(A)S 915(AL)S 983(LS)S 1041(SO)S 1093(O)S 5544 V 10 R 1080(\257ex\(1\),)S 1399(lex\(1\),)S (yacc\(1\),)328 1690 A 2043(sed\(1\),)S 2345(awk\(1\).)S 5712 V 1080(M.)S 1219(E.)S 1331(Lesk)S 1552(and)S 1722(E.)S 1834(Schmidt,)S 10 I 2219(LEX)S 2424(-)S 2483(Lexical)S 2805(Analyzer)S 3188(Generator)S 5880 V 9 R 720(A)S 722(AU)S 790(UT)S 858(TH)S 916(HO)S 984(OR)S 1052(R)S 6000 V 10 R 1080(Vern)S 1312(Paxson,)S 1657(with)S 1867(the)S 2021(help)S 2225(of)S 2340(many)S 2594(ideas)S 2832(and)S 3008(much)S 3262(inspiration)S 3723(from)S 3950(Van)S 4149(Jacobson.)S 4598(Original)S 4965(version)S 6120 V 1080(by)S 1216(Jef)S 1370(Poskanzer.)S 1870(The)S 2063(fast)S 2245(table)S 2477(representation)S 3084(is)S 3187(a)S 3268(partial)S 3562(implementation)S 4229(of)S 4349(a)S 4430(design)S (done)195 4728 A 4958(by)S 5093(Van)S 6240 V 1080(Jacobson.)S 1523(The)S 1705(implementation)S 2361(was)S (done)195 2543 A 2763(by)S 2888(Kevin)S (Gong)223 3159 A 3407(and)S 3577(Vern)S 3804(Paxson.)S 6408 V 1080(Thanks)S 1436(to)S 1574(the)S 1758(many)S 10 I 2042(\257ex)S 10 R 2243(beta-testers,)S 2789(feedbackers,)S 3357(and)S 3563(contributors,)S 4135(especially)S 4599(Casey)S 4906(Leedom,)S 6528 V 1080(benson@odi.com,)S 1863(Keith)S 2141(Bostic,)S 2477(Frederic)S 2868(Brehm,)S 3221(Nick)S (Christopher,)500 3471 A 4025(Jason)S (Coughlin,)398 4302 A 4754(Scott)S 5015(David)S 6648 V 1080(Daniels,)S 1456(Leo)S 1656(Eskin,)S 1953(Chris)S 2214(Faylor,)S 2545(Eric)S 2757(Goldman,)S 3200(Eric)S (Hughes,)332 3413 A (Jeffrey)281 3789 A 4114(R.)S 4250(Jones,)S 4542(Kevin)S 4832(B.)S (Kenny,)293 4968 A 6768 V 1080(Ronald)S 1406(Lamprecht,)S 1904(Greg)S 2142(Lee,)S 2355(Craig)S 2615(Leres,)S 2901(Mohamed)S 3344(el)S 3453(Lozy,)S 3721(Jim)S 3902(Meyering,)S 4354(Marc)S 4603(Nozell,)S (Esmond)329 4932 A 6888 V (Pitt,)165 1080 A 1270(Jef)S 1413(Poskanzer,)S 1877(Jim)S 2047(Roskind,)S 2432(Dave)S 2671(Tallman,)S 3058(Frank)S 3319(Whaley,)S 3683(Ken)S 3877(Yap,)S 4096(and)S 4267(those)S 4505(whose)S 4788(names)S 5071(have)S 7008 V 1080(slipped)S 1395(my)S 1548(marginal)S 1931(mail-archiving)S (skills)212 2549 A 2786(but)S 2939(whose)S 3221(contributions)S 3776(are)S 3925(appreciated)S 4415(all)S 4541(the)S 4689(same.)S 7176 V 1080(Thanks)S 1402(to)S 1506(Keith)S 1756(Bostic,)S (John)189 2064 A 2279(Gilmore,)S 2666(Craig)S 2917(Leres,)S 3194(Bob)S 3388(Mulcahy,)S 3797(Rich)S 4014(Salz,)S 4240(and)S 4412(Richard)S 4758(Stallman)S 5143(for)S 7296 V 1080(help)S 1278(with)S 1482(various)S 1803(distribution)S 2291(headaches.)S 7903 V 720(September)S 1176(13,)S (1996)200 1326 A 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4940(Page)S 5161(24)S 8143 V EP %%Page: 25 25 BP /slant 0 def /height 0 def 480 V 10 R 720(FLEX)S 981(\()S 1023(1)S 1081(\))S 2756(Version)S 3100(2.3)S 4866(FLEX)S 5127(\()S 5169(1)S 5227(\))S 960 V 1080(Thanks)S 1413(to)S (Esmond)329 1529 A (Pitt)140 1896 A 2074(and)S 2257(Earle)S 2509(Horton)S 2832(for)S 2988(8-bit)S 3216(character)S (support;)329 3625 A 3992(to)S 4108(Benson)S 4447(Margulies)S 4893(and)S 5076(Fred)S 1080 V 1080(Burke)S 1353(for)S 1498(C++)S (support;)329 1706 A 2062(to)S 2167(Ove)S 2362(Ewerlid)S 2709(for)S 2854(the)S 3003(basics)S 3275(of)S (support)301 3385 A 3712(for)S 3856(NUL's;)S 4191(and)S 4362(to)S 4466(Eric)S (Hughes)307 4661 A 4994(for)S 5138(the)S 1200 V 1080(basics)S 1351(of)S (support)301 1460 A 1786(for)S (multiple)335 1929 A 2289(buffers.)S 1368 V 1080(Work)S 1353(is)S 1464(being)S (done)195 1731 A 1970(on)S 2115(extending)S 10 I 2556(\257ex)S 10 R 2741(to)S 2864(generate)S 3251(scanners)S 3643(in)S 3766(which)S 4057(the)S 4225(state)S 4455(machine)S 4841(is)S 4953(directly)S 1488 V 1080(represented)S 1581(in)S 1695(C)S 1798(code)S 2024(rather)S 2296(than)S 2505(tables.)S 2826(These)S 3103(scanners)S 3486(may)S 3695(well)S 3905(be)S 4036(substantially)S 4580(faster)S 4841(than)S 5049(those)S 1608 V 1080(generated)S 1499(using)S 1743(-f)S 1838(or)S 1949(-F.)S 2116(If)S (you)150 2211 A 2388(are)S 2539(working)S 2901(in)S 3006(this)S 3179(area)S 3376(and)S 3549(are)S 3701(interested)S 4121(in)S 4227(comparing)S 4685(notes)S 4925(and)S 5098(see-)S 1728 V 1080(ing)S 1233(whether)S (redundant)402 1583 A 2010(work)S 2242(can)S 2407(be)S 2527(avoided,)S 2895(contact)S 3211(Ove)S 3404(Ewerlid)S 3749(\(ewerlid@mizar.DoCS.UU.SE\).)S 1896 V 1080(This)S 1289(work)S 1526(was)S 1713(primarily)S (done)195 2118 A 2343(when)S 2591(I)S 2655(was)S 2842(at)S 2945(the)S 3098(Real)S 3313(Time)S 3556(Systems)S (Group)257 3921 A 4209(at)S 4313(the)S 4467(Lawrence)S 4897(Berkeley)S 2016 V 1080(Laboratory)S 1553(in)S 1656(Berkeley,)S 2070(CA.)S 2285(Many)S 2544(thanks)S 2831(to)S 2934(all)S 3060(there)S 3287(for)S 3430(the)S (support)301 3578 A 3904(I)S (received.)367 3963 A 2184 V 1080(Send)S 1306(comments)S 1744(to:)S 2424 V 1205(Vern)S 1432(Paxson)S 2544 V 1205(Computer)S 1632(Science)S 1971(Department)S 2664 V (4126)200 1205 A 1430(Upson)S 1717(Hall)S 2784 V 1205(Cornell)S 1532(University)S 2904 V (Ithaca,)272 1205 A 1502(NY)S (14853-7501)484 1673 A 3144 V 1205(vern@cs.cornell.edu)S 3264 V 1205(decvax!cornell!vern)S 7903 V 720(Page)S 941(25)S 2681(\()S 2723(26)S 2848(May)S (1990)200 3057 A 3265(\))S 4455(September)S 4911(13,)S (1996)200 5061 A 8143 V EP %%Trailer %%DocumentFonts: Times-Roman Times-Bold Times-Italic %%Pages: 25