⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flexdoc.1

📁 操作系统设计与实现源码
💻 1
📖 第 1 页 / 共 5 页
字号:
%!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 defsystemdict /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 addcurrentpoint pop Xm}bind def/H{//res div0 transform X round X itransform popcurrentpoint X popmoveto}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 fillgr}bind def1 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} ifend/BP{save mark devps begin m0/DocumentInitState [ matrix currentmatrix currentlinewidth currentlinecapcurrentlinejoin 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 def0 1 255 {Encoding-1 exch /.notdef put} forEncoding-1 8#301 StandardEncoding 8#101 26 getinterval putinterval %A-BEncoding-1 8#341 StandardEncoding 8#141 26 getinterval putinterval %a-bEncoding-1 8#241 StandardEncoding 8#301 16 getinterval putinterval %accentsEncoding-1 8#373 StandardEncoding 8#365 1 getinterval putinterval %dotlessiEncoding-1dup 8#41 /copyright putdup 8#42 /registered putdup 8#43 /trademark putdup 8#44 /logicalnot putdup 8#45 /Eth putdup 8#46 /eth putdup 8#47 /Thorn putdup 8#50 /thorn putdup 8#51 /brokenbar putdup 8#52 /degree putdup 8#53 /divide putdup 8#54 /multiply putdup 8#55 /minus putdup 8#56 /onehalf putdup 8#57 /onequarter putdup 8#60 /threequarters putdup 8#101 /Aacute putdup 8#102 /Acircumflex putdup 8#103 /Adieresis putdup 8#104 /Agrave putdup 8#105 /Aring putdup 8#106 /Atilde putdup 8#107 /Ccedilla putdup 8#110 /Eacute putdup 8#111 /Ecircumflex putdup 8#112 /Edieresis putdup 8#113 /Egrave putdup 8#114 /Iacute putdup 8#115 /Icircumflex putdup 8#116 /Idieresis putdup 8#117 /Igrave putdup 8#120 /Ntilde putdup 8#121 /Oacute putdup 8#122 /Ocircumflex putdup 8#123 /Odieresis putdup 8#124 /Ograve putdup 8#125 /Otilde putdup 8#126 /Scaron putdup 8#127 /Uacute putdup 8#130 /Ucircumflex putdup 8#131 /Udieresis putdup 8#132 /Ugrave putdup 8#133 /Ydieresis putdup 8#134 /Zcaron putdup 8#135 /aacute putdup 8#136 /acircumflex putdup 8#137 /adieresis putdup 8#140 /agrave putdup 8#141 /aring putdup 8#142 /atilde putdup 8#143 /ccedilla putdup 8#144 /eacute putdup 8#145 /ecircumflex putdup 8#146 /edieresis putdup 8#147 /egrave putdup 8#150 /iacute putdup 8#151 /icircumflex putdup 8#152 /idieresis putdup 8#153 /igrave putdup 8#154 /ntilde putdup 8#155 /oacute putdup 8#156 /ocircumflex putdup 8#157 /odieresis putdup 8#160 /ograve putdup 8#161 /otilde putdup 8#162 /scaron putdup 8#163 /uacute putdup 8#164 /ucircumflex putdup 8#165 /udieresis putdup 8#166 /ugrave putdup 8#167 /ydieresis putdup 8#170 /zcaron putpop/Enc-dict 30 dict defEnc-dict /tmpstr1 50 string putEnc-dict /tmpstr2 50 string putEnc-dict /tmpstr3 50 string dup (Encoding-) exch cvs pop put/AEnc-def { % arguments: the original font's name, encoding nrEnc-dict begintmpstr2 cvs /Enc-no exch def % Remember the number in a stringdup /OrigName exch def % remember the namefindfont 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} forallnewdict begin/Encoding  tmpstr3 9 Enc-no putinterval tmpstr3 0 9 Enc-no length add getinterval  cvn load  def % Replace encodingcurrentdict /UniqueID known{ /UniqueID UniqueID Enc-no cvi 49999 mul add def } if % Derive New UniqueIDend % newdict/FNlength OrigName tmpstr1 cvs length def % convert name, remember lengthFNlength 1 add Enc-no length add stringdup 0 OrigName tmpstr1 cvs putintervaldup FNlength (-) putintervaldup FNlength 1 add Enc-no putintervaldup 0 tmpstr1 0 FNlength getinterval putinterval % Add old namecvn dup newdict /FontName 3 2 roll put newdict definefontend % Enc-dict} def/Times-Bold 1 AEnc-def pop/B-1{/Times-Bold-1 FF}def%%EndProlog%%Page: 1 1BP/slant 0 def/height 0 def480 V10 R720(FLEX)S981(\()S1023(1)S1081(\))S2756(Version)S3100(2.3)S4866(FLEX)S5127(\()S5169(1)S5227(\))S960 V9 R720(N)S722(NA)S790(AM)S858(ME)S940(E)S1080 V10 R(\257exdoc)296 1080 A1401(-)S1460(fast)S1631(lexical)S1925(analyzer)S2292(generator)S1248 V9 R720(S)S722(SY)S774(YN)S842(NO)S910(OP)S978(PS)S1030(SI)S1082(IS)S1115(S)S1368 V10 B1080(\257ex)S([-bcd\256npstvFILT8)801 1269 A2108(-C[efmF])S2546(-Sskeleton])S10 I3061([\256lename)S(...])114 3479 A1536 V9 R720(D)S722(DE)S790(ES)S848(SC)S900(CR)S962(RI)S1024(IP)S1057(PT)S1109(TI)S1167(IO)S1200(ON)S1268(N)S1656 V10 I1080(\257ex)S10 R1246(is)S1339(a)S1410(tool)S1592(for)S1737(generating)S10 I(scanners:)391 2189 A10 R2607(programs)S3014(which)S(recognized)442 3287 A3756(lexical)S4052(patterns)S4398(in)S4503(text.)S10 I4731(\257ex)S10 R4898(reads)S5138(the)S1776 V1080(given)S(input)206 1334 A1571(\256les,)S1795(or)S1910(its)S2036(standard)S(input)206 2408 A2645(if)S2738(no)S2869(\256le)S3028(names)S3315(are)S3469(given,)S3747(for)S3895(a)S3970(description)S4447(of)S4561(a)S4636(scanner)S4974(to)S5082(gen-)S1896 V1080(erate.)S1356(The)S1542(description)S2018(is)S2114(in)S2221(the)S2373(form)S2599(of)S2713(pairs)S2939(of)S3053(regular)S3369(expressions)S3868(and)S4043(C)S4140(code,)S4385(called)S10 I4656(rules.)S4912(\257ex)S10 R5082(gen-)S2016 V1080(erates)S1355(as)S1478(output)S1773(a)S1857(C)S1963(source)S2265(\256le,)S10 B2458(lex.yy.c,)S10 R2840(which)S3125(de\256nes)S3449(a)S3533(routine)S10 B3857(yylex\(\).)S10 R4212(This)S4430(\256le)S4598(is)S4704(compiled)S5116(and)S2136 V1080(linked)S1362(with)S1572(the)S10 B1726(-l\257)S10 R1875(library)S2175(to)S(produce)324 2285 A2641(an)S2768(executable.)S3281(When)S3553(the)S3708(executable)S4171(is)S4270(run,)S4461(it)S4549(analyzes)S4928(its)S(input)206 5055 A2256 V1080(for)S1239(occurrences)S1762(of)S1887(the)S2051(regular)S2378(expressions.)S2938(Whenever)S3392(it)S3488(\256nds)S3723(one,)S3933(it)S4029(executes)S4416(the)S(corresponding)575 4579 A5194(C)S2376 V1080(code.)S2544 V9 R720(S)S722(SO)S774(OM)S842(ME)S924(E)S1020(S)S1022(SI)S1074(IM)S1107(MP)S1189(PL)S1241(LE)S1299(E)S1395(E)S1397(EX)S1455(XA)S1523(AM)S1591(MP)S1673(PL)S1725(LE)S1783(ES)S1841(S)S2664 V10 R1080(First)S1295(some)S1537(simple)S1835(examples)S2245(to)S2353(get)S2506(the)S2659(\257avor)S2925(of)S3040(how)S3244(one)S3420(uses)S10 I3624(\257ex.)S10 R3820(The)S4008(following)S10 I4430(\257ex)S10 R(input)206 4601 A4838(speci\256es)S5216(a)S2784 V1080(scanner)S1413(which)S1684(whenever)S2101(it)S(encounters)436 2182 A2643(the)S2791(string)S3045("username")S(will)157 3538 A(replace)292 3720 A4037(it)S4118(with)S4322(the)S4470(user's)S4736(login)S4967(name:)S3024 V1180(%%)S3144 V1180(username)S1666(printf\()S1949("%s",)S2204(getlogin\(\))S2626(\);)S3384 V1080(By)S1236(default,)S1580(any)S1764(text)S1954(not)S2121(matched)S2501(by)S2640(a)S10 I2724(\257ex)S10 R2903(scanner)S3250(is)S3356(copied)S3664(to)S3782(the)S3945(output,)S4266(so)S4395(the)S4558(net)S4721(effect)S4992(of)S5116(this)S3504 V1080(scanner)S1427(is)S1533(to)S(copy)195 1650 A1884(its)S(input)206 2018 A2262(\256le)S2429(to)S2545(its)S2678(output)S2972(with)S(each)185 3189 A3412(occurrence)S3893(of)S4015("username")S4521(expanded.)S4994(In)S5116(this)S3624 V(input,)231 1080 A1341(there)S1573(is)S1670(just)S1845(one)S2020(rule.)S2257("username")S2755(is)S2852(the)S10 I3005(pattern)S10 R3325(and)S3500(the)S3653("printf")S3989(is)S4086(the)S10 I4239(action.)S10 R4546(The)S4734("%%")S5015(marks)S3744 V1080(the)S1228(beginning)S1654(of)S1763(the)S1911(rules.)S3912 V1080(Here's)S1375(another)S1702(simple)S1995(example:)S4152 V1280(int)S1411(num_lines)S1854(=)S1936(0,)S2036(num_chars)S2502(=)S2584(0;)S4392 V1180(%%)S4512 V1180(\\n)S1358(++num_lines;)S1943(++num_chars;)S4632 V1180(.)S1330(++num_chars;)S4872 V1180(%%)S4992 V1180(main\(\))S5112 V1280({)S5232 V1280(yylex\(\);)S5352 V1280(printf\()S1563("#)S1679(of)S1788(lines)S2003(=)S2085(%d,)S2269(#)S2344(of)S2453(chars)S2691(=)S2773(%d\\n",)S5472 V1480(num_lines,)S1948(num_chars)S2414(\);)S5592 V1280(})S5832 V1080(This)S1285(scanner)S(counts)262 1619 A1907(the)S2056(number)S2389(of)S2499(characters)S2935(and)S3106(the)S3255(number)S3588(of)S3698(lines)S3914(in)S4018(its)S(input)206 4139 A4371(\(it)S(produces)363 4488 A4878(no)S5005(output)S5952 V1080(other)S1340(than)S1566(the)S1741(\256nal)S1972(report)S2265(on)S2417(the)S(counts\).)321 2592 A2990(The)S3199(\256rst)S3408(line)S3611(declares)S3994(two)S4197(globals,)S4564("num_lines")S5116(and)S6072 V1080("num_chars",)S1669(which)S1956(are)S(accessible)409 2121 A2571(both)S2790(inside)S10 B3071(yylex\(\))S10 R3403(and)S3589(in)S3708(the)S10 B3872(main\(\))S10 R4199(routine)S4526(declared)S4910(after)S5138(the)S6192 V(second)279 1080 A1392("%%".)S1725(There)S1994(are)S2151(two)S2335(rules,)S2589(one)S2766(which)S3044(matches)S3406(a)S3483(newline)S3834(\("\\n"\))S4094(and)S4271(increments)S4745(both)S4955(the)S5110(line)S6312 V(count)223 1080 A1330(and)S1502(the)S1652(character)S(count,)248 2050 A2325(and)S2497(one)S2670(which)S2944(matches)S3302(any)S3475(character)S3874(other)S4109(than)S4310(a)S4383(newline)S4730(\(indicated)S5161(by)S6432 V1080(the)S1228(".")S1360(regular)S1671(expression\).)S6600 V1080(A)S1178(somewhat)S1611(more)S1843(complicated)S2360(example:)S6840 V1180(/*)S1283(scanner)S1616(for)S1759(a)S1829(toy)S1982(Pascal-like)S(language)363 2450 A2838(*/)S7080 V1180(%{)S7200 V1180(/*)S1283(need)S1498(this)S1668(for)S1811(the)S1959(call)S2130(to)S(atof\(\))225 2233 A2483(below)S2754(*/)S7320 V1180(#include)S1551(<math.h>)S7440 V1180(%})S7903 V720(Page)S941(1)S2681(\()S2723(26)S2848(May)S(1990)200 3057 A3265(\))S4455(September)S4911(13,)S(1996)200 5061 A8143 VEP%%Page: 2 2BP/slant 0 def/height 0 def480 V10 R720(FLEX)S981(\()S1023(1)S1081(\))S2756(Version)S3100(2.3)S4866(FLEX)S5127(\()S5169(1)S5227(\))S960 V1180(DIGIT)S1556([0-9])S1080 V1180(ID)S1462([a-z][a-z0-9]*)S1320 V1180(%%)S1560 V1180({DIGIT}+)S1709({)S1680 V1480(printf\()S1763("An)S1952(integer:)S2285(%s)S2433(\(%d\)\\n",)S2804(yytext,)S1800 V1680(atoi\()S1890(yytext)S2166(\))S2225(\);)S1920 V1480(})S2160 V1180({DIGIT}+"."{DIGIT}*)S2338({)S2280 V1480(printf\()S1763("A)S1902(\257oat:)S2134(%s)S2282(\(%g\)\\n",)S2653(yytext,)S2400 V1680(atof\()S1896(yytext)S2172(\))S2231(\);)S2520 V1480(})S2760 V1180(if|then|begin|end|procedure|function)S2821({)S2880 V1480(printf\()S1763("A)S1902(keyword:)S2307(%s\\n",)S2599(yytext)S2875(\);)S3000 V1480(})S3240 V1180({ID})S1583(printf\()S1866("An)S2055(identi\256er:)S2472(%s\\n",)S2764(yytext)S3040(\);)S3480 V1180("+"|"-"|"*"|"/")S1812(printf\()S2095("An)S2284(operator:)S2673(%s\\n",)S2965(yytext)S3241(\);)S3720 V1180("{"[\303}\\n]*"}")S1843(/*)S1946(eat)S2089(up)S2214(one-line)S2569(comments)S3007(*/)S3960 V1180([)S(\\t\\n]+)225 1239 A1714(/*)S1817(eat)S1960(up)S(whitespace)448 2085 A2558(*/)S4200 V1180(.)S1480(printf\()S("Unrecognized)606 1763 A2394(character:)S2818(%s\\n",)S3110(yytext)S3386(\);)S4440 V1180(%%)S4680 V1180(main\()S1440(argc,)S1664(argv)S1868(\))S4800 V1180(int)S1311(argc;)S4920 V1180(char)S1379(**argv;)S5040 V1280({)S5160 V1280(++argv,)S1623(--argc;)S1943(/*)S2046(skip)S2238(over)S2442(program)S2808(name)S3051(*/)S5280 V1280(if)S1367(\()S1426(argc)S1625(>)S1707(0)S1782(\))S5400 V1480(yyin)S1683(=)S1765(fopen\()S2053(argv[0],)S2400("r")S2541(\);)S5520 V1280(else)S5640 V1480(yyin)S1683(=)S1765(stdin;)S5880 V1280(yylex\(\);)S6000 V1280(})S6240 V1080(This)S1294(is)S1396(the)S1554(beginnings)S2029(of)S2148(a)S2229(simple)S2533(scanner)S2877(for)S3031(a)S(language)363 3112 A3511(like)S3698(Pascal.)S4042(It)S4140(identi\256es)S4545(different)S4929(types)S5177(of)S6360 V10 I1080(tokens)S10 R1362(and)S1532(reports)S1837(on)S1962(what)S2183(it)S2264(has)S2423(seen.)S6528 V1080(The)S1262(details)S1550(of)S1659(this)S1829(example)S(will)157 2195 A2377(be)S2497(explained)S2913(in)S3016(the)S3164(following)S3580(sections.)S6696 V9 R720(F)S722(FO)S774(OR)S842(RM)S904(MA)S986(AT)S1054(T)S1150(O)S1152(OF)S1220(F)S1310(T)S1312(TH)S1370(HE)S1438(E)S1534(I)S1536(IN)S1569(NP)S1637(PU)S1689(UT)S1757(T)S1853(F)S1855(FI)S1907(IL)S1940(LE)S1998(E)S6816 V10 R

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -