%!PS-Adobe-3.0 %%Creator: groff version 1.08 %%DocumentNeededResources: font Times-Bold %%+ font Times-Italic %%+ font Times-Roman %%+ font Symbol %%DocumentSuppliedResources: procset grops 1.08 0 %%Pages: 40 %%PageOrder: Ascend %%Orientation: Portrait %%EndComments %%BeginProlog %%BeginResource: procset grops 1.08 0 /setpacking where{ pop currentpacking true setpacking }if /grops 120 dict dup begin /SC 32 def /A/show load def /B{0 SC 3 -1 roll widthshow}bind def /C{0 exch ashow}bind def /D{0 exch 0 SC 5 2 roll awidthshow}bind def /E{0 rmoveto show}bind def /F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def /G{0 rmoveto 0 exch ashow}bind def /H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /I{0 exch rmoveto show}bind def /J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def /K{0 exch rmoveto 0 exch ashow}bind def /L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /M{rmoveto show}bind def /N{rmoveto 0 SC 3 -1 roll widthshow}bind def /O{rmoveto 0 exch ashow}bind def /P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /Q{moveto show}bind def /R{moveto 0 SC 3 -1 roll widthshow}bind def /S{moveto 0 exch ashow}bind def /T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def /SF{ findfont exch [exch dup 0 exch 0 exch neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /MF{ findfont [5 2 roll 0 3 1 roll neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /level0 0 def /RES 0 def /PL 0 def /LS 0 def /PLG{ gsave newpath clippath pathbbox grestore exch pop add exch pop }bind def /BP{ /level0 save def 1 setlinecap 1 setlinejoin 72 RES div dup scale LS{ 90 rotate }{ 0 PL translate }ifelse 1 -1 scale }bind def /EP{ level0 restore showpage }bind def /DA{ newpath arcn stroke }bind def /SN{ transform .25 sub exch .25 sub exch round .25 add exch round .25 add exch itransform }bind def /DL{ SN moveto SN lineto stroke }bind def /DC{ newpath 0 360 arc closepath }bind def /TM matrix def /DE{ TM currentmatrix pop translate scale newpath 0 0 .5 0 360 arc closepath TM setmatrix }bind def /RC/rcurveto load def /RL/rlineto load def /ST/stroke load def /MT/moveto load def /CL/closepath load def /FL{ currentgray exch setgray fill setgray }bind def /BL/fill load def /LW/setlinewidth load def /RE{ findfont dup maxlength 1 index/FontName known not{1 add}if dict begin { 1 index/FID ne{def}{pop pop}ifelse }forall /Encoding exch def dup/FontName exch def currentdict end definefont pop }bind def /DEFS 0 def /EBEGIN{ moveto DEFS begin }bind def /EEND/end load def /CNT 0 def /level1 0 def /PBEGIN{ /level1 save def translate div 3 1 roll div exch scale neg exch neg exch translate 0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit []0 setdash /setstrokeadjust where{ pop false setstrokeadjust }if /setoverprint where{ pop false setoverprint }if newpath /CNT countdictstack def userdict begin /showpage{}def }bind def /PEND{ clear countdictstack CNT sub{end}repeat level1 restore }bind def end def /setpacking where{ pop setpacking }if %%EndResource %%IncludeResource: font Times-Bold %%IncludeResource: font Times-Italic %%IncludeResource: font Times-Roman %%IncludeResource: font Symbol grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron/scaron/zcaron /Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/space /exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright/parenleft /parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four /five/six/seven/eight/nine/colon/semicolon/less/equal/greater/question/at/A/B/C /D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash /bracketright/circumflex/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q /r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase /guillemotleft/guillemotright/bullet/florin/fraction/perthousand/dagger /daggerdbl/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut /dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash /quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen/brokenbar /section/dieresis/copyright/ordfeminine/guilsinglleft/logicalnot/minus /registered/macron/degree/plusminus/twosuperior/threesuperior/acute/mu /paragraph/periodcentered/cedilla/onesuperior/ordmasculine/guilsinglright /onequarter/onehalf/threequarters/questiondown/Agrave/Aacute/Acircumflex/Atilde /Adieresis/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute /Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis /multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls /agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute /ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve /oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex /udieresis/yacute/thorn/ydieresis]def/Times-Roman@0 ENC0/Times-Roman RE /Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE %%EndProlog %%Page: 1 1 %%BeginPageSetup BP %%EndPageSetup /F0 12/Times-Bold@0 SF(Berk)208.518 123 Q(eley P)-.12 E(ascal User')-.12 E 3 (sM)-.444 G(anual)338.802 123 Q -1.2(Ve)226.164 138 S(rsion 3.1 \255 A)1.2 E (pril 1986)-.3 E/F1 10/Times-Italic@0 SF -.55(Wi)177.795 162 S(lliam N. J).55 E (oy\210, Susan L. Gr)-.25 E(aham, Charles B. Hale)-.15 E(y\210,)-.3 E(Mar) 192.82 174 Q(shall Kirk McK)-.1 E(usic)-.4 E(k, and P)-.2 E(eter B. K)-.8 E (essler\210)-.35 E/F2 10/Times-Roman@0 SF(Computer Science Di)232.85 192 Q (vision)-.25 E(Department of Electrical Engineering and Computer Science)166.36 204 Q(Uni)219.725 216 Q -.15(ve)-.25 G(rsity of California, Berk).15 E(ele)-.1 E(y)-.15 E(Berk)232.625 228 Q(ele)-.1 E 1.3 -.65(y, C)-.15 H 2.5 (alifornia 94720).65 F F1(ABSTRA)264.535 264 Q(CT)-.3 E F2(Berk)133 295.2 Q (ele)-.1 E 2.784(yP)-.15 G .283(ascal is designed for interacti)177.044 295.2 R .583 -.15(ve i)-.25 H .283(nstructional use and runs on the).15 F/F3 8 /Times-Roman@0 SF(PDP)2.783 E F2(/11)A(and)108 307.2 Q F3 -1.08(VA)3.965 G(X) 1.08 E F2 1.465(/11 computers.)B(Interpreti)6.465 E 1.765 -.15(ve c)-.25 H 1.466(ode is produced, pro).15 F 1.466(viding f)-.15 F 1.466 (ast translation at the)-.1 F -.15(ex)108 319.2 S 1.62(pense of slo).15 F 1.62 (wer e)-.25 F -.15(xe)-.15 G 1.619(cution speed.).15 F 1.619 (There is also a fully compatible compiler for the)6.619 F F3 -1.08(VA)108 331.2 S(X)1.08 E F2 4.191(/11. An)B -.15(exe)4.191 G 1.691 (cution pro\214ler and W).15 F(irth')-.4 E 4.191(sc)-.55 G 1.691 (ross reference program are also a)295.894 331.2 R -.25(va)-.2 G(ilable).25 E (with the system.)108 343.2 Q .24(The system supports full P)133 358.8 R 2.739 (ascal. The)-.15 F .239(language accepted is `standard' P)2.739 F .239 (ascal, and a)-.15 F .999(small number of e)108 370.8 R 3.499(xtensions. There) -.15 F .999(is an option to suppress the e)3.499 F 3.5(xtensions. The)-.15 F -.15(ex)3.5 G(ten-).15 E .247(sions include a separate compilation f)108 382.8 R .247(acility and the ability to link to object modules pro-)-.1 F (duced from other source languages.)108 394.8 Q(The)133 410.4 Q F1(User')2.881 E 2.881(sM)-.4 G(anual)188.902 410.4 Q F2(gi)2.881 E -.15(ve)-.25 G 2.881(sal) .15 G .381(ist of sources relating to the)248.255 410.4 R F3(UNIX)2.882 E F2 2.882<ae73>C .382(ystem, the P)398.226 410.4 R(ascal)-.15 E 1.385 (language, and the Berk)108 422.4 R(ele)-.1 E 3.884(yP)-.15 G 1.384 (ascal system.)230.058 422.4 R 1.384(Basic usage e)6.384 F 1.384 (xamples are pro)-.15 F 1.384(vided for the)-.15 F -.15(Pa)108 434.4 S (scal components).15 E F1(pi)2.5 E F2(,)A F1(px)2.5 E F2(,)A F1(pix)2.5 E F2(,) A F1(pc)2.5 E F2 2.5(,a)C(nd)250.05 434.4 Q .364 (Errors commonly encountered in these programs are discussed.)108 450 R .364 (Details are gi)5.364 F -.15(ve)-.25 G 2.865(no).15 G 2.865(fs)445.145 450 S (pe-)455.23 450 Q 1.004(cial considerations due to the interacti)133 462 R 1.304 -.15(ve i)-.25 H 3.504(mplementation. A).15 F 1.004(number of e)3.504 F (xamples)-.15 E .56(are pro)133 474 R .56(vided including man)-.15 F 3.06(yd) -.15 G .56(ealing with input/output.)257.7 474 R .56(An appendix supplements) 5.56 F -.4(Wi)133 486 S(rth').4 E(s)-.55 E F1 -.8(Pa)2.715 G .215(scal Report) .8 F F2 .215(to form the full de\214nition of the Berk)2.715 F(ele)-.1 E 2.715 (yi)-.15 G .215(mplementation of)396.955 486 R(the language.)133 498 Q/F4 10 /Times-Bold@0 SF(Intr)72 546 Q(oduction)-.18 E F2 .223(The Berk)97 561.6 R(ele) -.1 E 2.723(yP)-.15 G(ascal)159.256 561.6 Q F1(User')2.723 E 2.723(sM)-.4 G (anual)219.282 561.6 Q F2 .223(consists of \214v)2.723 F 2.723(em)-.15 G .223 (ajor sections and an appendix.)315.584 561.6 R .224(In section 1 we)5.223 F (gi)72 573.6 Q 1.18 -.15(ve s)-.25 H .88(ources of information about).15 F F3 (UNIX)3.38 E F2 3.38(,a)C .88(bout the programming language P)243.792 573.6 R .88(ascal, and about the Berk)-.15 F(ele)-.1 E(y)-.15 E .295 (implementation of the language.)72 585.6 R .295(Section 2 introduces the Berk) 5.295 F(ele)-.1 E 2.796(yi)-.15 G .296(mplementation and pro)349.096 585.6 R .296(vides a number)-.15 F .85(of tutorial e)72 597.6 R 3.35(xamples. Section) -.15 F 3.35(3d)3.35 G .85 (iscusses the error diagnostics produced by the translators)208.59 597.6 R F1 (pc)3.35 E F2(and)3.35 E F1(pi)3.35 E F2 3.35(,a)C(nd)494 597.6 Q .774 (the runtime interpreter)72 609.6 R F1(px)3.274 E F2 5.774(.S)C .775 (ection 4 describes input/output with special attention gi)190.076 609.6 R -.15 (ve)-.25 G 3.275(nt).15 G 3.275(of)436.975 609.6 S .775(eatures of the)448.58 609.6 R(interacti)72 621.6 Q .34 -.15(ve i)-.25 H .04 (mplementation and to features unique to).15 F F3(UNIX)2.539 E F2 5.039(.S)C .039(ection 5 gi)316.328 621.6 R -.15(ve)-.25 G 2.539(sd).15 G .039 (etails on the components of the)379.095 621.6 R .474(system and e)72 633.6 R .474(xplanation of all rele)-.15 F -.25(va)-.25 G .474(nt options.).25 F(The) 5.474 E F1(User')2.974 E 2.974(sM)-.4 G(anual)322.126 633.6 Q F2 .474 (concludes with an appendix to W)2.974 F(irth')-.4 E(s)-.55 E F1 -.8(Pa)72 645.6 S(scal Report).8 E F2 (with which it forms a precise de\214nition of the implementation.)2.5 E .32 LW 144 676.4 72 676.4 DL F3(Cop)72 688.2 Q(yright 1977, 1979, 1980, 1983 W)-.08 E 2(.N)-.736 G 2(.J)200.96 688.2 S -.08(oy)208.072 688.2 S 2(,S)-.44 G 2(.L) 223.92 688.2 S 2(.G)232.808 688.2 S(raham, C. B. Hale)242.584 688.2 Q 1.04 -.52 (y, M)-.12 H 2(.K).52 G 2(.M)324.6 688.2 S(cK)335.712 688.2 Q(usick, P)-.12 E 2 (.B)-.888 G 2(.K)378.704 688.2 S(essler)388.28 688.2 Q(\210Author')72 700 Q 2.882(sc)-.44 G .882(urrent addresses: W)110.434 700 R .881(illiam Jo)-.32 F .881(y: Sun Microsystems, 2550 Garcia A)-.08 F -.12(ve)-.592 G .881 (., Mountain V).12 F(ie)-.48 E 1.921 -.52(w, C)-.2 H 2.881(A9).52 G(4043;) 413.776 700 Q .179(Charles Hale)72 710 R .18 (y: S & B Associates, 1110 Centennial A)-.12 F -.12(ve)-.592 G .18(., Piscata) .12 F -.08(wa)-.12 G 1.22 -.52(y, N).08 H 4.18(J0).52 G .18(8854; Peter K) 313.288 710 R .18(essler: Xerox Research)-.2 F -.12(Pa)72 720 S(rk, P).12 E (alo Alto, CA)-.12 E EP %%Page: 2 2 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 269.65(PSD:7-2 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q/F1 10/Times-Bold@0 SF (History of the implementation)72 84 Q F0 .01(The \214rst Berk)97 99.6 R(ele) -.1 E 2.51(ys)-.15 G .01(ystem w)175.38 99.6 R .01(as written by K)-.1 F .01 (en Thompson in early 1976.)-.25 F .01(The main features of the pre-)5.01 F 1.037(sent system were implemented by Charles Hale)72 111.6 R 3.537(ya)-.15 G 1.037(nd W)281.019 111.6 R 1.038(illiam Jo)-.4 F 3.538(yd)-.1 G 1.038 (uring the latter half of 1976.)352.802 111.6 R(Earlier)6.038 E -.15(ve)72 123.6 S(rsions of this system ha).15 E .3 -.15(ve b)-.2 H (een in use since January).15 E 2.5(,1)-.65 G(977.)297.76 123.6 Q .895 (The system w)97 139.2 R .895(as mo)-.1 F -.15(ve)-.15 G 3.395(dt).15 G 3.395 (ot)199.06 139.2 S(he)210.235 139.2 Q/F2 8/Times-Roman@0 SF -1.08(VA)3.395 G(X) 1.08 E F0 .895(-11 by Peter K)B .895(essler and Kirk McK)-.25 F .894 (usick with the porting of the)-.15 F(interpreter in the spring of 1979, and t\ he implementation of the compiler in the summer of 1980.)72 151.2 Q F1 2.5 (1. Sour)72 175.2 R(ces of inf)-.18 E(ormation)-.25 E F0 .429 (This section lists the resources a)97 190.8 R -.25(va)-.2 G .429 (ilable for information about general features of).25 F F2(UNIX)2.929 E F0 2.93 (,t)C -.15(ex)458.72 190.8 S 2.93(te).15 G(diting,)478.16 190.8 Q 1.339(the P) 72 202.8 R 1.339(ascal language, and the Berk)-.15 F(ele)-.1 E 3.839(yP)-.15 G 1.338(ascal implementation, concluding with a list of references.)239.174 202.8 R(The)6.338 E -.2(av)72 214.8 S .498(ailable documents include both so-called \ standard documents \255 those distrib)-.05 F .498(uted with all)-.2 F F2(UNIX) 2.998 E F0 .498(system \255)2.998 F (and documents \(such as this one\) written at Berk)72 226.8 Q(ele)-.1 E -.65 (y.)-.15 G F1 2.5(1.1. Wher)72 250.8 R 2.5(et)-.18 G 2.5(og)126.53 250.8 S (et documentation)139.03 250.8 Q F0 .581(Current documentation for most of the) 97 266.4 R F2(UNIX)3.081 E F0 .581(system is a)3.081 F -.25(va)-.2 G .58 (ilable `).25 F .58(`on line')-.74 F 3.08('a)-.74 G 3.08(ty)406.99 266.4 S .58 (our terminal.)417.85 266.4 R(Details)5.58 E (on getting such documentation interacti)72 278.4 Q -.15(ve)-.25 G(ly are gi) .15 E -.15(ve)-.25 G 2.5(ni).15 G 2.5(ns)291.45 278.4 S(ection 1.3.)302.84 278.4 Q F1 2.5(1.2. Documentation)72 302.4 R(describing UNIX)2.5 E F0 .842 (The follo)97 318 R .843(wing documents are those recommended as tutorial and \ reference material about the)-.25 F F2(UNIX)3.343 E F0 3.587(system. W)72 330 R 3.587(eg)-.8 G -2.15 -.25(iv e)130.034 330 T 1.086(the documents with the intr\ oductory and tutorial materials \214rst, the reference materials)3.837 F(last.) 72 342 Q F1(UNIX F)72 366 Q(or Beginners \255 Second Edition)-.25 E F0 (This document is the basic tutorial for)97 381.6 Q F2(UNIX)2.5 E F0 -.2(av)2.5 G(ailable with the standard system.)-.05 E F1(Communicating with UNIX)72 405.6 Q F0 .162(This is also a basic tutorial on the system and assumes no pre)97 421.2 R .162(vious f)-.25 F .162(amiliarity with computers; it w)-.1 F(as)-.1 E (written at Berk)72 433.2 Q(ele)-.1 E -.65(y.)-.15 G F1(An intr)72 457.2 Q (oduction to the C shell)-.18 E F0 .102(This document introduces)97 472.8 R/F3 10/Times-Italic@0 SF(csh,)2.602 E F0 .101(the shell in common use at Berk)2.601 F(ele)-.1 E 1.401 -.65(y, a)-.15 H .101(nd pro).65 F .101 (vides a good deal of gen-)-.15 F .158(eral description about the w)72 484.8 R .159(ay in which the system functions.)-.1 F .159(It pro)5.159 F .159 (vides a useful glossary of terms used in)-.15 F(discussing the system.)72 496.8 Q F1(UNIX Pr)72 520.8 Q(ogrammer')-.18 E 2.5(sM)-.37 G(anual)174.19 520.8 Q F0 .7(This manual is the major source of details on the components of the)97 536.4 R F2(UNIX)3.2 E F0 3.2(system. It)3.2 F .699(consists of an)3.2 F .349 (Introduction, a permuted inde)72 548.4 R .349(x, and eight command sections.) -.15 F .35(Section 1 consists of descriptions of most of)5.349 F .088(the `)72 560.4 R(`commands')-.74 E 2.588('o)-.74 G(f)149.566 560.4 Q F2(UNIX)2.588 E F0 5.088(.M)C .088(ost of the other sections ha)191.954 560.4 R .387 -.15(ve l)-.2 H .087(imited rele).15 F -.25(va)-.25 G .087(nce to the user of Berk).25 F(ele) -.1 E 2.587(yP)-.15 G(ascal,)481.51 560.4 Q (being of interest mainly to system programmers.)72 572.4 Q(U)97 588 Q F2(NIX)A F0 .284(documentation often refers the reader to sections of the manual.)2.784 F .285(Such a reference consists of a)5.285 F .228 (command name and a section number or name.)72 600 R .227(An e)5.227 F .227 (xample of such a reference w)-.15 F .227(ould be:)-.1 F F3(ed)2.727 E F0 2.727 (\(1\). Here)2.727 F F3(ed)2.727 E F0 .015(is a command name \255 the standard) 72 612 R F2(UNIX)2.516 E F0(te)2.516 E .016(xt editor)-.15 F 2.516(,a)-.4 G .016(nd `\(1\)' indicates that its documentation is in section 1)285.816 612 R (of the manual.)72 624 Q .347(The pieces of the Berk)97 639.6 R(ele)-.1 E 2.847 (yP)-.15 G .347(ascal system are)213.586 639.6 R F3(pi)2.847 E F0(\(1\),)2.847 E F3(px)2.847 E F0 .347(\(1\), the combined P)2.847 F .347 (ascal translator and inter)-.15 F(-)-.2 E(preti)72 651.6 Q .3 -.15(ve exe)-.25 H(cutor).15 E F3(pix)2.5 E F0(\(1\), the P)2.5 E(ascal compiler)-.15 E F3(pc) 2.5 E F0(\(1\), the P)2.5 E(ascal e)-.15 E -.15(xe)-.15 G(cution pro\214ler).15 E(\(1\), and the P)72 667.2 Q(ascal cross-reference generator)-.15 E F3(pxr)2.5 E(ef)-.37 E F0(\(1\).)2.5 E .349(It is possible to obtain a cop)97 682.8 R 2.849(yo)-.1 G 2.849(fam)224.063 682.8 S .349(anual section by using the) 245.311 682.8 R F3(man)2.849 E F0 .349(\(1\) command.)2.849 F 1.949 -.8(To g) 5.349 H .349(et the P).8 F(ascal)-.15 E (documentation just described one could issue the command:)72 694.8 Q(%)108 712.8 Q F1(man pi)2.5 E F0 1.46(to the shell.)72 730.8 R 1.46 (The user input here is sho)6.46 F 1.46(wn in)-.25 F F1 1.46(bold face)3.96 F F0 3.96(;t)C 1.46(he `% ', which w)315.37 730.8 R 1.46 (as printed by the shell as a)-.1 F EP %%Page: 3 3 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7-3)469.55 48 Q(prompt, is not.)72 84 Q (Similarly the command:)5 E(%)108 102 Q/F1 10/Times-Bold@0 SF(man man)2.5 E F0 (asks the)72 120 Q/F2 10/Times-Italic@0 SF(man)2.5 E F0 (command to describe itself.)2.5 E F1 2.5(1.3. T)72 144 R (ext editing documents)-.92 E F0 .301(The follo)97 159.6 R .301 (wing documents introduce the v)-.25 F(arious)-.25 E/F3 8/Times-Roman@0 SF (UNIX)2.801 E F0(te)2.801 E .301(xt editors.)-.15 F .301(Most Berk)5.301 F(ele) -.1 E 2.802(yu)-.15 G .302(sers use a v)432.984 159.6 R(ersion)-.15 E .742 (of the te)72 171.6 R .742(xt editor)-.15 F F2 -.2(ex)3.242 G(;).2 E F0(either) 3.242 E F2(edit,)3.242 E F0 .741(which is a v)3.242 F .741(ersion of)-.15 F F2 -.2(ex)3.241 G F0 .741(for ne)3.441 F 3.241(wa)-.25 G .741(nd casual users,) 345.993 171.6 R F2 -.2(ex)3.241 G F0 .741(itself, or)3.441 F F2(vi)3.241 E F0 (\(visual\))3.241 E(which focuses on the display editing portion of)72 183.6 Q F2 -.2(ex)2.5 G(.).2 E F1 2.5(AT)72 207.6 S(utorial Intr)87.47 207.6 Q (oduction to the UNIX T)-.18 E(ext Editor)-.92 E F0 .765 (This document, written by Brian K)97 223.2 R .765 (ernighan of Bell Laboratories, is a tutorial for the standard)-.25 F F3(UNIX) 3.266 E F0(te)72 235.2 Q .185(xt editor)-.15 F F2(ed.)2.685 E F0 .185 (It introduces you to the basics of te)5.185 F .185(xt editing, and pro)-.15 F .185(vides enough information to meet day-)-.15 F(to-day editing needs, for)72 247.2 Q F2(ed)2.5 E F0(users.)2.5 E F1(Edit: A tutorial)72 271.2 Q F0 .214 (This introduces the use of)97 286.8 R F2(edit,)2.714 E F0 .214 (an editor similar to)2.714 F F2(ed)2.714 E F0 .215(which pro)2.715 F .215 (vides a more hospitable en)-.15 F(vironment)-.4 E(for be)72 298.8 Q (ginning users.)-.15 E F1(Ex/edit Command Summary)72 322.8 Q F0 .132 (This summarizes the features of the editors)97 338.4 R F2 -.2(ex)2.632 G F0 (and)2.832 E F2(edit)2.632 E F0 .132(in a concise form.)2.632 F .132(If you ha) 5.132 F .432 -.15(ve u)-.2 H .132(sed a line ori-).15 F (ented editor before this summary alone may be enough to get you started.)72 350.4 Q F1(Ex Refer)72 374.4 Q(ence Manual \255 V)-.18 E(ersion 3.7)-1 E F0 2.5 (Ac)97 390 S(omplete reference on the features of)111.16 390 Q F2 -.2(ex)2.5 G F0(and)2.7 E F2(edit.)2.5 E F1(An Intr)72 414 Q (oduction to Display Editing with V)-.18 E(i)-.37 E F2 -.74(Vi)97 429.6 S F0 .302(is a display oriented te)3.542 F .302(xt editor)-.15 F 5.302(.I)-.55 G 2.802(tc)243.494 429.6 S .302(an be used on most an)253.516 429.6 R(y)-.15 E F3 (CR)2.803 E(T)-.48 E F0 .303(terminal, and uses the screen as a)2.803 F(windo) 72 441.6 Q 2.537(wi)-.25 G .037(nto the \214le you are editing.)109.287 441.6 R .037(Changes you mak)5.037 F 2.537(et)-.1 G 2.537(ot)303.67 441.6 S .037 (he \214le are re\215ected in what you see.)313.987 441.6 R .037(This man-) 5.037 F(ual serv)72 453.6 Q(es both as an introduction to editing with)-.15 E F2(vi)2.5 E F0(and a reference manual.)2.5 E F1 .74 -.37(Vi Q)72 477.6 T (uick Refer).37 E(ence)-.18 E F0 .152 (This reference card is a handy quick guide to)97 493.2 R F2(vi;)2.653 E F0 .153(you should get one when you get the introduction to)2.653 F F2(vi.)72 505.2 Q F1 2.5(1.4. P)72 529.2 R(ascal documents \255 The language)-.1 E F0 .087(This section describes the documents on the P)97 544.8 R .086 (ascal language which are lik)-.15 F .086(ely to be most useful to the)-.1 F (Berk)72 556.8 Q(ele)-.1 E 2.5(yP)-.15 G(ascal user)115.76 556.8 Q 5(.C)-.55 G (omplete references for these documents are gi)168.53 556.8 Q -.15(ve)-.25 G 2.5(ni).15 G 2.5(ns)371.68 556.8 S(ection 1.7.)383.07 556.8 Q F1 -.1(Pa)72 580.8 S(scal User Manual).1 E F0 .618(By Kathleen Jensen and Niklaus W)97 596.4 R .618(irth, the)-.4 F F2 .618(User Manual)3.118 F F0(pro)3.118 E .618 (vides a tutorial introduction to the fea-)-.15 F .022(tures of the language P) 72 608.4 R .021(ascal, and serv)-.15 F .021(es as an e)-.15 F .021 (xcellent quick-reference to the language.)-.15 F .021(The reader with no)5.021 F -.1(fa)72 620.4 S .46(miliarity with Algol-lik).1 F 2.96(el)-.1 G .46 (anguages may prefer one of the P)184.57 620.4 R .461(ascal te)-.15 F .461 (xt books listed belo)-.15 F 1.761 -.65(w, a)-.25 H 2.961(st).65 G(he)456.349 620.4 Q 2.961(yp)-.15 G(ro)478.6 620.4 Q(vide)-.15 E .459(more e)72 632.4 R .459(xamples and e)-.15 F 2.959(xplanation. P)-.15 F .458 (articularly important here are pages 116-118 which de\214ne the syntax of)-.15 F(the language.)72 644.4 Q(Sections 13 and 14 and Appendix F pertain only to t\ he 6000-3.4 implementation of P)5 E(ascal.)-.15 E F1 -.1(Pa)72 668.4 S (scal Report).1 E F0 1.454(By Niklaus W)97 684 R 1.454 (irth, this document is bound with the)-.4 F F2 1.454(User Manual.)3.954 F F0 1.455(It is the guiding reference for)6.455 F .345 (implementors and the fundamental de\214nition of the language.)72 696 R .344 (Some programmers \214nd this report too con-)5.344 F (cise to be of practical use, preferring the)72 708 Q F2(User Manual)2.5 E F0 (as a reference.)2.5 E EP %%Page: 4 4 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 269.65(PSD:7-4 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q/F1 10/Times-Bold@0 SF(Books on P)72 84 Q (ascal)-.1 E F0(Se)97 99.6 Q -.15(ve)-.25 G .162(ral good books which teach P) .15 F .162(ascal or use it as a medium are a)-.15 F -.25(va)-.2 G 2.662 (ilable. The).25 F .163(books by W)2.663 F(irth)-.4 E/F2 10/Times-Italic@0 SF (Sys-)2.663 E .932(tematic Pr)72 111.6 R -.1(og)-.45 G -.15(ra).1 G(mming).15 E F0(and)3.432 E F2(Algorithms)3.432 E/F3 10/Symbol SF(+)3.432 E F2 .931 (Data Structur)3.432 F(es)-.37 E F3(=)3.431 E F2(Pr)3.431 E -.1(og)-.45 G -.15 (ra).1 G(ms).15 E F0 .931(use P)3.431 F .931(ascal as a v)-.15 F .931 (ehicle for teaching)-.15 F .457 (programming and data structure concepts respecti)72 123.6 R -.15(ve)-.25 G(ly) .15 E 5.457(.T)-.65 G(he)303.641 123.6 Q 2.957(ya)-.15 G .457 (re both recommended.)325.328 123.6 R .457(Other books on P)5.457 F(as-)-.15 E (cal are listed in the references belo)72 135.6 Q -.65(w.)-.25 G F1 2.5(1.5. P) 72 159.6 R(ascal documents \255 The Berk)-.1 E(eley Implementation)-.1 E F0 .477(This section describes the documentation which is a)97 175.2 R -.25(va)-.2 G .477(ilable describing the Berk).25 F(ele)-.1 E 2.977(yi)-.15 G (mplementation)444 175.2 Q(of P)72 187.2 Q(ascal.)-.15 E F1(User')72 211.2 Q 2.5(sM)-.37 G(anual)110.78 211.2 Q F0 .038(The document you are reading is the) 97 226.8 R F2(User')2.539 E 2.539(sM)-.4 G(anual)282.979 226.8 Q F0 .039 (for Berk)2.539 F(ele)-.1 E 2.539(yP)-.15 G 2.539(ascal. W)366.296 226.8 R 2.539(eo)-.8 G .039(ften refer the reader to)414.444 226.8 R(the Jensen-W)72 238.8 Q(irth)-.4 E F2(User Manual)2.5 E F0(mentioned abo)2.5 E -.15(ve)-.15 G 2.5(,ad).15 G(if)282.93 238.8 Q(ferent document with a similar name.)-.25 E F1 (Manual sections)72 262.8 Q F0 .587(The sections relating to P)97 278.4 R .586 (ascal in the)-.15 F F2 .586(UNIX Pr)3.086 F -.1(og)-.45 G -.15(ra).1 G(mmer') .15 E 3.086(sM)-.4 G(anual)345.716 278.4 Q F0(are)3.086 E F2(pix)3.086 E F0 (\(1\),)3.086 E F2(pi)3.086 E F0(\(1\),)3.086 E F2(pc)3.086 E F0(\(1\),)3.086 E F2(px)3.086 E F0(\(1\),)3.086 E F2(pxp)72 290.4 Q F0 .224(\(1\), and)2.724 F F2 (pxr)2.724 E(ef)-.37 E F0 2.724(\(1\). These)2.724 F .224(sections gi)2.724 F .524 -.15(ve a d)-.25 H .225(escription of each program, summarize the a).15 F -.25(va)-.2 G .225(ilable options,).25 F .373 (indicate \214les used by the program, gi)72 302.4 R .673 -.15(ve b)-.25 H .373 (asic information on the diagnostics produced and include a list of).15 F(kno) 72 314.4 Q(wn b)-.25 E(ugs.)-.2 E F1(Implementation notes)72 338.4 Q F0 -.15 (Fo)97 354 S 3.477(rt).15 G .977(hose interested in the internal or)116.997 354 R -.05(ga)-.18 G .977(nization of the Berk).05 F(ele)-.1 E 3.478(yP)-.15 G .978 (ascal system there are a series of)367.622 354 R F2 1.08(Implementation Notes) 72 366 R F0 1.08(describing these details.)3.58 F(The)6.08 E F2(Berk)3.58 E (ele)-.1 E 3.58(yP)-.3 G 1.08(ascal PXP Implementation Notes)331.37 366 R F0 (describe)3.58 E .988(the P)72 378 R .989(ascal interpreter)-.15 F F2(px)3.489 E F0 3.489(;a)1.666 G .989(nd the)183.551 378 R F2(Berk)3.489 E(ele)-.1 E 3.489 (yP)-.3 G .989(ascal PX Implementation Notes)256.128 378 R F0 .989 (describe the structure of the)3.489 F -.15(exe)72 390 S(cution pro\214ler).15 E F2(pxp)2.5 E F0(.)A F1 2.5(1.6. Refer)72 414 R(ences)-.18 E(UNIX Documents)72 438 Q F2(Communicating W)97 465.6 Q(ith UNIX)-.55 E F0(Computer Center)97 477.6 Q(Uni)97 489.6 Q -.15(ve)-.25 G(rsity of California, Berk).15 E(ele)-.1 E(y) -.15 E(January)97 501.6 Q 2.5(,1)-.65 G(978.)137.45 501.6 Q (Ricki Blau and James Jo)97 529.2 Q(yce)-.1 E F2(Edit: a tutorial)97 541.2 Q F0 (UNIX User')97 553.2 Q 2.5(sS)-.55 G(upplementary Documents \(USD\), 14)158.1 553.2 Q(Uni)97 565.2 Q -.15(ve)-.25 G(rsity of California, Berk).15 E(ele)-.1 E 1.3 -.65(y, C)-.15 H(A. 94720).65 E(April, 1986.)97 577.2 Q F2 (Ex/edit Command Summary)97 604.8 Q F0(Computer Center)97 616.8 Q(Uni)97 628.8 Q -.15(ve)-.25 G(rsity of California, Berk).15 E(ele)-.1 E(y)-.15 E (August, 1978.)97 640.8 Q -.4(Wi)97 668.4 S(lliam Jo).4 E(y)-.1 E F2(Ex Refer) 97 680.4 Q(ence Manual \255 V)-.37 E(er)-1.11 E(sion 3.7)-.1 E F0(UNIX User')97 692.4 Q 2.5(sS)-.55 G(upplementary Documents \(USD\), 16)158.1 692.4 Q(Uni)97 704.4 Q -.15(ve)-.25 G(rsity of California, Berk).15 E(ele)-.1 E 1.3 -.65(y, C) -.15 H(A. 94720).65 E(April, 1986.)97 716.4 Q EP %%Page: 5 5 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7-5)469.55 48 Q -.4(Wi)97 84 S (lliam Jo).4 E(y)-.1 E/F1 10/Times-Italic@0 SF(An Intr)97 96 Q (oduction to Display Editing with V)-.45 E(i)-.74 E F0(UNIX User')97 108 Q 2.5 (sS)-.55 G(upplementary Documents \(USD\), 15)158.1 108 Q(Uni)97 120 Q -.15(ve) -.25 G(rsity of California, Berk).15 E(ele)-.1 E 1.3 -.65(y, C)-.15 H(A. 94720) .65 E(April, 1986.)97 132 Q -.4(Wi)97 159.6 S(lliam Jo).4 E(y)-.1 E F1(An Intr) 97 171.6 Q(oduction to the C shell \(Re)-.45 E(vised\))-.15 E F0(UNIX User')97 183.6 Q 2.5(sS)-.55 G(upplementary Documents \(USD\), 4)158.1 183.6 Q(Uni)97 195.6 Q -.15(ve)-.25 G(rsity of California, Berk).15 E(ele)-.1 E 1.3 -.65(y, C) -.15 H(A. 94720).65 E(April, 1986.)97 207.6 Q(Brian W)97 235.2 Q 2.5(.K)-.92 G (ernighan)142.21 235.2 Q F1(UNIX for Be)97 247.2 Q(ginner)-.4 E 2.5(s\255S)-.1 G(econd Edition)193.8 247.2 Q F0(UNIX User')97 259.2 Q 2.5(sS)-.55 G (upplementary Documents \(USD\), 1)158.1 259.2 Q(Uni)97 271.2 Q -.15(ve)-.25 G (rsity of California, Berk).15 E(ele)-.1 E 1.3 -.65(y, C)-.15 H(A. 94720).65 E (April, 1986.)97 283.2 Q(Brian W)97 310.8 Q 2.5(.K)-.92 G(ernighan)142.21 310.8 Q F1 2.5(AT)97 322.8 S(utorial Intr)110.62 322.8 Q(oduction to the UNIX T)-.45 E -.2(ex)-.92 G 2.5(tE).2 G(ditor)267.94 322.8 Q F0(UNIX User')97 334.8 Q 2.5 (sS)-.55 G(upplementary Documents \(USD\), 12)158.1 334.8 Q(Uni)97 346.8 Q -.15 (ve)-.25 G(rsity of California, Berk).15 E(ele)-.1 E 1.3 -.65(y, C)-.15 H (A. 94720).65 E(April, 1986.)97 358.8 Q(Dennis M. Ritchie and K)97 386.4 Q (en Thompson)-.25 E F1(The UNIX T)97 398.4 Q(ime Sharing System)-.55 E F0 (Reprinted from Communications of the A)97 410.4 Q(CM July 1974 in)-.4 E (UNIX Programmer')97 422.4 Q 2.5(sS)-.55 G(upplementary Documents, V)189.21 422.4 Q(olume 2 \(PS2\), 1)-1.29 E(Uni)97 434.4 Q -.15(ve)-.25 G (rsity of California, Berk).15 E(ele)-.1 E 1.3 -.65(y, C)-.15 H(A. 94720).65 E (April, 1986.)97 446.4 Q/F2 10/Times-Bold@0 SF -.1(Pa)72 470.4 S (scal Language Documents).1 E F0(Cooper and Clanc)97 498 Q(y)-.15 E F1(Oh! P)97 510 Q(ascal!, 2nd Edition)-.8 E F0 1.84 -.92(W. W. N)97 522 T(orton & Compan) .92 E 1.3 -.65(y, I)-.15 H(nc.).65 E(500 Fifth A)97 534 Q -.15(ve)-.74 G(., NY) .15 E 2.5(,N)-1.29 G 2.58 -1.29(Y. 1)185.09 534 T(0110)1.29 E(1985, 475 pp.)97 546 Q(Cooper)97 573.6 Q F1(Standar)97 585.6 Q 2.5(dP)-.37 G(ascal User Refer) 141.11 585.6 Q(ence Manual)-.37 E F0 1.84 -.92(W. W. N)97 597.6 T (orton & Compan).92 E 1.3 -.65(y, I)-.15 H(nc.).65 E(500 Fifth A)97 609.6 Q -.15(ve)-.74 G(., NY).15 E 2.5(,N)-1.29 G 2.58 -1.29(Y. 1)185.09 609.6 T(0110) 1.29 E(1983, 176 pp.)97 621.6 Q(Kathleen Jensen and Niklaus W)97 649.2 Q(irth) -.4 E F1 -.8(Pa)97 661.2 S(scal \255 User Manual and Report).8 E F0(Springer)97 673.2 Q(-V)-.2 E(erlag, Ne)-1.11 E 2.5(wY)-.25 G(ork.)192.92 673.2 Q (1975, 167 pp.)97 685.2 Q(Niklaus W)97 712.8 Q(irth)-.4 E F1(Algorithms)97 724.8 Q/F3 10/Symbol SF(+)2.5 E F1(Data structur)2.5 E(es)-.37 E F3(=)2.5 E F1 (Pr)2.5 E -.1(og)-.45 G -.15(ra).1 G(ms).15 E EP %%Page: 6 6 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 269.65(PSD:7-6 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q(Prentice-Hall, Ne)97 84 Q 2.5(wY)-.25 G (ork.)182.57 84 Q(1976, 366 pp.)97 96 Q/F1 10/Times-Bold@0 SF(Berk)72 120 Q (eley P)-.1 E(ascal documents)-.1 E F0 .623(The follo)97 135.6 R .623 (wing documents are a)-.25 F -.25(va)-.2 G .623 (ilable from the Computer Center Library at the Uni).25 F -.15(ve)-.25 G .622 (rsity of Cali-).15 F(fornia, Berk)72 147.6 Q(ele)-.1 E -.65(y.)-.15 G -.4(Wi) 97 175.2 S(lliam N. Jo).4 E(y)-.1 E/F2 10/Times-Italic@0 SF(Berk)97 187.2 Q (ele)-.1 E 2.5(yP)-.3 G(ascal PX Implementation Notes)139.39 187.2 Q F0 -1.11 (Ve)97 199.2 S(rsion 1.1, April 1979.)1.11 E(\(V)97 211.2 Q(ax-11 V)-1.11 E (ersion 2.0 By Kirk McK)-1.11 E(usick, December)-.15 E 2.5(,1)-.4 G(979\)) 311.96 211.2 Q -.4(Wi)97 238.8 S(lliam N. Jo).4 E(y)-.1 E F2(Berk)97 250.8 Q (ele)-.1 E 2.5(yP)-.3 G(ascal PXP Implementation Notes)139.39 250.8 Q F0 -1.11 (Ve)97 262.8 S(rsion 1.1, April 1979.)1.11 E F1 2.5(2. Basic)72 286.8 R(UNIX P) 2.5 E(ascal)-.1 E F0 .198(The follo)97 302.4 R .198(wing sections e)-.25 F .198 (xplain the basics of using Berk)-.15 F(ele)-.1 E 2.698(yP)-.15 G 2.698 (ascal. In)344.902 302.4 R -.15(ex)2.698 G .198(amples here we use the te).15 F (xt)-.15 E(editor)72 314.4 Q F2 -.2(ex)2.619 G F0 2.619(\(1\). Users)2.819 F .119(of the te)2.619 F .119(xt editor)-.15 F F2(ed)2.619 E F0 .118(should ha) 2.618 F .418 -.15(ve l)-.2 H .118(ittle trouble follo).15 F .118(wing these e) -.25 F .118(xamples, as)-.15 F F2 -.2(ex)2.618 G F0 .118(is similar)2.818 F(to) 72 326.4 Q F2(ed)2.723 E F0 5.223(.W)C 2.723(eu)108.306 326.4 S(se)120.469 326.4 Q F2 -.2(ex)2.723 G F0 .223(because it allo)2.923 F .222(ws us to mak) -.25 F 2.722(ec)-.1 G .222(learer e)264.998 326.4 R 2.722(xamples.\207 The)-.15 F(ne)2.722 E(w)-.25 E/F3 8/Times-Roman@0 SF(UNIX)2.722 E F0 .222 (user will \214nd it helpful to)2.722 F(read one of the te)72 338.4 Q(xt edito\ r documents described in section 1.4 before continuing with this section.)-.15 E F1 2.5(2.1. A)72 362.4 R(\214rst pr)2.5 E(ogram)-.18 E F0 2.011 -.8(To p)97 378 T .411(repare a program for Berk).8 F(ele)-.1 E 2.911(yP)-.15 G .411 (ascal we \214rst need to ha)245.996 378 R .712 -.15(ve a)-.2 H 2.912(na).15 G .412(ccount on)372.656 378 R F3(UNIX)2.912 E F0 .412(and to `login' to)2.912 F .743(the system on this account.)72 390 R .742 (These procedures are described in the documents)5.742 F F2 .742 (Communicating with UNIX)3.242 F F0(and)72 402 Q F2(UNIX for Be)2.5 E(ginner) -.4 E(s)-.1 E F0(.)A .7(Once we are logged in we need to choose a name for our\ program; let us call it `\214rst' as this is the)97 417.6 R .363(\214rst e)72 429.6 R 2.863(xample. W)-.15 F 2.862(em)-.8 G .362 (ust also choose a name for the \214le in which the program will be stored.) 155.738 429.6 R .362(The Berk)5.362 F(ele)-.1 E(y)-.15 E -.15(Pa)72 441.6 S .347(scal system requires that programs reside in \214les which ha).15 F .648 -.15(ve n)-.2 H .348(ames ending with the sequence `.p' so we).15 F (will call our \214le `\214rst.p'.)72 453.6 Q 2.5(As)97 469.2 S (ample editing session to create this \214le w)110.61 469.2 Q(ould be)-.1 E (gin:)-.15 E(%)108 487.2 Q F1(ex \214rst.p)2.5 E F0("\214rst.p" [Ne)108 499.2 Q 2.5<778c>-.25 G(le])171.74 499.2 Q(:)108 511.2 Q 1.695 -.8(We d)72 529.2 T (idn').8 E 2.595(te)-.18 G .095(xpect the \214le to e)118.27 529.2 R .095 (xist, so the error diagnostic doesn')-.15 F 2.595(tb)-.18 G .095(other us.) 335.81 529.2 R .094(The editor no)5.095 F 2.594(wk)-.25 G(no)444.072 529.2 Q .094(ws the name)-.25 F .052(of the \214le we are creating.)72 541.2 R .052 (The `:' prompt indicates that it is ready for command input.)5.052 F 1.652 -.8 (We c)5.052 H .052(an add the te).8 F(xt)-.15 E (for our program using the `append' command as follo)72 553.2 Q(ws.)-.25 E(:) 108 571.2 Q F1(append)A(pr)108 583.2 Q(ogram \214rst\(output\))-.18 E(begin)108 595.2 Q(writeln\(\264Hello, w)133 607.2 Q(orld!\264\))-.1 E(end.)108 619.2 Q(.) 108 631.2 Q F0(:)108 643.2 Q .017(The line containing the single `)72 661.2 R F1(.)A F0 2.517('c)C .017(haracter here indicated the end of the appended te) 209.582 661.2 R 2.516(xt. The)-.15 F .016(`:' prompt indi-)2.516 F .095 (cates that)72 673.2 R F2 -.2(ex)2.595 G F0 .096(is ready for another command.) 2.795 F .096(As the editor operates in a temporary w)5.096 F .096 (ork space we must no)-.1 F(w)-.25 E .257(store the contents of this w)72 685.2 R .256(ork space in the \214le `\214rst.p' so we can use the P)-.1 F .256 (ascal translator and e)-.15 F -.15(xe)-.15 G(cutor).15 E F2(pix)2.756 E F0 (on it.)72 697.2 Q .32 LW 144 705.2 72 705.2 DL F3 2.435<8755>72 717 S .435 (sers with)84.211 717 R/F4 6/Times-Roman@0 SF(CR)2.436 E(T)-.36 E F3 .436 (terminals should \214nd the editor)2.436 F/F5 8/Times-Italic@0 SF(vi)2.436 E F3 .436(more pleasant to use; we do not sho)2.436 F 2.436(wi)-.2 G .436 (ts use here because)369.604 717 R(its display oriented nature mak)72 727 Q (es it dif)-.08 E(\214cult to illustrate.)-.2 E EP %%Page: 7 7 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7-7)469.55 48 Q(:)108 84 Q/F1 10 /Times-Bold@0 SF(write)A F0("\214rst.p" [Ne)108 96 Q 2.5<778c>-.25 G (le] 4 lines, 59 characters)171.74 96 Q(:)108 108 Q F1(quit)A F0(%)108 120 Q 2.283 -.8(We w)72 138 T .683(rote out the \214le from the edit b).8 F(uf)-.2 E .684(fer here with the `write' command, and)-.25 F/F2 10/Times-Italic@0 SF -.2 (ex)3.184 G F0 .684(indicated the number of)3.384 F (lines and characters written.)72 150 Q 1.6 -.8(We t)5 H(hen quit the editor).8 E 2.5(,a)-.4 G(nd no)289.64 150 Q 2.5(wh)-.25 G -2.25 -.2(av e)326.61 150 T 2.5 (ap)2.7 G(rompt from the shell.\210)354.58 150 Q 1.6 -.8(We a)97 165.6 T (re ready to try to translate and e).8 E -.15(xe)-.15 G(cute our program.).15 E (%)108 183.6 Q F1(pix \214rst.p)2.5 E F0(%)108 195.6 Q .302 (The translator \214rst printed a syntax error diagnostic.)97 217.2 R .302 (The number 2 here indicates that the rest of the)5.302 F .991 (line is an image of the second line of our program.)72 229.2 R .992 (The translator is saying that it e)5.991 F .992(xpected to \214nd a `;')-.15 F 1.307(before the k)72 241.2 R -.15(ey)-.1 G -.1(wo).15 G(rd).1 E F1(begin)3.807 E F0 1.307(on this line.)3.807 F 1.307(If we look at the P)6.307 F 1.306 (ascal syntax charts in the Jensen-W)-.15 F(irth)-.4 E F2(User)3.806 E(Manual) 72 253.2 Q F0 2.787(,o)C 2.787(ra)113.397 253.2 S 2.788(ts)123.954 253.2 S .288 (ome of the sample programs therein, we will see that we ha)133.412 253.2 R .588 -.15(ve o)-.2 H .288(mitted the terminating `;' of).15 F(the)72 265.2 Q F1 (pr)2.5 E(ogram)-.18 E F0(statement on the \214rst line of our program.)2.5 E 1.08(One other thing to notice about the error diagnostic is the letter `e' at\ the be)97 280.8 R 3.579(ginning. It)-.15 F 1.079(stands for)3.579 F .507 (`error', indicating that our input w)72 292.8 R .507(as not le)-.1 F -.05(ga) -.15 G 3.007(lP).05 G 3.007(ascal. The)266.416 292.8 R -.1(fa)3.007 G .507 (ct that it is an `e' rather than an `E' indicates).1 F 1.002 (that the translator managed to reco)72 304.8 R -.15(ve)-.15 G 3.502(rf).15 G 1.002(rom this error well enough that generation of code and e)234.892 304.8 R -.15(xe)-.15 G(cution).15 E 1.06(could tak)72 316.8 R 3.56(ep)-.1 G 3.56 (lace. Ex)122.9 316.8 R 1.06(ecution is possible whene)-.15 F -.15(ve)-.25 G 3.56(rn).15 G 3.56(of)285.12 316.8 S 1.06 (atal `E' errors occur during translation.)296.91 316.8 R 1.06(The other)6.06 F .6(classes of diagnostics are `w' w)72 328.8 R .6 (arnings, which do not necessarily indicate errors in the program, b)-.1 F .6 (ut point)-.2 F(out inconsistencies which are lik)72 340.8 Q (ely to be due to program b)-.1 E(ugs, and `s' standard-P)-.2 E (ascal violations.\207)-.15 E .444 (After completing the translation of the program to interpreti)97 356.4 R .744 -.15(ve c)-.25 H .444(ode, the P).15 F .445(ascal system indicates that)-.15 F -.15(exe)72 368.4 S .823(cution of the translated program be).15 F -.05(ga)-.15 G 3.323(n. The).05 F .823(output from the e)3.323 F -.15(xe)-.15 G .822 (cution of the program then appeared.).15 F .972(At program termination, the P) 72 380.4 R .973(ascal runtime system indicated the number of statements e)-.15 F -.15(xe)-.15 G .973(cuted, and the).15 F (amount of cpu time used, with the resolution of the latter being 1/60')72 392.4 Q(th of a second.)-.18 E .629(Let us no)97 408 R 3.129<778c>-.25 G 3.129 (xt)151.137 408 S .629 (he error in the program and translate it to a permanent object code \214le) 162.046 408 R F2(obj)3.129 E F0(using)3.129 E F2(pi)3.129 E F0(.)A(The program) 72 420 Q F2(pi)2.5 E F0(translates P)2.5 E(ascal programs b)-.15 E (ut stores the object code instead of e)-.2 E -.15(xe)-.15 G(cuting it\210.).15 E(%)108 438 Q F1(ex \214rst.p)2.5 E F0("\214rst.p" 4 lines, 59 characters)108 450 Q(:)108 462 Q F1 2.5(1p)C(rint)123.84 462 Q F0(program \214rst\(output\)) 108 474 Q(:)108 486 Q F1(s/$/;)A F0(program \214rst\(output\);)108 498 Q(:)108 510 Q F1(write)A F0("\214rst.p" 4 lines, 60 characters)108 522 Q(:)108 534 Q F1 (quit)A F0(%)108 546 Q F1(pi \214rst.p)2.5 E F0(%)108 558 Q(If we no)72 576 Q 2.5(wu)-.25 G(se the)119.79 576 Q/F3 8/Times-Roman@0 SF(UNIX)2.5 E F2(ls)2.5 E F0(list \214les command we can see what \214les we ha)2.5 E -.15(ve)-.2 G(:).15 E(%)108 594 Q F1(ls)2.5 E F0(\214rst.p)108 606 Q(obj)108 618 Q(%)108 630 Q (The \214le `obj' here contains the P)72 648 Q(ascal interpreter code.)-.15 E 1.6 -.8(We c)5 H(an e).8 E -.15(xe)-.15 G(cute this by typing:).15 E .32 LW 144 656 72 656 DL F3 2<884f>72 667.8 S(ur e)83.776 667.8 Q (xamples here assume you are using)-.12 E/F4 8/Times-Italic@0 SF(csh.)2 E F3 .681(\207The standard P)72 679.6 R .681(ascal w)-.12 F .681 (arnings occur only when the associated)-.08 F/F5 8/Times-Bold@0 SF(s)2.681 E F3 .682(translator option is enabled.)2.681 F(The)4.682 E F5(s)2.682 E F3 .682 (option is)2.682 F .054(discussed in sections 5.1 and A.6 belo)72 689.6 R 3.094 -.52(w. W)-.2 H .054 (arning diagnostics are discussed at the end of section 3.2, the associ-)-.12 F (ated)72 699.6 Q F5(w)2 E F3(option is described in section 5.2.)2 E .854 (\210This script indicates some other useful approaches to deb)72 711.4 R .855 (ugging P)-.16 F .855(ascal programs.)-.12 F .855(As in)4.855 F F4(ed)2.855 E F3 .855(we can shorten)2.855 F .012(commands in)72 721.4 R F4 -.16(ex)2.012 G F3 .012(to an initial pre\214x of the command name as we did with the)2.172 F F4(substitute)2.012 E F3 .012(command here.)2.012 F 1.292 -.64(We h)4.012 H -1.8 -.16(av e).64 H(also used the `!' shell escape command here to e)72 731.4 Q -.12(xe)-.12 G(cute other commands with a shell without lea).12 E (ving the editor)-.16 E(.)-.44 E EP %%Page: 8 8 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 269.65(PSD:7-8 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q(%)108 84 Q/F1 10/Times-Bold@0 SF(px obj)2.5 E F0(obj: No such \214le or directory)108 96 Q(%)108 108 Q(Alternati)72 126 Q -.15(ve)-.25 G(ly).15 E 2.5(,t)-.65 G(he command:)131.5 126 Q(%)108 144 Q F1 (obj)2.5 E F0(will ha)72 162 Q .3 -.15(ve t)-.2 H(he same ef).15 E 2.5 (fect. Some)-.25 F -.15(ex)2.5 G(amples of dif).15 E(ferent w)-.25 E(ays to e) -.1 E -.15(xe)-.15 G(cute the program follo).15 E -.65(w.)-.25 G(%)108 180 Q F1 (px)2.5 E F0(obj: No such \214le or directory)108 192 Q(%)108 204 Q F1(pi)2.5 E /F2 10/Symbol SF -5.488(--)2.5 G F1 2.5<708c>5.488 G(rst.p)148.782 204 Q F0(%) 108 216 Q F1(px obj)2.5 E F0(obj: No such \214le or directory)108 228 Q(%)108 240 Q F1(pix)2.5 E F2 -5.488(--)2.5 G F1 2.5<708c>5.488 G(rst.p)153.782 240 Q F0(obj: No such \214le or directory)108 252 Q(%)108 264 Q .027(Note that)97 285.6 R/F3 10/Times-Italic@0 SF(px)2.527 E F0 .027 (will assume that `obj' is the \214le we wish to e)2.527 F -.15(xe)-.15 G .028 (cute if we don').15 F 2.528(tt)-.18 G .028(ell it otherwise.)405.008 285.6 R .028(The last)5.028 F(tw)72 297.6 Q 2.977(ot)-.1 G .477(ranslations use the) 92.657 297.6 R F1<ad70>2.976 E F0 .476(no-post-mortem option to eliminate e) 2.976 F -.15(xe)-.15 G .476(cution statistics and `Ex).15 F .476(ecution be) -.15 F(gins')-.15 E .615(and `Ex)72 309.6 R .615(ecution terminated' messages.) -.15 F .615(See section 5.2 for more details.)5.615 F .616(If we no)5.616 F 3.116(wl)-.25 G .616(ook at the \214les in our)416.2 309.6 R (directory we will see:)72 321.6 Q(%)108 339.6 Q F1(ls)2.5 E F0(\214rst.p)108 351.6 Q(obj)108 363.6 Q(%)108 375.6 Q 1.613 -.8(We c)72 393.6 T .013(an gi).8 F .313 -.15(ve o)-.25 H .013 (ur object program a name other than `obj' by using the mo).15 F .312 -.15 (ve c)-.15 H(ommand).15 E F3(mv)2.512 E F0 2.512(\(1\). Thus)2.512 F .012 (to name)2.512 F(our program `hello':)72 405.6 Q(%)108 423.6 Q F1(mv obj hello) 2.5 E F0(%)108 435.6 Q F1(hello)2.5 E F0(Hello, w)108 447.6 Q(orld!)-.1 E(%)108 459.6 Q F1(ls)2.5 E F0(\214rst.p)108 471.6 Q(hello)108 483.6 Q(%)108 495.6 Q (Finally we can get rid of the P)72 513.6 Q(ascal object code by using the)-.15 E F3(rm)2.5 E F0(\(1\) remo)2.5 E .3 -.15(ve \214)-.15 H(le command, e.g.:).15 E(%)108 531.6 Q F1(rm hello)2.5 E F0(%)108 543.6 Q F1(ls)2.5 E F0(\214rst.p)108 555.6 Q(%)108 567.6 Q -.15(Fo)97 589.2 S 2.629(rs).15 G .129 (mall programs which are being de)117.259 589.2 R -.15(ve)-.25 G(loped).15 E F3 (pix)2.629 E F0 .129(tends to be more con)2.629 F -.15(ve)-.4 G .13 (nient to use than).15 F F3(pi)2.63 E F0(and)2.63 E F3(px)2.63 E F0(.)A .135 (Except for absence of the)72 601.2 R F3(obj)2.635 E F0 .135(\214le after a) 2.635 F F3(pix)2.635 E F0 .135(run, a)2.635 F F3(pix)2.635 E F0 .135 (command is equi)2.635 F -.25(va)-.25 G .135(lent to a).25 F F3(pi)2.634 E F0 .134(command follo)2.634 F .134(wed by)-.25 F(a)72 613.2 Q F3(px)3.158 E F0 3.158(command. F)3.158 F .658(or lar)-.15 F .658 (ger programs, where a number of runs testing dif)-.18 F .659 (ferent parts of the program are to)-.25 F(be made,)72 625.2 Q F3(pi)2.5 E F0 (is useful as this)2.5 E F3(obj)2.5 E F0(\214le can be e)2.5 E -.15(xe)-.15 G (cuted an).15 E 2.5(yd)-.15 G(esired number of times.)303.18 625.2 Q F1 2.5 (2.2. A)72 649.2 R(lar)2.5 E(ger pr)-.1 E(ogram)-.18 E F0 .734 (Suppose that we ha)97 664.8 R 1.034 -.15(ve u)-.2 H .734 (sed the editor to put a lar).15 F .734(ger program in the \214le `bigger)-.18 F 3.233(.p'. W)-.55 F 3.233(ec)-.8 G .733(an list this)461.414 664.8 R (program with line numbers by using the program)72 676.8 Q F3(cat)2.5 E F0 (-n i.e.:)A(%)108 694.8 Q F1(cat)2.5 E F2 -5.488(--)2.5 G F1 2.5(nb)5.488 G (igger)153.212 694.8 Q(.p)-1 E F0 10(1\()133 706.8 S F2(*)151.33 706.8 Q F0(2) 133 718.8 Q F2(*)153 718.8 Q F0(Graphic representation of a function)2.5 E(3) 133 730.8 Q F2(*)153 730.8 Q F0(f\(x\))168 730.8 Q F2(=)2.5 E F0 -.15(ex)2.5 G (p\().15 E F2(-)A F0(x\))A F2(*)2.5 E F0(sin\(2)2.5 E F2(*)2.5 E F0(pi)2.5 E F2 (*)2.5 E F0(x\))2.5 E EP %%Page: 9 9 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7)467.39 48 Q/F1 10/Symbol SF(-)A F0(9) A(4)133 84 Q F1(*)153 84 Q F0(\))A 10(5p)133 96 S(rogram graph1\(output\);)153 96 Q 10(6c)133 108 S(onst)152.44 108 Q 50(7d)133 120 S F1(=)195.5 120 Q F0 5 (0.0625; \()2.5 F F1(*)A F0(1/16, 16 lines for interv)2.5 E(al [x, x)-.25 E F1 (+)A F0(1])A F1(*)2.5 E F0(\))A 50(8s)133 132 S F1(=)194.39 132 Q F0 15(32; \() 2.5 F F1(*)A F0(32 character width for interv)2.5 E(al [x, x)-.25 E F1(+)A F0 (1])A 50(9h)133 144 S F1(=)195.5 144 Q F0 15(34; \()2.5 F F1(*)A F0 (Character position of x)2.5 E F1(-)A F0(axis)A F1(*)2.5 E F0(\))A 47.5(10 c) 128 156 R F1(=)2.5 E F0 2.5(6.28138; \()2.5 F F1(*)A F0(2)2.5 E F1(*)2.5 E F0 (pi)2.5 E F1(*)2.5 E F0(\))A 47.5(11 lim)128 168 R F1(=)2.5 E F0(32;)2.5 E 7.5 (12 v)128 180 R(ar)-.25 E 47.5(13 x,)128 192 R(y: real;)2.5 E 47.5(14 i,)128 204 R(n: inte)2.5 E(ger;)-.15 E 7.5(15 be)128 216 R(gin)-.15 E 47.5(16 for)128 228 R 2.5(i:)2.5 G F1(=)210.22 228 Q F0 2.5(0t)2.5 G 2.5(ol)228.49 228 S(im be) 238.77 228 Q(gin)-.15 E 87.5(17 x)128 240 R(:)2.5 E F1(=)A F0 2.5(d/i)2.5 G(;) 261.83 240 Q 87.5(18 y)128 252 R(:)2.5 E F1(=)A F0 -.15(ex)2.5 G(p\().15 E F1 (-)A F0(x9)A F1(*)2.5 E F0(sin\(i)2.5 E F1(*)2.5 E F0(x\);)2.5 E 87.5(19 n)128 264 R(:)2.5 E F1(=)A F0(Round\(s)2.5 E F1(*)2.5 E F0(y\))2.5 E F1(+)2.5 E F0 (h;)2.5 E 87.5(20 repeat)128 276 R 127.5(21 write\(\264)128 288 R<b4293b>2.5 E 127.5(22 n)128 300 R(:)2.5 E F1(=)A F0(n)2.5 E F1(-)2.5 E F0(1)2.5 E 87.5 (23 writeln\(\264)128 312 R F1(*)A F0<b429>A 7.5(24 end.)128 324 R(%)108 336 Q .615(This program is similar to program 4.9 on page 30 of the Jensen-W)72 354 R (irth)-.4 E/F2 10/Times-Italic@0 SF .615(User Manual)3.115 F F0 5.615(.A)C .615 (number of prob-)437.23 354 R(lems ha)72 366 Q .3 -.15(ve b)-.2 H (een introduced into this e).15 E(xample for pedagogical reasons.)-.15 E (If we attempt to translate and e)97 381.6 Q -.15(xe)-.15 G (cute the program using).15 E F2(pix)2.5 E F0(we get the follo)2.5 E (wing response:)-.25 E(%)108 399.6 Q/F3 10/Times-Bold@0 SF(pix bigger)2.5 E(.p) -1 E F0(%)108 411.6 Q .34(Since there were f)97 433.2 R .34 (atal `E' errors in our program, no code w)-.1 F .34(as generated and e)-.1 F -.15(xe)-.15 G .34(cution w).15 F .34(as necessar)-.1 F(-)-.2 E .023 (ily suppressed.)72 445.2 R .023(One thing which w)5.023 F .024 (ould be useful at this point is a listing of the program with the error mes-) -.1 F 2.5(sages. W)72 457.2 R 2.5(ec)-.8 G(an get this by using the command:) 121.18 457.2 Q(%)108 475.2 Q F3(pi)2.5 E F1 -5.488(--)2.5 G F3 2.5(lb)5.488 G (igger)146.002 475.2 Q(.p)-1 E F0 .052(There is no point in using)72 493.2 R F2 (pix)2.552 E F0 .052(here, since we kno)2.552 F 2.552(wt)-.25 G .052 (here are f)278.962 493.2 R .052(atal errors in the program.)-.1 F .052 (This command will)5.052 F .971(produce the output at our terminal.)72 505.2 R .971(If we are at a terminal which does not produce a hard cop)5.971 F 3.471 (yw)-.1 G 3.471(em)478.869 505.2 S(ay)494.56 505.2 Q (wish to print this listing of)72 517.2 Q(f-line on a line printer)-.25 E 5(.W) -.55 G 2.5(ec)280.95 517.2 S(an do this with the command:)292.33 517.2 Q(%)108 535.2 Q F3(pi)2.5 E F1 -5.488(--)2.5 G F3 2.5(lb)5.488 G(igger)146.002 535.2 Q (.p | lpr)-1 E F0 .126(In the ne)97 556.8 R .126(xt fe)-.15 F 2.626(ws)-.25 G .126(ections we will illustrate v)163.754 556.8 R .126 (arious aspects of the Berk)-.25 F(ele)-.1 E 2.625(yP)-.15 G .125 (ascal system by correcting)397.815 556.8 R(this program.)72 568.8 Q F3 2.5 (2.3. Corr)72 592.8 R(ecting the \214rst err)-.18 E(ors)-.18 E F0 1.502 (Most of the errors which occurred in this program were)97 608.4 R F2 (syntactic)4.002 E F0 1.502(errors, those in the format and)4.002 F .962 (structure of the program rather than its content.)72 620.4 R .961 (Syntax errors are \215agged by printing the of)5.961 F .961(fending line,)-.25 F .137(and then a line which \215ags the location at which an error w)72 632.4 R .137(as detected.)-.1 F .137(The \215ag line also gi)5.137 F -.15(ve)-.25 G 2.637(sa).15 G 2.637(ne)462.083 632.4 S(xplana-)474.01 632.4 Q .104 (tion stating either a possible cause of the error)72 644.4 R 2.604(,as)-.4 G .103(imple action which can be tak)272.88 644.4 R .103(en to reco)-.1 F -.15 (ve)-.15 G 2.603(rf).15 G .103(rom the error)451.034 644.4 R .116 (so as to be able to continue the analysis, a symbol which w)72 656.4 R .116 (as e)-.1 F .116(xpected at the point of error)-.15 F 2.617(,o)-.4 G 2.617(ra) 445.996 656.4 S 2.617(ni)456.383 656.4 S(ndication)466.78 656.4 Q .36 (that the input w)72 668.4 R .36(as `malformed'.)-.1 F .36 (In the last case, the reco)5.36 F -.15(ve)-.15 G .36 (ry may skip ahead in the input to a point where).15 F (analysis of the program can continue.)72 680.4 Q 1.11(In this e)97 696 R 1.11 (xample, the \214rst error diagnostic indicates that the translator detected a\ comment within a)-.15 F 3.285(comment. While)72 708 R .784 (this is not considered an error in `standard' P)3.285 F .784 (ascal, it usually corresponds to an error in)-.15 F 1.057 (the program which is being translated.)72 720 R 1.058(In this case, we ha) 6.057 F 1.358 -.15(ve a)-.2 H 1.058(ccidentally omitted the trailing `).15 F F1 (*)A F0 1.058(\)' of the)B EP %%Page: 10 10 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 264.65(PSD:7-10 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q(comment on line 8.)72 84 Q 1.6 -.8(We c)5 H (an be).8 E(gin an editor session to correct this problem by doing:)-.15 E(%) 108 102 Q/F1 10/Times-Bold@0 SF(ex bigger)2.5 E(.p)-1 E F0("bigger)108 114 Q (.p" 24 lines, 512 characters)-.55 E(:)108 126 Q F1(8s/$/)A/F2 10/Symbol SF -4.998(**)2.5 G F1(\))4.998 E F0(s)128 138 Q F2(=)2.5 E F0 15(32; \()2.5 F F2 (*)A F0(32 character width for interv)2.5 E(al [x, x)-.25 E F2(+)A F0(1])A F2 (*)2.5 E F0(\))A(:)108 150 Q 1.224(The second diagnostic, gi)97 171.6 R -.15 (ve)-.25 G 3.724(na).15 G 1.224(fter line 16, indicates that the k)225.086 171.6 R -.15(ey)-.1 G -.1(wo).15 G(rd).1 E F1(do)3.724 E F0 -.1(wa)3.724 G 3.724(se).1 G 1.224(xpected before the)427.692 171.6 R -.1(ke)72 183.6 S(yw) -.05 E(ord)-.1 E F1(begin)3.058 E F0 .558(in the)3.058 F F1 -.25(fo)3.058 G(r) .25 E F0 3.058(statement. If)3.058 F .558(we e)3.058 F .558(xamine the)-.15 F /F3 10/Times-Italic@0 SF(statement)3.058 E F0 .559 (syntax chart on page 118 of the Jensen-)3.058 F -.4(Wi)72 195.6 S(rth).4 E F3 .682(User Manual)3.182 F F0 .682(we will disco)3.182 F -.15(ve)-.15 G 3.182(rt) .15 G(hat)228.152 195.6 Q F1(do)3.182 E F0 .682(is a necessary part of the) 3.182 F F1 -.25(fo)3.181 G(r).25 E F0 3.181(statement. Similarly)3.181 F 3.181 (,w)-.65 G 3.181(ec)474.159 195.6 S(ould)486.22 195.6 Q(ha)72 207.6 Q 1.037 -.15(ve r)-.2 H .737(eferred to section C.3 of the Jensen-W).15 F(irth)-.4 E F3 .737(User Manual)3.237 F F0 .737(to learn about the)3.237 F F1 -.25(fo)3.237 G (r).25 E F0 .737(statement and gotten)3.237 F .531(the same information there.) 72 219.6 R .53 (It is often useful to refer to these syntax charts and to the rele)5.531 F -.25(va)-.25 G .53(nt sections of).25 F(this book.)72 231.6 Q 1.822 -.8(We c)97 247.2 T .223(an correct this problem by \214rst scanning for the k).8 F -.15 (ey)-.1 G -.1(wo).15 G(rd).1 E F1 -.25(fo)2.723 G(r).25 E F0 .223 (in the \214le and then substituting the)2.723 F -.1(ke)72 259.2 S(yw)-.05 E (ord)-.1 E F1(do)2.5 E F0(to appear in front of the k)2.5 E -.15(ey)-.1 G -.1 (wo).15 G(rd).1 E F1(begin)2.5 E F0 2.5(there. Thus:)2.5 F(:)108 277.2 Q F1(/f) A(or)-.25 E F0(for i :)133 289.2 Q F2(=)A F0 2.5(0t)2.5 G 2.5(ol)173.49 289.2 S (im be)183.77 289.2 Q(gin)-.15 E(:)108 301.2 Q F1(s/begin/do &)A F0(for i :)133 313.2 Q F2(=)A F0 2.5(0t)2.5 G 2.5(ol)173.49 313.2 S(im do be)183.77 313.2 Q (gin)-.15 E(:)108 325.2 Q 1.244(The ne)72 343.2 R 1.243 (xt error in the program is easy to pinpoint.)-.15 F 1.243 (On line 18, we didn')6.243 F 3.743(th)-.18 G 1.243(it the shift k)384.729 343.2 R 1.543 -.15(ey a)-.1 H 1.243(nd got a `9').15 F .17(instead of a `\)'.) 72 355.2 R .17(The translator diagnosed that `x9' w)5.17 F .17 (as an unde\214ned v)-.1 F .17(ariable and, later)-.25 F 2.67(,t)-.4 G .17 (hat a `\)' w)429.55 355.2 R .17(as miss-)-.1 F .071(ing in the statement.)72 367.2 R .071(It should be stressed that)5.071 F F3(pi)2.571 E F0 .07 (is not suggesting that you should insert a `\)' before the `;'.)2.571 F .351(\ It is only indicating that making this change will help it to be able to conti\ nue analyzing the program so as)72 379.2 R 1.095 (to be able to diagnose further errors.)72 391.2 R -1.1(Yo)6.095 G 3.595(um)1.1 G 1.095(ust then determine the true cause of the error and mak)257.4 391.2 R 3.594(et)-.1 G(he)494.56 391.2 Q(appropriate correction to the source te)72 403.2 Q(xt.)-.15 E .813(This error also illustrates the f)97 418.8 R .813 (act that one error in the input may lead to multiple error diagnostics.)-.1 F F3(Pi)72 430.8 Q F0 .278(attempts to gi)2.778 F .578 -.15(ve o)-.25 H .278 (nly one diagnostic for each error).15 F 2.778(,b)-.4 G .278 (ut single errors in the input sometimes appear to be)296.8 430.8 R .075 (more than one error)72 442.8 R 5.075(.I)-.55 G 2.575(ti)161.72 442.8 S 2.575 (sa)169.855 442.8 S .075(lso the case that)180.76 442.8 R F3(pi)2.575 E F0 .075 (may not detect an error when it occurs, b)2.575 F .076(ut may detect it later) -.2 F(in the input.)72 454.8 Q(This w)5 E(ould ha)-.1 E .3 -.15(ve h)-.2 H (appened in this e).15 E(xample if we had typed `x' instead of `x9'.)-.15 E .032(The translator ne)97 470.4 R .031 (xt detected, on line 19, that the function)-.15 F F3(Round)2.531 E F0 .031 (and the v)2.531 F(ariable)-.25 E F3(h)2.531 E F0 .031(were unde\214ned.)2.531 F(It)5.031 E 1.83(does not kno)72 482.4 R 4.33(wa)-.25 G(bout)142.51 482.4 Q F3 (Round)4.331 E F0 1.831(because Berk)4.331 F(ele)-.1 E 4.331(yP)-.15 G 1.831 (ascal normally distinguishes between upper and lo)276.634 482.4 R(wer)-.25 E 2.732(case.\207 On)72 494.4 R/F4 8/Times-Roman@0 SF(UNIX)2.732 E F0(lo)2.732 E (wer)-.25 E .231(-case is preferred\210, and all k)-.2 F -.15(ey)-.1 G -.1(wo) .15 G .231(rds and b).1 F(uilt-in)-.2 E F1(pr)2.731 E(ocedur)-.18 E(e)-.18 E F0 (and)2.731 E F1(function)2.731 E F0 .231(names are)2.731 F .046(composed of lo) 72 506.4 R(wer)-.25 E .046(-case letters, just as the)-.2 F 2.546(ya)-.15 G .046(re in the Jensen-W)252.792 506.4 R(irth)-.4 E F3 -.8(Pa)2.546 G .046 (scal Report).8 F F0 5.046(.T)C .046(hus we need to use the)413.508 506.4 R (function)72 518.4 Q F3 -.45(ro)2.762 G(und).45 E F0 2.762(here. As)2.762 F -.1 (fa)2.762 G 2.762(ra).1 G(s)191.34 518.4 Q F3(h)2.762 E F0 .262 (is concerned, we can see wh)2.762 F 2.762(yi)-.05 G 2.762(ti)330.846 518.4 S 2.762(su)339.168 518.4 S .261(nde\214ned if we look back to line 9 and)350.82 518.4 R .79(note that its de\214nition w)72 530.4 R .791 (as lost in the non-terminated comment.)-.1 F .791 (This diagnostic need not, therefore, con-)5.791 F(cern us.)72 542.4 Q .117 (The ne)97 558 R .116(xt error which occurred in the program caused the transl\ ator to insert a `;' before the statement)-.15 F(calling)72 570 Q F3(writeln) 2.944 E F0 .444(on line 23.)2.944 F .444(If we e)5.444 F .445 (xamine the program around the point of error we will see that the actual)-.15 F .156(error is that the k)72 582 R -.15(ey)-.1 G -.1(wo).15 G(rd).1 E F1 (until)2.656 E F0 .156(and an associated e)2.656 F .156(xpression ha)-.15 F .456 -.15(ve b)-.2 H .156(een omitted here.).15 F .155(Note that the diagnos-) 5.156 F .43(tic from the translator does not indicate the actual error)72 594 R 2.931(,a)-.4 G .431(nd is some)305.574 594 R .431(what misleading.)-.25 F .431 (The translator made)5.431 F .229 (the correction which seemed to be most plausible.)72 606 R .228 (As the omission of a `;' character is a common mistak)5.228 F(e,)-.1 E .176 (the translator chose to indicate this as a possible \214x here.)72 618 R .176 (It later detected that the k)5.176 F -.15(ey)-.1 G -.1(wo).15 G(rd).1 E F1 (until)2.676 E F0 -.1(wa)2.676 G 2.676(sm).1 G(iss-)490.11 618 Q .757(ing, b)72 630 R .757(ut not until it sa)-.2 F 3.257(wt)-.15 G .757(he k)174.262 630 R -.15(ey)-.1 G -.1(wo).15 G(rd).1 E F1(end)3.257 E F0 .757(on line 24.)3.257 F .757(The combination of these diagnostics indicate to us)5.757 F (the true problem.)72 642 Q .958 (The \214nal syntactic error message indicates that the translator needed an)97 657.6 R F1(end)3.458 E F0 -.1(ke)3.458 G(yw)-.05 E .958(ord to match the)-.1 F F1(begin)72 669.6 Q F0 .361(at line 15.)2.861 F .361(Since the)5.361 F F1(end) 2.861 E F0 .36(at line 24 is supposed to match this)2.861 F F1(begin)2.86 E F0 2.86(,w)C 2.86(ec)384.17 669.6 S .36(an infer that another)395.91 669.6 R F1 (begin)2.86 E F0 .817(must ha)72 681.6 R 1.117 -.15(ve b)-.2 H .818 (een mismatched, and ha).15 F 1.118 -.15(ve m)-.2 H .818(atched this).15 F F1 (end)3.318 E F0 5.818(.T)C .818(hus we see that we need an)317.52 681.6 R F1 (end)3.318 E F0 .818(to match the)3.318 F F1(begin)72 693.6 Q F0 (at line 16, and to appear before the \214nal)2.5 E F1(end)2.5 E F0 5(.W)C 2.5 (ec)291.17 693.6 S(an mak)302.55 693.6 Q 2.5(et)-.1 G(hese corrections:)341.33 693.6 Q .32 LW 144 701.6 72 701.6 DL F4(\207In `)72 713.4 Q(`standard')-.592 E 2('P)-.592 G(ascal no distinction is made based on case.)127.568 713.4 Q (\210One good reason for using lo)72 725.2 Q(wer)-.2 E (-case is that it is easier to type.)-.16 E EP %%Page: 11 11 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7-11)464.55 48 Q(:)108 84 Q/F1 10 /Times-Bold@0 SF(/x9/s//x\))A F0 2.5(y:)148 96 S/F2 10/Symbol SF(=)158.28 96 Q F0 -.15(ex)2.5 G(p\().15 E F2(-)A F0(x\))A F2(*)2.5 E F0(sin\(i)2.5 E F2(*)2.5 E F0(x\);)2.5 E(:)108 108 Q F2 -5.488(++)C F1(s/Round/r)5.488 E(ound)-.18 E F0 2.5(n:)148 120 S F2(=)158.28 120 Q F0(round\(s)2.5 E F2(*)2.5 E F0(y\))2.5 E F2 (+)2.5 E F0(h;)2.5 E(:)108 132 Q F1(/write)A F0(write\(\264 \264\);)168 144 Q (:)108 156 Q F1(/)A F0(writeln\(\264)148 168 Q F2(*)A F0<b429>A(:)108 180 Q F1 (insert)A(until n)148 192 Q F2 -5.488(==)2.5 G F1(0;)7.988 E(.)108 204 Q F0(:) 108 216 Q F1($)A F0(end.)108 228 Q(:)108 240 Q F1(insert)A(end)128 252 Q(.)108 264 Q F0(:)108 276 Q .139(At the end of each)97 297.6 R F1(pr)2.638 E(ocedur) -.18 E(e)-.18 E F0(or)2.638 E F1(function)2.638 E F0 .138(and the end of the) 2.638 F F1(pr)2.638 E(ogram)-.18 E F0 .138(the translator summarizes ref-)2.638 F 1.45(erences to unde\214ned v)72 309.6 R 1.45 (ariables and improper usages of v)-.25 F 3.95(ariables. It)-.25 F 1.45 (also gi)3.95 F -.15(ve)-.25 G 3.95(sw).15 G 1.45(arnings about potential) 409.44 309.6 R 3.119(errors. In)72 321.6 R .619 (our program, the summary errors do not indicate an)3.119 F 3.119(yf)-.15 G .619(urther problems b)337.489 321.6 R .619(ut the w)-.2 F .619(arning that)-.1 F/F3 10/Times-Italic@0 SF(c)3.118 E F0(is)3.118 E .601(unused is some)72 333.6 R .601(what suspicious.)-.25 F .601 (Examining the program we see that the constant w)5.601 F .602 (as intended to be used)-.1 F .312(in the e)72 345.6 R .312 (xpression which is an ar)-.15 F .312(gument to)-.18 F F3(sin)2.812 E F0 2.812 (,s)C 2.812(ow)263.908 345.6 S 2.812(ec)278.94 345.6 S .311(an correct this e) 290.632 345.6 R .311(xpression, and translate the program.)-.15 F 1.6 -.8(We h) 72 357.6 T -2.25 -.2(av e).8 H(no)2.7 E 2.5(wm)-.25 G (ade a correction for each diagnosed error in our program.)135.86 357.6 Q(:)108 375.6 Q F1(?i ?s//c /)A F0 2.5(y:)158 387.6 S F2(=)168.28 387.6 Q F0 -.15(ex) 2.5 G(p\().15 E F2(-)A F0(x\))A F2(*)2.5 E F0(sin\(c)2.5 E F2(*)2.5 E F0(x\);) 2.5 E(:)108 399.6 Q F1(write)A F0("bigger)108 411.6 Q (.p" 26 lines, 538 characters)-.55 E(:)108 423.6 Q F1(quit)A F0(%)108 435.6 Q F1(pi bigger)2.5 E(.p)-1 E F0(%)108 447.6 Q .02 (It should be noted that the translator suppresses w)72 465.6 R .02 (arning diagnostics for a particular)-.1 F F1(pr)2.52 E(ocedur)-.18 E(e)-.18 E F0(,)A F1(function)2.52 E F0(or)2.52 E .021(the main)72 477.6 R F1(pr)2.521 E (ogram)-.18 E F0 .021(when it \214nds se)2.521 F -.15(ve)-.25 G .02 (re syntax errors in that part of the source te).15 F 2.52(xt. This)-.15 F .02 (is to pre)2.52 F -.15(ve)-.25 G .02(nt possi-).15 F .024 (bly confusing and incorrect w)72 489.6 R .025 (arning diagnostics from being produced.)-.1 F .025(Thus these w)5.025 F .025 (arning diagnostics may)-.1 F(not appear in a program with bad syntax errors u\ ntil these errors are corrected.)72 501.6 Q EP %%Page: 12 12 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 264.65(PSD:7-12 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q 2.292 -.8(We a)97 84 T .692(re no).8 F 3.192(wr)-.25 G .692(eady to e)152.166 84 R -.15(xe)-.15 G .692 (cute our program for the \214rst time.).15 F 2.291 -.8(We w)5.691 H .691 (ill do so in the ne).8 F .691(xt section after)-.15 F(gi)72 96 Q (ving a listing of the corrected program for reference purposes.)-.25 E(%)108 114 Q/F1 10/Times-Bold@0 SF(cat)2.5 E/F2 10/Symbol SF -5.488(--)2.5 G F1 2.5 (nb)5.488 G(igger)153.212 114 Q(.p)-1 E F0 10(1\()133 126 S F2(*)151.33 126 Q F0(2)133 138 Q F2(*)153 138 Q F0(Graphic representation of a function)2.5 E(3) 133 150 Q F2(*)153 150 Q F0(f\(x\))168 150 Q F2(=)2.5 E F0 -.15(ex)2.5 G(p\() .15 E F2(-)A F0(x\))A F2(*)2.5 E F0(sin\(2)2.5 E F2(*)2.5 E F0(pi)2.5 E F2(*) 2.5 E F0(x\))2.5 E(4)133 162 Q F2(*)153 162 Q F0(\))A 10(5p)133 174 S (rogram graph1\(output\);)153 174 Q 10(6c)133 186 S(onst)152.44 186 Q 50(7d)133 198 S F2(=)195.5 198 Q F0 5(0.0625; \()2.5 F F2(*)A F0 (1/16, 16 lines for interv)2.5 E(al [x, x)-.25 E F2(+)A F0(1])A F2(*)2.5 E F0 (\))A 50(8s)133 210 S F2(=)194.39 210 Q F0 15(32; \()2.5 F F2(*)A F0 (32 character width for interv)2.5 E(al [x, x)-.25 E F2(+)A F0(1])A F2(*)2.5 E F0(\))A 50(9h)133 222 S F2(=)195.5 222 Q F0 15(34; \()2.5 F F2(*)A F0 (Character position of x)2.5 E F2(-)A F0(axis)A F2(*)2.5 E F0(\))A 47.5(10 c) 128 234 R F2(=)2.5 E F0 2.5(6.28138; \()2.5 F F2(*)A F0(2)2.5 E F2(*)2.5 E F0 (pi)2.5 E F2(*)2.5 E F0(\))A 47.5(11 lim)128 246 R F2(=)2.5 E F0(32;)2.5 E 7.5 (12 v)128 258 R(ar)-.25 E 47.5(13 x,)128 270 R(y: real;)2.5 E 47.5(14 i,)128 282 R(n: inte)2.5 E(ger;)-.15 E 7.5(15 be)128 294 R(gin)-.15 E 47.5(16 for)128 306 R 2.5(i:)2.5 G F2(=)210.22 306 Q F0 2.5(0t)2.5 G 2.5(ol)228.49 306 S (im do be)238.77 306 Q(gin)-.15 E 87.5(17 x)128 318 R(:)2.5 E F2(=)A F0 2.5 (d/i)2.5 G(;)261.83 318 Q 87.5(18 y)128 330 R(:)2.5 E F2(=)A F0 -.15(ex)2.5 G (p\().15 E F2(-)A F0(x\))A F2(*)2.5 E F0(sin\(c)2.5 E F2(*)2.5 E F0(x\);)2.5 E 87.5(19 n)128 342 R(:)2.5 E F2(=)A F0(round\(s)2.5 E F2(*)2.5 E F0(y\))2.5 E F2 (+)2.5 E F0(h;)2.5 E 87.5(20 repeat)128 354 R 127.5(21 write\(\264)128 366 R <b4293b>2.5 E 127.5(22 n)128 378 R(:)2.5 E F2(=)A F0(n)2.5 E F2(-)2.5 E F0(1) 2.5 E 87.5(23 until)128 390 R(n)2.5 E F2(=)2.5 E F0(0;)2.5 E 87.5 (24 writeln\(\264)128 402 R F2(*)A F0<b429>A 47.5(25 end)128 414 R 7.5(26 end.) 128 426 R(%)108 438 Q F1 2.5(2.4. Executing)72 468 R(the second example)2.5 E F0 2.505 -.8(We a)97 483.6 T .905(re no).8 F 3.405(wr)-.25 G .905(eady to e) 152.805 483.6 R -.15(xe)-.15 G .906(cute the second e).15 F 3.406(xample. The) -.15 F(follo)3.406 E .906(wing output w)-.25 F .906(as produced by our \214rst) -.1 F(run.)72 495.6 Q(%)108 513.6 Q F1(px)2.5 E F0(%)108 525.6 Q .315 (Here the interpreter is presenting us with a runtime error diagnostic.)72 543.6 R .315(It detected a `di)5.315 F .315(vision by zero' at line)-.25 F 2.611(17. Examining)72 555.6 R .111(line 17, we see that we ha)2.611 F .411 -.15(ve w)-.2 H .112(ritten the statement `x :).15 F F2(=)A F0 2.612(d/i)2.612 G 2.612('i)375.832 555.6 S .112(nstead of `x :)384.554 555.6 R F2(=)A F0(d) 2.612 E F2(*)2.612 E F0 2.612(i'. W)2.612 F 2.612(ec)-.8 G(an)494.56 555.6 Q (correct this and rerun the program:)72 567.6 Q(%)108 585.6 Q F1(ex bigger)2.5 E(.p)-1 E F0("bigger)108 597.6 Q(.p" 26 lines, 538 characters)-.55 E(:)108 609.6 Q F1(17)A F0 2.5(x:)128 621.6 S F2(=)138.28 621.6 Q F0 2.5(d/i)2.5 G(:) 108 633.6 Q F1<73b42fb4>A F2 -4.998(**)C F0 2.5(x:)128 645.6 S F2(=)138.28 645.6 Q F0(d)2.5 E F2(*)2.5 E F0(i)2.5 E(:)108 657.6 Q F1(write)A F0("bigger) 108 669.6 Q(.p" 26 lines, 538 characters)-.55 E(:)108 681.6 Q F1(q)A F0(%)108 693.6 Q F1(pix bigger)2.5 E(.p)-1 E F0(%)108 705.6 Q EP %%Page: 13 13 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7-13)464.55 48 Q .984 (This appears to be the output we w)97 84 R 3.484(anted. W)-.1 F 3.484(ec)-.8 G .984(ould no)294.636 84 R 3.483(ws)-.25 G -2.25 -.2(av e)340.243 84 T .983 (the output in a \214le if we wished by)3.683 F (using the shell to redirect the output:)72 96 Q(%)108 114 Q/F1 10/Times-Bold@0 SF(px > graph)2.5 E F0 1.85 -.8(We c)72 132 T .25(an use).8 F/F2 10 /Times-Italic@0 SF(cat)2.75 E F0 .25 (\(1\) to see the contents of the \214le graph.)2.75 F 1.85 -.8(We c)5.25 H .251(an also mak).8 F 2.751(eal)-.1 G .251(isting of the graph on the line) 384.724 132 R(printer without putting it into a \214le, e.g.)72 144 Q(%)108 162 Q F1(px | lpr)2.5 E F0(%)108 174 Q .422 (Note here that the statistics lines came out on our terminal.)72 192 R .421 (The statistics line comes out on the diagnostic)5.422 F .07 (output \(unit 2.\))72 204 R .07(There are tw)5.07 F 2.57(ow)-.1 G .07 (ays to get rid of the statistics line.)202.75 204 R 1.67 -.8(We c)5.07 H .07 (an redirect the statistics message to).8 F(the printer using the syntax `|)72 216 Q(&' to the shell rather than `|', i.e.:)1.666 E(%)108 234 Q F1(px |)2.5 E 2.5(&l)1.666 G(pr)149.366 234 Q F0(%)108 246 Q .118 (or we can translate the program with the)72 264 R F1(p)2.618 E F0 .117 (option disabled on the command line as we did abo)2.618 F -.15(ve)-.15 G 5.117 (.T).15 G .117(his will)474.153 264 R (disable all post-mortem dumping including the statistics line, thus:)72 276 Q (%)108 294 Q F1(pi)2.5 E/F3 10/Symbol SF -5.488(--)2.5 G F1 2.5(pb)5.488 G (igger)148.782 294 Q(.p)-1 E F0(%)108 306 Q F1(px | lpr)2.5 E F0(%)108 318 Q .978(This option also disables the statement limit which normally guards ag)72 336 R .979(ainst in\214nite looping.)-.05 F -1.1(Yo)5.979 G 3.479(us)1.1 G (hould)481.22 336 Q .636(not use it until your program is deb)72 348 R 3.136 (ugged. Also)-.2 F(if)3.136 E F1(p)3.136 E F0 .635 (is speci\214ed and an error occurs, you will not get run)3.136 F (time diagnostic information to help you determine what the problem is.)72 360 Q F1 2.5(2.5. F)72 384 R(ormatting the pr)-.25 E(ogram listing)-.18 E F0 .846 (It is possible to use special lines within the source te)97 399.6 R .847 (xt of a program to format the program listing.)-.15 F 1.246(An empty line \(o\ ne with no characters on it\) corresponds to a `space' macro in an assembler)72 411.6 R 3.745(,l)-.4 G(ea)469.355 411.6 Q 1.245(ving a)-.2 F .526 (completely blank line without a line number)72 423.6 R 5.527(.A)-.55 G .527 (line containing only a control-l \(form-feed\) character will)270.091 423.6 R 1.101(cause a page eject in the listing with the corresponding line number sup\ pressed.)72 435.6 R 1.101(This corresponds to an)6.101 F (`eject' pseudo-instruction.)72 447.6 Q (See also section 5.2 for details on the)5 E F1(n)2.5 E F0(and)2.5 E F1(i)2.5 E F0(options of)2.5 E F2(pi)2.5 E F0(.)A F1 2.5(2.6. Execution)72 471.6 R(pr)2.5 E(o\214ling)-.18 E F0 1.258(An e)97 487.2 R -.15(xe)-.15 G 1.258(cution pro\ \214le consists of a structured listing of \(all or part of\) a program with i\ nformation).15 F .34(about the number of times each statement in the program w) 72 499.2 R .339(as e)-.1 F -.15(xe)-.15 G .339 (cuted for a particular run of the program.).15 F 1.203 (These pro\214les can be used for se)72 511.2 R -.15(ve)-.25 G 1.204 (ral purposes.).15 F 1.204(In a program which w)6.204 F 1.204 (as abnormally terminated due to)-.1 F -.15(ex)72 523.2 S(cessi).15 E 1.219 -.15(ve l)-.25 H .919(ooping or recursion or by a program f).15 F .919 (ault, the counts can f)-.1 F .919(acilitate location of the error)-.1 F 5.918 (.Z)-.55 G(ero)491.23 523.2 Q 1.607 (counts mark portions of the program which were not e)72 535.2 R -.15(xe)-.15 G 1.608(cuted; during the early deb).15 F 1.608(ugging stages the)-.2 F(y)-.15 E .895(should prompt ne)72 547.2 R 3.395(wt)-.25 G .895(est data or a re-e) 156.935 547.2 R .895(xamination of the program logic.)-.15 F .894 (The pro\214le is perhaps most v)5.895 F(alu-)-.25 E .181(able, ho)72 559.2 R (we)-.25 E -.15(ve)-.25 G .981 -.4(r, i).15 H 2.681(nd).4 G(ra)147.863 559.2 Q .181(wing attention to the \(typically small\) portions of the program that do\ minate e)-.15 F -.15(xe)-.15 G(cution).15 E 2.5(time. This)72 571.2 R (information can be used for source le)2.5 E -.15(ve)-.25 G 2.5(lo).15 G (ptimization.)285.73 571.2 Q F1(An example)72 595.2 Q F0 3.828(Ap)97 610.8 S 1.328(rime number is a number which is di)113.048 610.8 R 1.327 (visible only by itself and the number one.)-.25 F 1.327(The program)6.327 F F2 (primes)72 622.8 Q F0 3.328(,w)C .828(ritten by Niklaus W)112.268 622.8 R .829 (irth, determines the \214rst fe)-.4 F 3.329(wp)-.25 G .829(rime numbers.) 317.946 622.8 R .829(In translating the program we)5.829 F(ha)72 634.8 Q .655 -.15(ve s)-.2 H .355(peci\214ed the).15 F F1(z)2.855 E F0 .355(option to)2.855 F F2(pix)2.855 E F0 5.355(.T)C .355 (his option causes the translator to generate counters and count instruc-) 219.395 634.8 R .5(tions suf)72 646.8 R .499(\214cient in number to determine \ the number of times each statement in the program w)-.25 F .499(as e)-.1 F -.15 (xe)-.15 G(cuted.\207).15 E .57(When e)72 658.8 R -.15(xe)-.15 G .57 (cution of the program completes, either normally or abnormally).15 F 3.07(,t) -.65 G .57(his count data is written to the)380.03 658.8 R(\214le)72 670.8 Q F2 (pmon.out)2.5 E F0(in the current directory)2.5 E (.\210 It is then possible to prepare an e)-.65 E -.15(xe)-.15 G (cution pro\214le by gi).15 E(ving)-.25 E .32 LW 144 678.8 72 678.8 DL/F4 8 /Times-Roman@0 SF .449(\207The counts are completely accurate only in the abse\ nce of runtime errors and nonlocal)72 690.6 R/F5 8/Times-Bold@0 SF(goto)2.449 E F4 2.449(statements. This)2.449 F .184(is not generally a problem, ho)72 700.6 R(we)-.2 E -.12(ve)-.2 G .824 -.32(r, a).12 H 2.184(si).32 G 2.184(ns)202.424 700.6 S .184(tructured programs nonlocal)211.72 700.6 R F5(goto)2.184 E F4 .184 (statements occur infrequently)2.184 F 2.184(,a)-.52 G(nd)424 700.6 Q 1.285 (counts are incorrect after abnormal termination only when the)72 710.6 R/F6 8 /Times-Italic@0 SF(upwar)3.285 E 3.285(dl)-.296 G(ook)313.402 710.6 Q F4 1.285 (described belo)3.285 F 3.285(wt)-.2 G 3.285(og)387.041 710.6 S 1.285 (et a count)398.326 710.6 R(passes a suspended call point.)72 720.6 Q EP %%Page: 14 14 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 264.65(PSD:7-14 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q (the name of the \214le associated with this data, as w)72 84 Q (as done in the follo)-.1 E(wing e)-.25 E(xample.)-.15 E(%)133 102 Q/F1 10 /Times-Bold@0 SF(pix)2.5 E/F2 10/Symbol SF -5.488(--)2.5 G F1(l)5.488 E F2 -5.488(--)2.5 G F1 2.5(zp)5.488 G(rimes.p)188.434 102 Q F0(%)133 114 Q F1 (Discussion)72 144 Q F0(The header lines of the outputs of)97 159.6 Q/F3 10 /Times-Italic@0 SF(pix)2.5 E F0(and)2.5 E .587(in this e)72 175.2 R .587 (xample indicate the v)-.15 F .588(ersion of the translator and e)-.15 F -.15 (xe)-.15 G .588(cution pro\214ler in use at the time this e).15 F(xample)-.15 E -.1(wa)97 187.2 S 3.199(sp).1 G 3.199(repared. The)120.649 187.2 R .699 (time gi)3.199 F -.15(ve)-.25 G 3.199(nw).15 G .698 (ith the \214le name \(also on the header line\) indicates the time of last) 230.795 187.2 R .8(modi\214cation of the program source \214le.)97 199.2 R .801 (This time serv)5.801 F .801(es to)-.15 F F3(ver)3.301 E .801(sion stamp)-.1 F F0 .801(the input program.)3.301 F F3(Pxp)5.801 E F0 (also indicates the time at which the pro\214le data w)97 211.2 Q(as g)-.1 E (athered.)-.05 E(%)133 229.2 Q F1(pxp)2.5 E F2 -5.488(--)2.5 G F1 2.5(zp)5.488 G(rimes.p)180.442 229.2 Q F0(pmon.out: No such \214le or directory)133 241.2 Q (%)133 253.2 Q 1.612 -.8(To d)97 274.8 T .012 (etermine the number of times a statement w).8 F .012(as e)-.1 F -.15(xe)-.15 G .011(cuted, one looks to the left of the statement and).15 F .289 (\214nds the corresponding v)72 286.8 R .289(ertical bar `|'.)-.15 F .289 (If this v)5.289 F .289 (ertical bar is labelled with a count then that count gi)-.15 F -.15(ve)-.25 G 2.789(st).15 G(he)494.56 286.8 Q .355(number of times the statement w)72 298.8 R .355(as e)-.1 F -.15(xe)-.15 G 2.854(cuted. If).15 F .354 (the bar is not labelled, we look up in the listing to \214nd the)2.854 F .373 (\214rst `|' which directly abo)72 310.8 R .673 -.15(ve t)-.15 H .373 (he original one which has a count and that is the answer).15 F 5.373(.T)-.55 G .373(hus, in our e)433.041 310.8 R(xam-)-.15 E(ple,)72 322.8 Q F3(k)3.615 E F0 -.1(wa)3.615 G 3.615(si).1 G 1.115(ncremented 157 times on line 18, while the) 120.235 322.8 R F3(write)3.615 E F0 1.114(procedure call on line 24 w)3.615 F 1.114(as e)-.1 F -.15(xe)-.15 G 1.114(cuted 48).15 F(times as gi)72 334.8 Q -.15(ve)-.25 G 2.5(nb).15 G 2.5(yt)136.32 334.8 S(he count on the)146.6 334.8 Q F1 -.18(re)2.5 G(peat).18 E F0(.)A(More information on)97 350.4 Q F3(pxp)2.5 E F0(can be found in its manual section)2.5 E (\(1\) and in sections 5.4, 5.5 and 5.10.)72 366 Q F1 2.5(3. Err)72 390 R (or diagnostics)-.18 E F0 .373(This section of the)97 405.6 R F3(User')2.873 E 2.873(sM)-.4 G(anual)212.615 405.6 Q F0 .374 (discusses the error diagnostics of the programs)2.873 F F3(pi)2.874 E F0(,)A F3(pc)2.874 E F0(and)2.874 E F3(px)2.874 E F0(.)A F3(Pix)5.374 E F0 .12 (is a simple b)72 417.6 R .12(ut useful program which in)-.2 F -.2(vo)-.4 G -.1 (ke).2 G(s).1 E F3(pi)2.62 E F0(and)2.62 E F3(px)2.62 E F0 .119 (to do all the real processing.)2.619 F .119(See its manual section)5.119 F F3 (pix)72 429.6 Q F0(\(1\) and section 5.2 belo)2.5 E 2.5(wf)-.25 G (or more details.)193.67 429.6 Q(All the diagnostics gi)5 E -.15(ve)-.25 G 2.5 (nb).15 G(y)367.98 429.6 Q F3(pi)2.5 E F0(will also be gi)2.5 E -.15(ve)-.25 G 2.5(nb).15 G(y)463.69 429.6 Q F3(pc)2.5 E F0(.)A F1 2.5(3.1. T)72 453.6 R (ranslator syntax err)-.74 E(ors)-.18 E F0 2.725(Af)97 469.2 S .725 -.25(ew c) 110.275 469.2 T .225 (omments on the general nature of the syntax errors usually made by P).25 F .225(ascal programmers and)-.15 F(the reco)72 481.2 Q -.15(ve)-.15 G (ry mechanisms of the current translator may help in using the system.).15 E F1 (Illegal characters)72 505.2 Q F0 1.382 (Characters such as `$', `!', and `@' are not part of the language P)97 520.8 R 3.882(ascal. If)-.15 F(the)3.882 E 3.882(ya)-.15 G 1.382(re found in the) 441.254 520.8 R .58 (source program, and are not part of a constant string, a constant character)72 532.8 R 3.08(,o)-.4 G 3.08(rac)382.39 532.8 S .58(omment, the)400.76 532.8 R 3.08(ya)-.15 G .58(re consid-)463.71 532.8 R .577(ered to be `ille)72 544.8 R -.05(ga)-.15 G 3.077(lc).05 G 3.077(haracters'. This)151.308 544.8 R .577 (can happen if you lea)3.077 F .877 -.15(ve o)-.2 H 1.077 -.25(ff a).15 H 3.077 (no).25 G .577(pening string quote `\264'.)351.671 544.8 R .576(Note that the) 5.576 F .82(character `"', although used in English to quote strings, is not u\ sed to quote strings in P)72 556.8 R 3.32(ascal. Most)-.15 F(non-)3.32 E .294 (printing characters in your input are also ille)72 568.8 R -.05(ga)-.15 G 2.793(le).05 G .293(xcept in character constants and character strings.)270.629 568.8 R(Except)5.293 E .044(for the tab and form feed characters, which are us\ ed to ease formatting of the program, non-printing charac-)72 580.8 R (ters in the input \214le print as the character `?')72 592.8 Q(so that the)5 E 2.5(yw)-.15 G(ill sho)310.14 592.8 Q 2.5(wi)-.25 G 2.5(ny)347.12 592.8 S (our listing.)359.62 592.8 Q F1(String err)72 616.8 Q(ors)-.18 E F0 .081 (There is no character string of length 0 in P)97 632.4 R 2.581 (ascal. Consequently)-.15 F .081(the input `\264\264' is not acceptable.)2.581 F(Sim-)5.081 E(ilarly)72 644.4 Q 2.595(,e)-.65 G .096(ncountering an end-of-li\ ne after an opening string quote `\264' without encountering the matching clos\ -)101.995 644.4 R .454(ing quote yields the diagnostic `)72 656.4 R .454 (`Unmatched \264 for string')-.74 F 2.954('. It)-.74 F .454 (is permissible to use the character `#' instead)2.954 F .572 (of `\264' to delimit character and constant strings for portability reasons.) 72 668.4 R -.15(Fo)5.573 G 3.073(rt).15 G .573(his reason, a spuriously placed) 379.228 668.4 R .325 (`#' sometimes causes the diagnostic about unbalanced quotes.)72 680.4 R (Similarly)5.325 E 2.825(,a`)-.65 G .325(#' in column one is used when)379.84 680.4 R(preparing programs which are to be k)72 692.4 Q (ept in multiple \214les.)-.1 E(See section 5.11 for details.)5 E .32 LW 144 700.4 72 700.4 DL/F4 8/Times-Roman@0 SF<88>72 710.4 Q/F5 8/Times-Italic@0 SF (Pmon.out)A F4 .041(has a name similar to)2.041 F F5(mon.out)2.041 E F4 .041 (the monitor \214le produced by the pro\214ling f)2.041 F .041 (acility of the C compiler)-.08 F F5(cc)2.04 E F4 2(\(1\). See)72 720.4 R F5 (pr)2 E(of)-.36 E F4(\(1\) for a discussion of the C compiler pro\214ling f)2 E (acilities.)-.08 E EP %%Page: 15 15 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7-15)464.55 48 Q/F1 10/Times-Bold@0 SF (Comments in a comment, non-terminated comments)72 84 Q F0 .437(As we sa)97 99.6 R 2.937(wa)-.15 G(bo)148.421 99.6 Q -.15(ve)-.15 G 2.937(,t).15 G .437 (hese errors are usually caused by lea)175.778 99.6 R .437(ving of)-.2 F 2.937 (fac)-.25 G .437(omment delimiter)371.141 99.6 R 5.437(.Y)-.55 G .437 (ou can con-)456.475 99.6 R -.15(ve)72 111.6 S 1.338(rt parts of your program \ to comments without generating this diagnostic since there are tw).15 F 3.838 (od)-.1 G(if)474.82 111.6 Q(ferent)-.25 E(kinds of comments \255 those delimit\ ed by `{' and `}', and those delimited by `\()72 123.6 Q/F2 10/Symbol SF(*)A F0 2.5('a)C(nd `)397.76 123.6 Q F2(*)A F0 2.5(\)'. Thus)B(consider:)2.5 E 2.5({T) 108 141.6 S(his is a comment enclosing a piece of program)121.41 141.6 Q 2.5 (a:)108 153.6 S F2(=)117.72 153.6 Q F0 4.24(functioncall; \()2.5 F F2(*)A F0 (comment within comment)2.5 E F2(*)2.5 E F0(\))A(procedurecall;)108 165.6 Q (lhs :)108 177.6 Q F2(=)A F0 32.56(rhs; \()2.5 F F2(*)A F0(another comment)2.5 E F2(*)2.5 E F0(\))A(})108 189.6 Q .891(By using one kind of comment e)97 211.2 R(xclusi)-.15 E -.15(ve)-.25 G .891 (ly in your program you can use the other delimiters when).15 F .424 (you need to `)72 223.2 R .424(`comment out')-.74 F 2.924('p)-.74 G .424 (arts of your program\207.)195.12 223.2 R .424(In this w)5.424 F .424 (ay you will also allo)-.1 F 2.923(wt)-.25 G .423(he translator to help)423.021 223.2 R(by detecting statements accidentally placed within comments.)72 235.2 Q .116(If a comment does not terminate before the end of the input \214le, the t\ ranslator will point to the be)97 250.8 R(gin-)-.15 E .388 (ning of the comment, indicating that the comment is not terminated.)72 262.8 R .387(In this case processing will terminate)5.387 F(immediately)72 274.8 Q 5 (.S)-.65 G(ee the discussion of `)134.41 274.8 Q(`Q)-.74 E(UIT')-.1 E 2.5('b) -.74 G(elo)258.63 274.8 Q -.65(w.)-.25 G F1(Digits in numbers)72 298.8 Q F0 .277(This part of the language is a minor nuisance.)97 314.4 R -.15(Pa)5.278 G .278(scal requires digits in real numbers both before and).15 F .082 (after the decimal point.)72 326.4 R .082(Thus the follo)5.082 F .082 (wing statements, which look quite reasonable to)-.25 F/F3 8/Times-Roman@0 SF (FOR)2.581 E(TRAN)-.48 E F0 .081(users, gen-)2.081 F(erate diagnostics in P)72 338.4 Q(ascal:)-.15 E (/usr/libdata/pascal/pi3.1strings: No such \214le or directory)108 356.4 Q (These same constructs are also ille)72 374.4 Q -.05(ga)-.15 G 2.5(la).05 G 2.5 (si)229.54 374.4 S(nput to the P)238.71 374.4 Q(ascal interpreter)-.15 E/F4 10 /Times-Italic@0 SF(px)2.5 E F0(.)A F1(Replacements, insertions, and deletions) 72 398.4 Q F0 .412(When a syntax error is encountered in the input te)97 414 R .413(xt, the parser in)-.15 F -.2(vo)-.4 G -.1(ke).2 G 2.913(sa).1 G 2.913(ne) 393.671 414 S .413(rror reco)406.024 414 R -.15(ve)-.15 G .413(ry procedure.) .15 F .875(This procedure e)72 426 R .875(xamines the input te)-.15 F .875 (xt immediately after the point of error and considers a set of simple)-.15 F .456(corrections to see whether the)72 438 R 2.956(yw)-.15 G .456(ill allo) 208.26 438 R 2.956(wt)-.25 G .456(he analysis to continue.)247.262 438 R .456 (These corrections in)5.456 F -.2(vo)-.4 G(lv).2 E 2.956(er)-.15 G .456 (eplacing an)457.724 438 R 1.357(input tok)72 450 R 1.357(en with a dif)-.1 F 1.357(ferent tok)-.25 F 1.357(en, inserting a tok)-.1 F 1.356 (en, or replacing an input tok)-.1 F 1.356(en with a dif)-.1 F 1.356 (ferent tok)-.25 F(en.)-.1 E .676(Most of these changes will not cause f)72 462 R .676(atal syntax errors.)-.1 F .677(The e)5.677 F .677 (xception is the insertion of or replacement)-.15 F .788 (with a symbol such as an identi\214er or a number; in this case the reco)72 474 R -.15(ve)-.15 G .787(ry mak).15 F .787(es no attempt to determine)-.1 F F4 (whic)72 486 Q(h)-.15 E F0(identi\214er or)2.5 E F4(what)2.5 E F0 (number should be inserted, hence these are considered f)2.5 E (atal syntax errors.)-.1 E(Consider the follo)97 501.6 Q(wing e)-.25 E(xample.) -.15 E(%)108 519.6 Q F1(pix)2.5 E F2 -5.488(--)2.5 G F1 2.5(ls)5.488 G(ynerr) 149.332 519.6 Q(.p)-1 E F0 (/usr/libdata/pascal/pi3.1strings: No such \214le or directory)108 531.6 Q(%) 108 543.6 Q .838(The only surprise here may be that P)72 561.6 R .838 (ascal does not ha)-.15 F 1.138 -.15(ve a)-.2 H 3.338(ne).15 G .838 (xponentiation operator)324.686 561.6 R 3.338(,h)-.4 G .839(ence the complaint) 426.782 561.6 R .621(about `)72 573.6 R F2(**)A F0 3.121('. This)B .62(error i\ llustrates that, if you assume that the language has a feature which it does n\ ot, the)3.121 F .568 (translator diagnostic may not indicate this, as the translator is unlik)72 585.6 R .568(ely to recognize the construct you sup-)-.1 F(ply)72 597.6 Q(.) -.65 E F1(Unde\214ned or impr)72 621.6 Q(oper identi\214ers)-.18 E F0 .498 (If an identi\214er is encountered in the input b)97 637.2 R .498 (ut is unde\214ned, the error reco)-.2 F -.15(ve)-.15 G .497 (ry will replace it with an).15 F .334(identi\214er of the appropriate class.) 72 649.2 R .335 (Further references to this identi\214er will be summarized at the end of the) 5.334 F(containing)72 661.2 Q F1(pr)3.048 E(ocedur)-.18 E(e)-.18 E F0(or)3.048 E F1(function)3.048 E F0 .548(or at the end of the)3.048 F F1(pr)3.048 E(ogram) -.18 E F0 .547(if the reference occurred in the main pro-)3.048 F 2.589 (gram. Similarly)72 673.2 R 2.589(,i)-.65 G 2.589(fa)144.588 673.2 S 2.589(ni) 154.947 673.2 S .089(denti\214er is used in an inappropriate w)165.316 673.2 R (ay)-.1 E 2.589(,e)-.65 G .089(.g. if a)335.159 673.2 R F1(type)2.589 E F0 .089 (identi\214er is used in an assign-)2.589 F 1.203 (ment statement, or if a simple v)72 685.2 R 1.203(ariable is used where a)-.25 F F1 -.18(re)3.703 G(cord).18 E F0 -.25(va)3.703 G 1.202 (riable is required, a diagnostic will be).25 F .32 LW 144 693.2 72 693.2 DL F3 .073(\207If you wish to transport your program, especially to the 6000-3.4 imp\ lementation, you should use the character)72 705 R 1.107(sequence `\()72 715 R /F5 8/Symbol SF(*)A F3 3.107('t)C 3.107(od)121.75 715 S 1.107(elimit comments.) 132.857 715 R -.12(Fo)5.108 G 3.108(rt).12 G 1.108(ransportation o)210.956 715 R -.12(ve)-.12 G 3.108(rt).12 G(he)275.588 715 Q/F6 8/Times-Italic@0 SF -.296 (rc)3.108 G(slink).296 E F3 1.108(to P)3.108 F 1.108 (ascal 6000-3.4, the character `#')-.12 F (should be used to delimit characters and constant strings.)72 725 Q EP %%Page: 16 16 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 264.65(PSD:7-16 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q 1.102 (produced and an identi\214er of the appropriate type inserted.)72 84 R 1.102 (Further incorrect references to this identi\214er)6.102 F .761 (will be \215agged only if the)72 96 R 3.261(yi)-.15 G -1.9 -.4(nv o)189.746 96 T(lv).4 E 3.261(ei)-.15 G .761(ncorrect use in a dif)222.257 96 R .76(ferent w) -.25 F(ay)-.1 E 3.26(,w)-.65 G .76(ith all incorrect uses being summa-)359.94 96 R(rized in the same w)72 108 Q(ay as unde\214ned v)-.1 E(ariable uses are.) -.25 E/F1 10/Times-Bold@0 SF(Expected symbols, malf)72 132 Q(ormed constructs) -.25 E F0 1.097(If none of the abo)97 147.6 R 1.398 -.15(ve m)-.15 H 1.098 (entioned corrections appear reasonable, the error reco).15 F -.15(ve)-.15 G 1.098(ry will e).15 F 1.098(xamine the)-.15 F .095(input to the left of the po\ int of error to see if there is only one symbol which can follo)72 159.6 R 2.595(wt)-.25 G .095(his input.)428.61 159.6 R .095(If this is)5.095 F (the case, the reco)72 171.6 Q -.15(ve)-.15 G (ry will print a diagnostic which indicates that the gi).15 E -.15(ve)-.25 G 2.5(ns).15 G(ymbol w)376.25 171.6 Q(as `Expected'.)-.1 E .476 (In cases where none of these corrections resolv)97 187.2 R 2.976(et)-.15 G .477(he problems in the input, the reco)298.928 187.2 R -.15(ve)-.15 G .477 (ry may issue a).15 F .51(diagnostic that indicates that the input is `)72 199.2 R(`malformed')-.74 E 3.009('. If)-.74 F(necessary)3.009 E 3.009(,t)-.65 G .509(he translator may then skip forw)359.085 199.2 R(ard)-.1 E .722 (in the input to a place where analysis can continue.)72 211.2 R .723 (This process may cause some errors in the te)5.722 F .723(xt to be)-.15 F (missed.)72 223.2 Q(Consider the follo)97 238.8 Q(wing e)-.25 E(xample:)-.15 E (%)108 256.8 Q F1(pix)2.5 E/F2 10/Symbol SF -5.488(--)2.5 G F1 2.5(ls)5.488 G (ynerr2.p)149.332 256.8 Q F0(%)108 268.8 Q .151(Here we misspelled)72 286.8 R /F3 10/Times-Italic@0 SF(output)2.651 E F0 .151(and g)2.651 F -2.25 -.2(av e) -.05 H(a)2.851 E/F4 8/Times-Roman@0 SF(FOR)2.651 E(TRAN)-.48 E F0 .151(style v) 2.651 F .151(ariable declaration which the translator diagnosed as)-.25 F 3.511 (a`)72 298.8 S 1.011(Malformed declaration'.)83.281 298.8 R 1.011 (When, on line 6, we used `\(' and `\)' for subscripting \(as in)6.011 F F4 (FOR)3.512 E(TRAN)-.48 E F0 3.512(\)r)C(ather)484.01 298.8 Q .941 (than the `[' and `]' which are used in P)72 310.8 R .94 (ascal, the translator noted that)-.15 F F3(a)3.44 E F0 -.1(wa)3.44 G 3.44(sn) .1 G .94(ot de\214ned as a)394.23 310.8 R F1(pr)3.44 E(ocedur)-.18 E(e)-.18 E F0(.)A .091(This occurred because)72 322.8 R F1(pr)2.591 E(ocedur)-.18 E(e)-.18 E F0(and)2.591 E F1(function)2.591 E F0(ar)2.591 E .091 (gument lists are delimited by parentheses in P)-.18 F 2.592(ascal. As)-.15 F (it)2.592 E .649(is not permissible to assign to procedure calls the translato\ r diagnosed a malformed statement at the point)72 334.8 R(of assignment.)72 346.8 Q F1(Expected and unexpected end-of-\214le, `)72 370.8 Q(`Q)-.63 E(UIT') -.1 E(')-.63 E F0 .451(If the translator \214nds a complete program, b)97 386.4 R .451(ut there is more non-comment te)-.2 F .452(xt in the input \214le, then) -.15 F .359(it will indicate that an end-of-\214le w)72 398.4 R .358(as e)-.1 F 2.858(xpected. This)-.15 F .358(situation may occur after a brack)2.858 F .358 (eting error)-.1 F 2.858(,o)-.4 G 2.858(ri)476.064 398.4 S 2.858(ft)485.032 398.4 S(oo)494 398.4 Q(man)72 410.4 Q(y)-.15 E F1(end)2.647 E F0 2.647(sa)C .147(re present in the input.)123.254 410.4 R .147 (The message may appear after the reco)5.147 F -.15(ve)-.15 G .148 (ry says that it `).15 F .148(`Expected \222.\264)-.74 F -.74('')1.666 G (since `.)72 422.4 Q 2.5('i)-.7 G 2.5(st)108.79 422.4 S (he symbol that terminates a program.)117.96 422.4 Q .851(If se)97 438 R -.15 (ve)-.25 G .851(re errors in the input prohibit further processing the transla\ tor may produce a diagnostic fol-).15 F(lo)72 450 Q .1(wed by `)-.25 F(`Q)-.74 E(UIT')-.1 E 2.6('. One)-.74 F -.15(ex)2.6 G .1(ample of this w).15 F .1(as gi) -.1 F -.15(ve)-.25 G 2.6(na).15 G(bo)285.09 450 Q .4 -.15(ve \255 a n)-.15 H .1 (on-terminated comment; another e).15 F .1(xample is)-.15 F 2.5(al)72 462 S (ine which is longer than 160 characters.)81.72 462 Q(Consider also the follo)5 E(wing e)-.25 E(xample.)-.15 E(%)108 480 Q F1(pix)2.5 E F2 -5.488(--)2.5 G F1 2.5(lm)5.488 G(ism.p)153.772 480 Q F0 (/usr/libdata/pascal/pi3.1strings: No such \214le or directory)108 492 Q(%)108 504 Q F1 2.5(3.2. T)72 534 R(ranslator semantic err)-.74 E(ors)-.18 E F0 .642 (The e)97 549.6 R .642(xtremely lar)-.15 F .642 (ge number of semantic diagnostic messages which the translator produces mak) -.18 F 3.141(ei)-.1 G(t)501.22 549.6 Q 1.238 (unreasonable to discuss each message or group of messages in detail.)72 561.6 R 1.239(The messages are, ho)6.239 F(we)-.25 E -.15(ve)-.25 G 2.039 -.4(r, v) .15 H(ery).25 E(informati)72 573.6 Q -.15(ve)-.25 G 5.978(.W).15 G 3.478(ew) 135.378 573.6 S .978(ill here e)150.516 573.6 R .977 (xplain the typical formats and the terminology used in the error messages so) -.15 F .413(that you will be able to mak)72 585.6 R 2.914(es)-.1 G .414 (ense out of them.)197.284 585.6 R .414(In an)5.414 F 2.914(yc)-.15 G .414 (ase in which a diagnostic is not completely com-)305.708 585.6 R (prehensible you can refer to the)72 597.6 Q F3(User Manual)2.5 E F0 (by Jensen and W)2.5 E(irth for e)-.4 E(xamples.)-.15 E F1 -.25(Fo)72 621.6 S (rmat of the err).25 E(or diagnostics)-.18 E F0 .125(As we sa)97 637.2 R 2.625 (wi)-.15 G 2.625(nt)145.825 637.2 S .125(he e)156.23 637.2 R .125 (xample program abo)-.15 F -.15(ve)-.15 G 2.625(,t).15 G .125 (he error diagnostics from the P)272.64 637.2 R .125 (ascal translator include the)-.15 F .612(number of a line in the te)72 649.2 R .613(xt of the program as well as the te)-.15 F .613(xt of the error message.) -.15 F .613(While this number is)5.613 F .261(most often the line where the er\ ror occurred, it is occasionally the number of a line containing a brack)72 661.2 R(eting)-.1 E -.1(ke)72 673.2 S(yw)-.05 E 1.044(ord lik)-.1 F(e)-.1 E F1 (end)3.544 E F0(or)3.544 E F1(until)3.544 E F0 6.044(.I)C 3.544(nt)191.49 673.2 S 1.044(his case, the diagnostic may refer to the pre)202.814 673.2 R 1.044 (vious statement.)-.25 F 1.045(This occurs)6.045 F .918 (because of the method the translator uses for sampling line numbers.)72 685.2 R .917(The absence of a trailing `;' in the)5.918 F(pre)72 697.2 Q .949 (vious statement causes the line number corresponding to the)-.25 F F1(end) 3.449 E F0(or)3.449 E F1(until)3.45 E F0 5.95(.t)C 3.45(ob)398.67 697.2 S .95 (ecome associated with)412.12 697.2 R .668(the statement.)72 709.2 R .668(As P) 5.668 F .667(ascal is a free-format language, the line number associations can\ only be approximate)-.15 F 2.792(and may seem arbitrary to some users.)72 721.2 R 2.792(This is the only notable e)7.792 F 2.792(xception, ho)-.15 F(we) -.25 E -.15(ve)-.25 G 3.592 -.4(r, t).15 H 5.292(or).4 G(easonable)464.57 721.2 Q EP %%Page: 17 17 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7-17)464.55 48 Q(associations.)72 84 Q /F1 10/Times-Bold@0 SF(Incompatible types)72 108 Q F0 .617(Since P)97 123.6 R .617(ascal is a strongly typed language, man)-.15 F 3.116(ys)-.15 G .616 (emantic errors manifest themselv)300.224 123.6 R .616(es as type errors.)-.15 F .787(These are called `type clashes' by the translator)72 135.6 R 5.787(.T) -.55 G .788(he types allo)281.576 135.6 R .788(wed for v)-.25 F .788 (arious operators in the language)-.25 F 1.263 (are summarized on page 108 of the Jensen-W)72 147.6 R(irth)-.4 E/F2 10 /Times-Italic@0 SF 1.263(User Manual)3.763 F F0 6.263(.I)C 3.763(ti)346.95 147.6 S 3.763(si)356.273 147.6 S 1.263(mportant to kno)366.706 147.6 R 3.763 (wt)-.25 G 1.263(hat the P)446.635 147.6 R(ascal)-.15 E(translator)72 159.6 Q 2.5(,i)-.4 G 2.5(ni)117.15 159.6 S (ts diagnostics, distinguishes between the follo)127.43 159.6 Q (wing type `classes':)-.25 E 25.29(array Boolean)174.675 177.6 R 28.62 (char \214le)271.335 177.6 R(inte)367.995 177.6 Q(ger)-.15 E 17.5(pointer real) 174.675 189.6 R 20.29(record scalar)271.335 189.6 R(string)367.995 189.6 Q 1.182(These w)72 207.6 R 1.183 (ords are plugged into a great number of error messages.)-.1 F 1.183 (Thus, if you tried to assign an)6.183 F F2(inte)3.683 E -.1(ge)-.4 G(r).1 E F0 -.25(va)72 219.6 S(lue to a).25 E F2 -.15(ch)2.5 G(ar).15 E F0 -.25(va)2.5 G (riable you w).25 E(ould recei)-.1 E .3 -.15(ve a d)-.25 H(iagnostic lik).15 E 2.5(et)-.1 G(he follo)314.87 219.6 Q(wing:)-.25 E (/usr/libdata/pascal/pi3.1strings: No such \214le or directory)108 237.6 Q 1.156(In this case, one error produced a tw)72 255.6 R 3.655(ol)-.1 G 1.155 (ine error message.)236.935 255.6 R 1.155 (If the same error occurs more than once, the)6.155 F(same e)72 267.6 Q (xplanatory diagnostic will be gi)-.15 E -.15(ve)-.25 G 2.5(ne).15 G(ach time.) 246.98 267.6 Q F1(Scalar)72 291.6 Q F0 .174 (The only class whose meaning is not self-e)97 307.2 R .174 (xplanatory is `scalar'.)-.15 F .175(Scalar has a precise meaning in the)5.174 F(Jensen-W)72 319.2 Q(irth)-.4 E F2 .617(User Manual)3.117 F F0 .617 (where, in f)3.117 F .617(act, it refers to)-.1 F F2 -.15(ch)3.117 G(ar).15 E F0(,)A F2(inte)3.117 E -.1(ge)-.4 G(r).1 E F0(,)A F2 -.37(re)3.117 G(al).37 E F0 3.117(,a)C(nd)374.764 319.2 Q F2(Boolean)3.116 E F0 .616 (types as well as the)3.116 F 1.222(enumerated types.)72 331.2 R -.15(Fo)6.223 G 3.723(rt).15 G 1.223(he purposes of the P)172.448 331.2 R 1.223 (ascal translator)-.15 F 3.723(,s)-.4 G 1.223 (calar in an error message refers to a user)329.486 331.2 R(-)-.2 E (de\214ned, enumerated type, such as)72 343.2 Q F2(ops)2.5 E F0(in the e)2.5 E (xample abo)-.15 E .3 -.15(ve o)-.15 H(r).15 E F2(color)2.5 E F0(in)2.5 E F1 (type)108 361.2 Q F0(color)2.5 E/F3 10/Symbol SF(=)2.5 E F0 (\(red, green, blue\))2.5 E -.15(Fo)72 379.2 S 3.296(ri).15 G(nte)91.816 379.2 Q .796(gers, the more e)-.15 F .796(xplicit denotation)-.15 F F2(inte)3.295 E -.1(ge)-.4 G(r).1 E F0 .795(is used.)3.295 F .795(Although it w)5.795 F .795 (ould be correct, in the conte)-.1 F .795(xt of)-.15 F(the)72 391.2 Q F2 .646 (User Manual)3.146 F F0 .646(to refer to an inte)3.146 F .647(ger v)-.15 F .647 (ariable as a)-.25 F F2(scalar)3.147 E F0 -.25(va)3.147 G(riable).25 E F2(pi) 3.147 E F0 .647(prefers the more speci\214c identi\214ca-)3.147 F(tion.)72 403.2 Q F1(Function and pr)72 427.2 Q(ocedur)-.18 E 2.5(et)-.18 G(ype err) 180.81 427.2 Q(ors)-.18 E F0 -.15(Fo)97 442.8 S 3.37(rb).15 G .87 (uilt-in procedures and functions, tw)118.91 442.8 R 3.37(ok)-.1 G .869 (inds of errors occur)278.14 442.8 R 5.869(.I)-.55 G 3.369(ft)369.926 442.8 S .869(he routines are called with the)379.405 442.8 R(wrong number of ar)72 454.8 Q(guments a message similar to:)-.18 E (/usr/libdata/pascal/pi3.1strings: No such \214le or directory)108 472.8 Q (is gi)72 490.8 Q -.15(ve)-.25 G 2.5(n. If).15 F(the type of the ar)2.5 E (gument is wrong, a message lik)-.18 E(e)-.1 E (/usr/libdata/pascal/pi3.1strings: No such \214le or directory)108 508.8 Q .871 (is produced.)72 526.8 R 3.371(Af)5.871 G 1.371 -.25(ew f)141.543 526.8 T .871 (unctions and procedures implemented in P).25 F .872 (ascal 6000-3.4 are diagnosed as unimple-)-.15 F(mented in Berk)72 538.8 Q(ele) -.1 E 2.5(yP)-.15 G(ascal, notably those related to)157.98 538.8 Q F1 (segmented)2.5 E F0(\214les.)2.5 E F1(Can't r)72 562.8 Q (ead and write scalars, etc.)-.18 E F0 .005 (The messages which state that scalar \(user)97 578.4 R .004 (-de\214ned\) types cannot be written to and from \214les are often)-.2 F 2.5 (mysterious. It)72 590.4 R(is in f)2.5 E(act the case that if you de\214ne)-.1 E F1(type)108 608.4 Q F0(color)2.5 E F3(=)2.5 E F0(\(red, green, blue\))2.5 E -.74(``)72 626.4 S(standard').74 E 2.945('P)-.74 G .446(ascal does not associa\ te these constants with the strings `red', `green', and `blue' in an)126.075 626.4 R 2.946(yw)-.15 G(ay)492.71 626.4 Q(.)-.65 E .97(An e)72 638.4 R .97 (xtension has been added which allo)-.15 F .969 (ws enumerated types to be read and written, ho)-.25 F(we)-.25 E -.15(ve)-.25 G 3.469(ri).15 G 3.469(ft)464.852 638.4 S .969(he pro-)474.431 638.4 R .387 (gram is to be portable, you will ha)72 650.4 R .687 -.15(ve t)-.2 H 2.887(ow) .15 G .387(rite your o)241.783 650.4 R .387 (wn routines to perform these functions.)-.25 F .388(Standard P)5.388 F(as-) -.15 E .155(cal only allo)72 662.4 R .155(ws the reading of characters, inte) -.25 F .155(gers and real numbers from te)-.15 F .154(xt \214les.)-.15 F -1.1 (Yo)5.154 G 2.654(uc)1.1 G .154(annot read strings)432.592 662.4 R (or Booleans.)72 674.4 Q(It is possible to mak)5 E 2.5(ea)-.1 G F1(\214le of) 108 692.4 Q F0(color)2.5 E -.2(bu)72 710.4 S 2.5(tt).2 G (he representation is binary rather than string.)89.86 710.4 Q EP %%Page: 18 18 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 264.65(PSD:7-18 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q/F1 10/Times-Bold@0 SF(Expr)72 84 Q (ession diagnostics)-.18 E F0 .07 (The diagnostics for semantically ill-formed e)97 99.6 R .07(xpressions are v) -.15 F .07(ery e)-.15 F 2.57(xplicit. Consider)-.15 F .07(this sample trans-) 2.57 F(lation:)72 111.6 Q(%)108 129.6 Q F1(pi)2.5 E/F2 10/Symbol SF -5.488(--) 2.5 G F1 2.5(le)5.488 G(xpr)144.882 129.6 Q(.p)-1 E F0(%)108 141.6 Q .364 (This e)72 159.6 R .364(xample is admittedly f)-.15 F(ar)-.1 E .364 (-fetched, b)-.2 F .363(ut illustrates that the error messages are suf)-.2 F .363(\214ciently clear to allo)-.25 F(w)-.25 E (easy determination of the problem in the e)72 171.6 Q(xpressions.)-.15 E F1 -.74(Ty)72 195.6 S(pe equi).74 E -.1(va)-.1 G(lence).1 E F0(Se)97 211.2 Q -.15 (ve)-.25 G .167(ral diagnostics produced by the P).15 F .168 (ascal translator complain about `non-equi)-.15 F -.25(va)-.25 G .168 (lent types'.).25 F .168(In gen-)5.168 F .943(eral, Berk)72 223.2 R(ele)-.1 E 3.443(yP)-.15 G .943(ascal considers v)137.636 223.2 R .943(ariables to ha)-.25 F 1.243 -.15(ve t)-.2 H .943(he same type only if the).15 F 3.443(yw)-.15 G .943(ere declared with the same)393.599 223.2 R (constructed type or with the same type identi\214er)72 235.2 Q 5(.T)-.55 G (hus, the v)278.09 235.2 Q(ariables)-.25 E/F3 10/Times-Italic@0 SF(x)2.5 E F0 (and)2.5 E F3(y)2.5 E F0(declared as)2.5 E F1 -.1(va)108 253.2 S(r).1 E F0(x:) 118 265.2 Q F2<ad>2.5 E F0(inte)2.5 E(ger;)-.15 E(y:)118 277.2 Q F2<ad>2.5 E F0 (inte)2.5 E(ger;)-.15 E(do not ha)72 295.2 Q .3 -.15(ve t)-.2 H(he same type.) .15 E(The assignment)5 E 2.5(x:)108 313.2 S F2(=)118.28 313.2 Q F0(y)2.5 E (thus produces the diagnostics:)72 331.2 Q(Thus it is al)72 355.2 Q -.1(wa)-.1 G(ys necessary to declare a type such as).1 E F1(type)108 373.2 Q F0(intptr)2.5 E F2 2.5<3dad>2.5 G F0(inte)A(ger;)-.15 E(and use it to declare)72 391.2 Q F1 -.1(va)108 409.2 S(r).1 E F0(x: intptr; y: intptr;)2.5 E (Note that if we had initially declared)72 427.2 Q F1 -.1(va)108 445.2 S(r).1 E F0(x, y:)2.5 E F2<ad>2.5 E F0(inte)2.5 E(ger;)-.15 E (then the assignment statement w)72 463.2 Q(ould ha)-.1 E .3 -.15(ve w)-.2 H (ork).05 E 2.5(ed. The)-.1 F(statement)2.5 E(x)108 481.2 Q F2<ad>A F0(:)2.5 E F2(=)A F0(y)2.5 E F2<ad>A F0 1.106(is allo)72 499.2 R 1.106 (wed in either case.)-.25 F 1.106(Since the parameter to a)6.106 F F1(pr)3.606 E(ocedur)-.18 E(e)-.18 E F0(or)3.606 E F1(function)3.606 E F0 1.106 (must be declared with a type)3.606 F .003 (identi\214er rather than a constructed type, it is al)72 511.2 R -.1(wa)-.1 G .002(ys necessary).1 F 2.502(,i)-.65 G 2.502(np)327.234 511.2 S .002 (ractice, to declare an)339.736 511.2 R 2.502(yt)-.15 G .002(ype which will be) 432.614 511.2 R(used in this w)72 523.2 Q(ay)-.1 E(.)-.65 E F1(Unr)72 547.2 Q (eachable statements)-.18 E F0(Berk)97 562.8 Q(ele)-.1 E 3.724(yP)-.15 G 1.224 (ascal \215ags unreachable statements.)141.984 562.8 R 1.224 (Such statements usually correspond to errors in the)6.224 F .934 (program logic.)72 574.8 R .933(Note that a statement is considered to be reac\ hable if there is a potential path of control,)5.934 F -2.15 -.25(ev e)72 586.8 T 2.5(ni).25 G 2.5(fi)95.76 586.8 S 2.5(tc)104.37 586.8 S(an ne)114.09 586.8 Q -.15(ve)-.25 G 2.5(rb).15 G 2.5(et)155.34 586.8 S(ak)165.06 586.8 Q 2.5 (en. Thus,)-.1 F(no diagnostic is produced for the statement:)2.5 E F1(if)108 604.8 Q F0 -.1(fa)2.5 G(lse).1 E F1(then)2.5 E F0 (writeln\(\264impossible!\264\))118 616.8 Q F1(Goto')72 646.8 Q 2.5(si)-.37 G (nto structur)105.24 646.8 Q(ed statements)-.18 E F0 1.561 (The translator detects and complains about)97 662.4 R F1(goto)4.061 E F0 1.561 (statements which transfer control into structured)4.061 F .031(statements \() 72 674.4 R F1 -.25(fo)C(r).25 E F0(,)A F1(while)2.531 E F0 2.531(,e)C 2.531 (tc.\) It)169.883 674.4 R .031(does not allo)2.531 F 2.531(ws)-.25 G .03 (uch jumps, nor does it allo)261.168 674.4 R 2.53(wb)-.25 G .03 (ranching from the)381.93 674.4 R F1(then)2.53 E F0 .03(part of)2.53 F(an)72 686.4 Q F1(if)2.576 E F0 .076(statement into the)2.576 F F1(else)2.576 E F0 2.576(part. Such)2.576 F .077 (checks are made only within the body of a single procedure or func-)2.576 F (tion.)72 698.4 Q EP %%Page: 19 19 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7-19)464.55 48 Q/F1 10/Times-Bold@0 SF (Unused v)72 84 Q(ariables, ne)-.1 E -.1(ve)-.15 G 2.5(rs).1 G(et v)180.54 84 Q (ariables)-.1 E F0(Although)97 99.6 Q/F2 10/Times-Italic@0 SF(pi)2.633 E F0(al) 2.633 E -.1(wa)-.1 G .133(ys clears v).1 F .133(ariables to 0 at)-.25 F F1(pr) 2.633 E(ocedur)-.18 E(e)-.18 E F0(and)2.632 E F1(function)2.632 E F0(entry) 2.632 E(,)-.65 E F2(pc)2.632 E F0 .132(does not unless runtime)2.632 F .609 (checking is enabled using the)72 111.6 R F1(C)3.109 E F0 3.109(option. It) 3.109 F(is)3.109 E F1(not)3.109 E F0 .61 (good programming practice to rely on this initialization.)3.109 F 1.6 -.8 (To d)72 123.6 T (iscourage this practice, and to help detect errors in program logic,).8 E F2 (pi)2.5 E F0(\215ags as a `w' w)2.5 E(arning error:)-.1 E 14.17(1\) Use)97 139.2 R(of a v)2.5 E(ariable which is ne)-.25 E -.15(ve)-.25 G 2.5(ra).15 G (ssigned a v)257.14 139.2 Q(alue.)-.25 E 14.17(2\) A)97 154.8 R -.25(va)3.044 G .543(riable which is declared b).25 F .543(ut ne)-.2 F -.15(ve)-.25 G 3.043(ru) .15 G .543(sed, distinguishing between those v)286.852 154.8 R .543 (ariables for which)-.25 F -.25(va)122 166.8 S(lues are computed b).25 E (ut which are ne)-.2 E -.15(ve)-.25 G 2.5(ru).15 G (sed, and those completely unused.)292.49 166.8 Q .435(In f)72 182.4 R .435 (act, these diagnostics are applied to all declared items.)-.1 F .435(Thus a) 5.435 F F1(const)2.935 E F0 .435(or a)2.935 F F1(pr)2.935 E(ocedur)-.18 E(e) -.18 E F0 .435(which is declared)2.935 F -.2(bu)72 194.4 S 2.735(tn).2 G -2.15 -.25(ev e)92.315 194.4 T 2.735(ru).25 G .235(sed is \215agged.)116.86 194.4 R (The)5.235 E F1(w)2.735 E F0 .235(option of)2.735 F F2(pi)2.735 E F0 .235 (may be used to suppress these w)2.735 F .235(arnings; see sections 5.1 and)-.1 F(5.2.)72 206.4 Q F1 2.5(3.3. T)72 230.4 R(ranslator panics, i/o err)-.74 E (ors)-.18 E -.1(Pa)72 254.4 S(nics).1 E F0 .101 (One class of error which rarely occurs, b)97 270 R .102 (ut which causes termination of all processing when it does is)-.2 F 2.5(ap)72 282 S 2.5(anic. A)83.94 282 R(panic indicates a translator)2.5 E (-detected internal inconsistenc)-.2 E 3.8 -.65(y. A)-.15 H (typical panic message is:)3.15 E(snark \(rv)108 300 Q(alue\) line)-.25 E/F3 10 /Symbol SF(=)A F0(110 yyline)A F3(=)A F0(109)A(Snark in pi)108 312 Q 1.054 (If you recei)72 330 R 1.354 -.15(ve s)-.25 H 1.054(uch a message, the transla\ tion will be quickly and perhaps ungracefully terminated.).15 F -1.1(Yo)6.054 G (u)1.1 E .139 (should contact a teaching assistant or a member of the system staf)72 342 R .139(f, after sa)-.25 F .139(ving a cop)-.2 F 2.639(yo)-.1 G 2.639(fy)428.883 342 S .139(our program for)439.852 342 R .331(later inspection.)72 354 R .331 (If you were making changes to an e)5.331 F .33 (xisting program when the problem occurred, you may)-.15 F .356(be able to w)72 366 R .356(ork around the problem by ascertaining which change caused the)-.1 F F2(snark)2.857 E F0 .357(and making a dif)2.857 F(ferent)-.25 E 1.289 (change or correcting an error in the program.)72 378 R 3.789(As)6.289 G 1.289 (mall number of panics are possible in)282.151 378 R F2(px)3.789 E F0 6.288(.A) C 1.288(ll panics)469.102 378 R (should be reported to a teaching assistant or systems staf)72 390 Q 2.5(fs) -.25 G 2.5(ot)307.83 390 S(hat the)318.11 390 Q 2.5(yc)-.15 G(an be \214x) 356.84 390 Q(ed.)-.15 E F1(Out of memory)72 414 Q F0 .335(The only other error\ which will abort translation when no errors are detected is running out of me\ m-)97 429.6 R(ory)72 441.6 Q 5.815(.A)-.65 G .814(ll tables in the translator) 100.215 441.6 R 3.314(,w)-.4 G .814(ith the e)212.766 441.6 R .814 (xception of the parse stack, are dynamically allocated, and can)-.15 F(gro)72 453.6 Q 3.07(wt)-.25 G 3.07(ot)98.15 453.6 S(ak)109 453.6 Q 3.07(eu)-.1 G 3.07 (pt)130.85 453.6 S .57(he full a)141.7 453.6 R -.25(va)-.2 G .571 (ilable process space of 64000 bytes on the).25 F/F4 8/Times-Roman@0 SF(PDP) 3.071 E F0 3.071(-11. On)B(the)3.071 E F4 -1.08(VA)3.071 G(X)1.08 E F0 .571 (-11, table sizes)B 1.451(are e)72 465.6 R 1.451(xtremely generous and v)-.15 F 1.451(ery lar)-.15 F 1.451(ge \(25000\) line programs ha)-.18 F 1.751 -.15 (ve b)-.2 H 1.45(een easily accommodated.).15 F -.15(Fo)6.45 G 3.95(rt).15 G (he)494.56 465.6 Q F4(PDP)72 477.6 Q F0 .364 (\25511, it is generally true that the size of the lar)B .364 (gest translatable program is directly related to)-.18 F F1(pr)2.864 E(ocedur) -.18 E(e)-.18 E F0(and)72 489.6 Q F1(function)3.626 E F0 3.626(size. A)3.626 F 1.126(number of non-tri)3.626 F 1.125(vial P)-.25 F 1.125 (ascal programs, including some with more than 2000 lines)-.15 F 1.887 (and 2500 statements ha)72 501.6 R 2.187 -.15(ve b)-.2 H 1.888 (een translated and interpreted using Berk).15 F(ele)-.1 E 4.388(yP)-.15 G 1.888(ascal on)389.514 501.6 R F4(PDP)4.388 E F0(-11')A 4.388(s. Notable)-.55 F .474(among these are the P)72 513.6 R .474(ascal-S interpreter)-.15 F 2.974 (,al)-.4 G(ar)250.278 513.6 Q .474 (ge set of programs for automated generation of code genera-)-.18 F .003 (tors, and a general conte)72 525.6 R .003(xt-free parsing program which has b\ een used to parse sentences with a grammar for)-.15 F 2.905(as)72 537.6 S .405 (uperset of English.)83.235 537.6 R .404(In general, v)5.404 F .404(ery lar) -.15 F .404(ge programs should be translated using)-.18 F F2(pc)2.904 E F0 .404 (and the separate com-)2.904 F(pilation f)72 549.6 Q(acility)-.1 E(.)-.65 E .325(If you recei)97 565.2 R .626 -.15(ve a)-.25 H 2.826(no).15 G .326 (ut of space message from the translator during translation of a lar)172.872 565.2 R(ge)-.18 E F1(pr)2.826 E(ocedur)-.18 E(e)-.18 E F0(or)2.826 E F1 (function)72 577.2 Q F0 .896(or one containing a lar)3.397 F .896 (ge number of string constants you may yet be able to translate your pro-)-.18 F(gram if you break this one)72 589.2 Q F1(pr)2.5 E(ocedur)-.18 E(e)-.18 E F0 (or)2.5 E F1(function)2.5 E F0(into se)2.5 E -.15(ve)-.25 G(ral routines.).15 E F1(I/O err)72 613.2 Q(ors)-.18 E F0 .442 (Other errors which you may encounter when running)97 628.8 R F2(pi)2.942 E F0 .442(relate to input-output.)2.942 F(If)5.442 E F2(pi)2.942 E F0 .442 (cannot open the)2.942 F(\214le you specify)72 640.8 Q 2.5(,o)-.65 G 2.5(ri) 143.01 640.8 S 2.5(ft)151.62 640.8 S(he \214le is empty)160.23 640.8 Q 2.5(,y) -.65 G(ou will be so informed.)230.97 640.8 Q F1 2.5(3.4. Run-time)72 664.8 R (err)2.5 E(ors)-.18 E F0 2.402 -.8(We s)97 680.4 T -.15(aw).8 G 3.302(,i)-.5 G 3.302(no)136.714 680.4 S .802(ur second e)150.016 680.4 R .802 (xample, a run-time error)-.15 F 5.802(.W)-.55 G 3.302(eh)313.558 680.4 S .802 (ere gi)326.3 680.4 R 1.102 -.15(ve t)-.25 H .802 (he general description of run-time).15 F 2.5(errors. The)72 692.4 R (more unusual interpreter error messages are e)2.5 E (xplained brie\215y in the manual section for)-.15 E F2(px)2.5 E F0(\(1\).)2.5 E EP %%Page: 20 20 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 264.65(PSD:7-20 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q/F1 10/Times-Bold@0 SF(Start-up err)72 84 Q (ors)-.18 E F0 .437(These errors occur when the object \214le to be e)97 99.6 R -.15(xe)-.15 G .437(cuted is not a).15 F -.25(va)-.2 G .437 (ilable or appropriate.).25 F -.8(Ty)5.437 G .437(pical errors).8 F .564 (here are caused by the speci\214ed object \214le not e)72 111.6 R .564 (xisting, not being a P)-.15 F .564(ascal object, or being inaccessible to)-.15 F(the user)72 123.6 Q(.)-.55 E F1(Pr)72 147.6 Q(ogram execution err)-.18 E(ors) -.18 E F0 .148(These errors occur when the program interacts with the P)97 163.2 R .149(ascal runtime en)-.15 F .149(vironment in an inappropri-)-.4 F .103(ate w)72 175.2 R(ay)-.1 E 5.103(.T)-.65 G .103(ypical errors are v)115.086 175.2 R .102(alues or subscripts out of range, bad ar)-.25 F .102(guments to b) -.18 F .102(uilt-in functions, e)-.2 F(xceeding)-.15 E .513(the statement limi\ t because of an in\214nite loop, or running out of memory\210.)72 187.2 R .513 (The interpreter will produce a)5.513 F .314 (backtrace after the error occurs, sho)72 199.2 R .314(wing all the acti)-.25 F .614 -.15(ve r)-.25 H .314(outine calls, unless the).15 F F1(p)2.814 E F0 .314 (option w)2.814 F .315(as disabled when)-.1 F .719(the program w)72 211.2 R .718(as translated.)-.1 F(Unfortunately)5.718 E 3.218(,n)-.65 G 3.218(ov) 256.472 211.2 S .718(ariable v)269.44 211.2 R .718(alues are gi)-.25 F -.15(ve) -.25 G 3.218(na).15 G .718(nd no w)373.292 211.2 R .718(ay of e)-.1 F .718 (xtracting them is)-.15 F -.2(av)72 223.2 S(ailable.)-.05 E/F2 10/Symbol SF(*)A F0 .723(As an e)97 238.8 R .723(xample of such an error)-.15 F 3.222(,a)-.4 G .722(ssume that we ha)235.908 238.8 R 1.022 -.15(ve a)-.2 H .722 (ccidentally declared the constant).15 F/F3 10/Times-Italic@0 SF(n1)3.222 E F0 .722(to be 6,)3.222 F .567(instead of 7 on line 2 of the program primes as gi) 72 250.8 R -.15(ve)-.25 G 3.068(ni).15 G 3.068(ns)295.05 250.8 S .568 (ection 2.6 abo)307.008 250.8 R -.15(ve)-.15 G 5.568(.I).15 G 3.068(fw)385.062 250.8 S 3.068(er)398.68 250.8 S .568(un this program we get)409.518 250.8 R (the follo)72 262.8 Q(wing response.)-.25 E(%)108 280.8 Q F1(pix primes.p)2.5 E F0(%)108 292.8 Q .343(Here the interpreter indicates that the program terminat\ ed abnormally due to a subscript out of range)97 314.4 R (near line 14, which is eight lines into the body of the program primes.)72 326.4 Q F1(Interrupts)72 350.4 Q F0 .047(If the program is interrupted while e) 97 366 R -.15(xe)-.15 G .047(cuting and the).15 F F1(p)2.547 E F0 .047 (option w)2.547 F .047(as not speci\214ed, then a backtrace will)-.1 F .258 (be printed.\207)72 378 R .257(The \214le)5.257 F F3(pmon.out)2.757 E F0 .257 (of pro\214le information will be written if the program w)2.757 F .257 (as translated with the)-.1 F F1(z)72 390 Q F0(option enabled to)2.5 E F3(pi) 2.5 E F0(or)2.5 E F3(pix)2.5 E F0(.)A F1(I/O interaction err)72 414 Q(ors)-.18 E F0 1.227(The \214nal class of interpreter errors results from inappropriate \ interactions with \214les, including the)97 429.6 R(user')72 441.6 Q 2.503(st) -.55 G 2.503(erminal. Included)100.613 441.6 R .002 (here are bad formats for inte)2.503 F .002 (ger and real numbers \(such as no digits after the deci-)-.15 F (mal point\) when reading.)72 453.6 Q F1 2.5(4. Input/output)72 477.6 R F0 .564 (This section describes features of the P)97 493.2 R .564 (ascal input/output en)-.15 F .564(vironment, with special consideration of)-.4 F(the features peculiar to an interacti)72 505.2 Q .3 -.15(ve i)-.25 H (mplementation.).15 E F1 2.5(4.1. Intr)72 529.2 R(oduction)-.18 E F0 .561 (Our \214rst sample programs, in section 2, used the \214le)97 544.8 R F3 (output)3.061 E F0 5.56(.W)C 3.06(eg)356.52 544.8 S -2.25 -.2(av e)368.97 544.8 T -.15(ex)3.26 G .56(amples there of redirecting).15 F .942 (the output to a \214le and to the line printer using the shell.)72 556.8 R (Similarly)5.943 E 3.443(,w)-.65 G 3.443(ec)363.156 556.8 S .943 (an read the input from a \214le or)375.479 556.8 R(another program.)72 568.8 Q (Consider the follo)5 E(wing P)-.25 E (ascal program which is similar to the program)-.15 E F3(cat)2.5 E F0(\(1\).) 2.5 E(%)108 586.8 Q F1(pix)2.5 E F2 -5.488(--)2.5 G F1 2.5(lk)5.488 G (at.p <primes)151.002 586.8 Q F0(%)108 598.8 Q .76(Here we ha)72 616.8 R 1.06 -.15(ve u)-.2 H .76(sed the shell').15 F 3.26(ss)-.55 G .76 (yntax to redirect the program input from a \214le in)201.18 616.8 R F3(primes) 3.26 E F0 .76(in which we had)3.26 F .088 (placed the output of our prime number program of section 2.6.)72 628.8 R .088 (It is also possible to `pipe' input to this pro-)5.088 F 1.002 (gram much as we piped input to the line printer daemon)72 640.8 R F3(lpr)3.502 E F0 1.001(\(1\) before.)3.501 F 1.001(Thus, the same output as abo)6.001 F -.15(ve)-.15 G .32 LW 144 648.8 72 648.8 DL/F4 8/Times-Roman@0 SF .687(\210The\ checks for running out of memory are not foolproof and there is a chance that\ the interpreter will f)72 660.6 R(ault,)-.08 E (producing a core image when it runs out of memory)72 670.6 Q 4(.T)-.52 G (his situation occurs v)248.784 670.6 Q(ery rarely)-.12 E(.)-.52 E/F5 8/Symbol SF(*)72 682.4 Q F4 .441(On the)2.441 F/F6 6/Times-Roman@0 SF -.81(VA)2.441 G(X) .81 E F4 .441(-11, each v)B .442 (ariable is restricted to allocate at most 65000 bytes of storage \(this is a) -.2 F F6(PDP)2.442 E F4 .442(-11ism that)B(has survi)72 692.4 Q -.12(ve)-.2 G 2 (dt).12 G 2(ot)116.12 692.4 S(he)124.344 692.4 Q F6 -.81(VA)2 G(X).81 E F4(.\)) A(\207Occasionally)72 704.2 Q 2.263(,t)-.52 G .263(he P)123.735 704.2 R .263(a\ scal system will be in an inconsistent state when this occurs, e.g. when an in\ terrupt termi-)-.12 F .749(nates a)72 714.2 R/F7 8/Times-Bold@0 SF(pr)2.749 E (ocedur)-.144 E(e)-.144 E F4(or)2.75 E F7(function)2.75 E F4 .75(entry or e) 2.75 F 2.75(xit. In)-.12 F .75 (this case, the backtrace will only contain the current line.)2.75 F(A)4.75 E (re)72 724.2 Q -.12(ve)-.2 G(rse call order list of procedures will not be gi) .12 E -.12(ve)-.2 G(n.).12 E EP %%Page: 21 21 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7-21)464.55 48 Q -.1(wo)72 84 S (uld be produced by).1 E(%)108 102 Q/F1 10/Times-Bold@0 SF(cat primes | pix)2.5 E/F2 10/Symbol SF -5.488(--)2.5 G F1 2.5(lk)5.488 G(at.p)202.912 102 Q F0 .025 (All of these e)97 123.6 R .026 (xamples use the shell to control the input and output from \214les.)-.15 F .026(One v)5.026 F .026(ery simple w)-.15 F .026(ay to)-.1 F .335(associate P) 72 135.6 R .335(ascal \214les with named)-.15 F/F3 8/Times-Roman@0 SF(UNIX) 2.835 E F0 .334(\214les is to place the \214le name in the)2.835 F F1(pr)2.834 E(ogram)-.18 E F0 2.834(statement. F)2.834 F .334(or e)-.15 F(xam-)-.15 E .166 (ple, suppose we ha)72 147.6 R .466 -.15(ve p)-.2 H(re).15 E .166 (viously created the \214le)-.25 F/F4 10/Times-Italic@0 SF(data.)2.666 E F0 1.766 -.8(We t)5.166 H .167(hen use it as input to another v).8 F .167 (ersion of a listing)-.15 F(program.)72 159.6 Q(%)108 177.6 Q F1(cat data)2.5 E F0(line one.)108 189.6 Q(line tw)108 201.6 Q(o.)-.1 E(line three is the end.) 108 213.6 Q(%)108 225.6 Q F1(pix)2.5 E F2 -5.488(--)2.5 G F1 2.5(lc)5.488 G (opydata.p)149.882 225.6 Q F0(%)108 237.6 Q .59(By mentioning the \214le)72 255.6 R F4(data)3.09 E F0 .59(in the)3.09 F F1(pr)3.09 E(ogram)-.18 E F0 .59 (statement, we ha)3.09 F .89 -.15(ve i)-.2 H .59 (ndicated that we wish it to correspond to).15 F(the)72 267.6 Q F3(UNIX)2.942 E F0(\214le)2.942 E F4(data)2.942 E F0 5.443(.T)C .443 (hen, when we `reset\(data\)', the P)157.651 267.6 R .443 (ascal system opens our \214le `data' for reading.)-.15 F(More)5.443 E .217 (sophisticated, b)72 279.6 R .217(ut less portable, e)-.2 F .217 (xamples of using)-.15 F F3(UNIX)2.717 E F0 .217(\214les will be gi)2.717 F -.15(ve)-.25 G 2.716(ni).15 G 2.716(ns)376.054 279.6 S .216 (ections 4.5 and 4.6.)387.66 279.6 R .216(There is)5.216 F 2.96(ap)72 291.6 S .46(ortability problem e)84.4 291.6 R -.15(ve)-.25 G 2.96(nw).15 G .46 (ith this simple e)188.98 291.6 R 2.96(xample. Some)-.15 F -.15(Pa)2.96 G .46 (scal systems attach meaning to the ordering).15 F(of the \214le in the)72 303.6 Q F1(pr)2.5 E(ogram)-.18 E F0(statement \214le list.)2.5 E(Berk)5 E(ele) -.1 E 2.5(yP)-.15 G(ascal does not do so.)297.52 303.6 Q F1 2.5(4.2. Eof)72 327.6 R(and eoln)2.5 E F0 1.558(An e)97 343.2 R 1.558 (xtremely common problem encountered by ne)-.15 F 4.058(wu)-.25 G 1.558 (sers of P)326.076 343.2 R 1.557(ascal, especially in the interacti)-.15 F -.15 (ve)-.25 G(en)72 355.2 Q .291(vironment of)-.4 F .291(fered by)-.25 F F3(UNIX) 2.791 E F0 2.791(,r)C .291(elates to the de\214nitions of)197.756 355.2 R F4 (eof)2.791 E F0(and)2.791 E F4(eoln)2.791 E F0 5.291(.T)C .291 (hese functions are supposed to be)368.404 355.2 R .302(de\214ned at the be)72 367.2 R .301(ginning of e)-.15 F -.15(xe)-.15 G .301(cution of a P).15 F .301 (ascal program, indicating whether the input de)-.15 F .301(vice is at the end) -.25 F .32(of a line or the end of a \214le.)72 379.2 R(Setting)5.32 E F4(eof) 2.82 E F0(or)2.82 E F4(eoln)2.82 E F0 .321 (actually corresponds to an implicit read in which the input)2.821 F .065 (is inspected, b)72 391.2 R .064(ut no input is `)-.2 F .064(`used up')-.74 F 2.564('. In)-.74 F -.1(fa)2.564 G .064(ct, there is no w).1 F .064 (ay the system can kno)-.1 F 2.564(ww)-.25 G .064(hether the input is at) 422.084 391.2 R .587(the end-of-\214le or the end-of-line unless it attempts t\ o read a line from it.)72 403.2 R .588(If the input is from a pre)5.588 F (viously)-.25 E .735(created \214le, then this reading can tak)72 415.2 R 3.235 (ep)-.1 G .734(lace without run-time action by the user)235.895 415.2 R 5.734 (.H)-.55 G -.25(ow)414.624 415.2 S -2.15 -.25(ev e).25 H 1.534 -.4(r, i).25 H 3.234(ft).4 G .734(he input is)460.862 415.2 R .7 (from a terminal, then the input is what the user types.\207)72 427.2 R .7 (If the system were to do an initial read automati-)5.7 F .639(cally at the be) 72 439.2 R .639(ginning of program e)-.15 F -.15(xe)-.15 G .639 (cution, and if the input were a terminal, the user w).15 F .639(ould ha)-.1 F .939 -.15(ve t)-.2 H 3.138(ot).15 G(ype)489.56 439.2 Q 1.636 (some input before e)72 451.2 R -.15(xe)-.15 G 1.636(cution could be).15 F 4.136(gin. This)-.15 F -.1(wo)4.136 G 1.636(uld mak).1 F 4.136(ei)-.1 G 4.136 (ti)331.324 451.2 S 1.635(mpossible for the program to be)341.02 451.2 R 1.635 (gin by)-.15 F(prompting for input or printing a herald.)72 463.2 Q(Berk)97 478.8 Q(ele)-.1 E 2.542(yP)-.15 G .042 (ascal has been designed so that an initial read is not necessary)140.802 478.8 R 5.042(.A)-.65 G 2.542(ta)402.826 478.8 S .343 -.15(ny g)412.588 478.8 T -2.15 -.25(iv e).15 H 2.543(nt).25 G .043(ime, the P)452.124 478.8 R(as-)-.15 E 1.078 (cal system may or may not kno)72 490.8 R 3.578(ww)-.25 G 1.078 (hether the end-of-\214le or end-of-line conditions are true.)221.228 490.8 R 1.078(Thus, inter)6.078 F(-)-.2 E(nally)72 502.8 Q 3.001(,t)-.65 G .501 (hese functions can ha)99.631 502.8 R .801 -.15(ve t)-.2 H .501(hree v).15 F .501(alues \255 true, f)-.25 F .501(alse, and `)-.1 F .501(`I don')-.74 F 3.002 (tk)-.18 G(no)362.924 502.8 Q 3.002(wy)-.25 G .502(et; if you ask me I')387.896 502.8 R .502(ll ha)-.1 F .802 -.15(ve t)-.2 H(o).15 E .378(\214nd out')72 514.8 R 2.878('. All)-.74 F .378 (\214les remain in this last, indeterminate state until the P)2.878 F .378 (ascal program requires a v)-.15 F .377(alue for)-.25 F F4(eof)2.877 E F0(or)72 526.8 Q F4(eoln)3.101 E F0 .602(either e)3.101 F .602(xplicitly or implicitly) -.15 F 3.102(,e)-.65 G .602(.g. in a call to)230.08 526.8 R F4 -.37(re)3.102 G (ad).37 E F0 5.602(.T)C .602(he important point to note here is that if you) 322.202 526.8 R .118(force the P)72 538.8 R .117(ascal system to determine whe\ ther the input is at the end-of-\214le or the end-of-line, it will be nec-)-.15 F(essary for it to attempt to read from the input.)72 550.8 Q (Thus consider the follo)97 566.4 Q(wing e)-.25 E(xample code)-.15 E F1 (while not)108 584.4 Q F0(eof)2.5 E F1(do begin)2.5 E F0(write\(\264number)118 596.4 Q 2.5(,p)-.4 G(lease? \264\);)185.36 596.4 Q(read\(i\);)118 608.4 Q (writeln\(\264that w)118 620.4 Q(as a \264, i: 2\))-.1 E F1(end)108 632.4 Q F0 .908(At \214rst glance, this may be appear to be a correct program for request\ ing, reading and echoing numbers.)72 650.4 R .564(Notice, ho)72 662.4 R(we)-.25 E -.15(ve)-.25 G 1.364 -.4(r, t).15 H .564(hat the).4 F F1(while)3.064 E F0 .564(loop asks whether)3.064 F F4(eof)3.064 E F0 .564(is true)3.064 F F4(befor) 3.064 E(e)-.37 E F0 .564(the request is printed.)3.064 F .563(This will force) 5.564 F 1.047(the P)72 674.4 R 1.048 (ascal system to decide whether the input is at the end-of-\214le.)-.15 F 1.048 (The P)6.048 F 1.048(ascal system will gi)-.15 F 1.348 -.15(ve n)-.25 H 3.548 (om).15 G(es-)492.34 674.4 Q .147(sages; it will simply w)72 686.4 R .147 (ait for the user to type a line.)-.1 F .147 (By producing the desired prompting before testing)5.147 F F4(eof)2.646 E(,)-.1 E F0(the follo)72 698.4 Q(wing code a)-.25 E -.2(vo)-.2 G(ids this problem:).2 E .32 LW 144 706.4 72 706.4 DL F3 .302(\207It is not possible to determine whe\ ther the input is a terminal, as the input may appear to be a \214le b)72 718.2 R .302(ut actually)-.16 F(be a)72 728.2 Q/F5 8/Times-Italic@0 SF(pipe)2 E(,) -.08 E F3(the output of a program which is reading from the terminal.)2 E EP %%Page: 22 22 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 264.65(PSD:7-22 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q(write\(\264number)108 84 Q 2.5(,p)-.4 G (lease ?\264\);)175.36 84 Q/F1 10/Times-Bold@0 SF(while not)108 96 Q F0(eof)2.5 E F1(do begin)2.5 E F0(read\(i\);)118 108 Q(writeln\(\264that w)118 120 Q (as a \264, i:2\);)-.1 E(write\(\264number)118 132 Q 2.5(,p)-.4 G (lease ?\264\))185.36 132 Q F1(end)108 144 Q F0 .166 (The user must still type a line before the)72 162 R F1(while)2.666 E F0 .166 (test is completed, b)2.666 F .166(ut the prompt will ask for it.)-.2 F .167 (This e)5.167 F(xam-)-.15 E .249(ple, ho)72 174 R(we)-.25 E -.15(ve)-.25 G 1.049 -.4(r, i).15 H 2.749(ss).4 G .249(till not correct.)141.407 174 R 1.849 -.8(To u)5.249 H .249(nderstand wh).8 F 1.549 -.65(y, i)-.05 H 2.749(ti).65 G 2.749<738c>298.86 174 S .249(rst necessary to kno)311.059 174 R 1.549 -.65 (w, a)-.25 H 2.749(sw).65 G 2.749(ew)420.824 174 S .249(ill discuss belo) 435.233 174 R -.65(w,)-.25 G .053 (that there is a blank character at the end of each line in a P)72 186 R .054 (ascal te)-.15 F .054(xt \214le.)-.15 F(The)5.054 E/F2 10/Times-Italic@0 SF -.37(re)2.554 G(ad).37 E F0 .054(procedure, when reading)2.554 F(inte)72 198 Q .175(gers or real numbers, is de\214ned so that, if there are only blanks left\ in the \214le, it will return a zero v)-.15 F(alue)-.25 E .249 (and set the end-of-\214le condition.)72 210 R .249(If, ho)5.249 F(we)-.25 E -.15(ve)-.25 G 1.049 -.4(r, t).15 H .25 (here is a number remaining in the \214le, the end-of-\214le condi-).4 F .116 (tion will not be set e)72 222 R -.15(ve)-.25 G 2.615(ni).15 G 2.615(fi)173.405 222 S 2.615(ti)182.13 222 S 2.615(st)190.305 222 S .115(he last number)199.59 222 R 2.615(,a)-.4 G(s)267.855 222 Q F2 -.37(re)2.615 G(ad).37 E F0(ne)2.615 E -.15(ve)-.25 G 2.615(rr).15 G .115(eads the blanks after the number)322.69 222 R 2.615(,a)-.4 G .115(nd there is)462.11 222 R(al)72 234 Q -.1(wa)-.1 G (ys at least one blank.).1 E (Thus the modi\214ed code will still put out a spurious)5 E(that w)108 252 Q (as a 0)-.1 E .497 (at the end of a session with it when the end-of-\214le is reached.)72 270 R .498(The simplest w)5.498 F .498(ay to correct the problem in)-.1 F .613 (this e)72 282 R .613(xample is to use the procedure)-.15 F F2 -.37(re)3.113 G (adln).37 E F0 .613(instead of)3.113 F F2 -.37(re)3.113 G(ad).37 E F0 3.113 (here. In)3.113 F .612(general, unless we test the end-of-\214le)3.113 F 1.344 (condition both before and after calls to)72 294 R F2 -.37(re)3.844 G(ad).37 E F0(or)3.844 E F2 -.37(re)3.844 G(adln).37 E F0 3.844(,t)C 1.344 (here will be inputs for which our program will)307.718 294 R (attempt to read past end-of-\214le.)72 306 Q F1 2.5(4.3. Mor)72 330 R 2.5(ea) -.18 G(bout eoln)122.64 330 Q F0 2.031 -.8(To h)97 345.6 T -2.25 -.2(av e).8 H 2.931(ag)3.131 G .431(ood understanding of when)144.073 345.6 R F2(eoln)2.931 E F0 .43(will be true it is necessary to kno)2.931 F 2.93(wt)-.25 G .43 (hat in an)425.22 345.6 R 2.93<798c>-.15 G .43(le there)473.86 345.6 R .43 (is a special character indicating end-of-line, and that, in ef)72 357.6 R .431 (fect, the P)-.25 F .431(ascal system al)-.15 F -.1(wa)-.1 G .431 (ys reads one charac-).1 F .532(ter ahead of the P)72 369.6 R(ascal)-.15 E F2 -.37(re)3.032 G(ad).37 E F0 3.032(commands.\207 F)3.032 F .532 (or instance, in response to `read\(ch\)', the system sets)-.15 F F2 -.15(ch) 3.031 G F0 .531(to the)3.181 F .51(current input character and gets the ne)72 381.6 R .51(xt input character)-.15 F 5.51(.I)-.55 G 3.01(ft)309.43 381.6 S .51 (he current input character is the last character)318.55 381.6 R .08 (of the line, then the ne)72 393.6 R .08 (xt input character from the \214le is the ne)-.15 F .08(w-line character)-.25 F 2.58(,t)-.4 G .08(he normal)392.05 393.6 R/F3 8/Times-Roman@0 SF(UNIX)2.58 E F0 .079(line separa-)2.579 F(tor)72 405.6 Q 5.481(.W)-.55 G .481 (hen the read routine gets the ne)99.981 405.6 R .481(w-line character)-.25 F 2.981(,i)-.4 G 2.981(tr)300.619 405.6 S .481 (eplaces that character by a blank \(causing e)309.71 405.6 R -.15(ve)-.25 G (ry).15 E .203(line to end with a blank\) and sets)72 417.6 R F2(eoln)2.703 E F0 .203(to true.)2.703 F F2(Eoln)5.203 E F0 .202 (will be true as soon as we read the last character of the)2.703 F .917 (line and)72 429.6 R F1(bef)3.417 E(or)-.25 E(e)-.18 E F0 .918 (we read the blank character corresponding to the end of line.)3.418 F .918 (Thus it is almost al)5.918 F -.1(wa)-.1 G .918(ys a).1 F(mistak)72 441.6 Q 2.5 (et)-.1 G 2.5(ow)108.29 441.6 S (rite a program which deals with input in the follo)123.01 441.6 Q(wing w)-.25 E(ay:)-.1 E(read\(ch\);)108 459.6 Q F1(if)108 471.6 Q F0(eoln)2.5 E F1(then)2.5 E F2(Done with line)118 483.6 Q F1(else)108 495.6 Q F2(Normal pr)118 507.6 Q (ocessing)-.45 E F0 .098(as this will almost surely ha)72 525.6 R .398 -.15 (ve t)-.2 H .098(he ef).15 F .098 (fect of ignoring the last character in the line.)-.25 F .097 (The `read\(ch\)' belongs as)5.098 F(part of the normal processing.)72 537.6 Q (Gi)97 553.2 Q -.15(ve)-.25 G 2.5(nt).15 G(his frame)126.32 553.2 Q -.1(wo)-.25 G(rk, it is not hard to e).1 E(xplain the function of a)-.15 E F2 -.37(re)2.5 G (adln).37 E F0(call, which is de\214ned as:)2.5 E F1(while not)108 571.2 Q F0 (eoln)2.5 E F1(do)2.5 E F0(get\(input\);)118 583.2 Q(get\(input\);)108 595.2 Q .412(This adv)72 613.2 R .413(ances the \214le until the blank corresponding t\ o the end-of-line is the current input symbol and then)-.25 F .566 (discards this blank.)72 625.2 R .566(The ne)5.566 F .566(xt character a)-.15 F -.25(va)-.2 G .566(ilable from).25 F F2 -.37(re)3.066 G(ad).37 E F0 .566 (will therefore be the \214rst character of the ne)3.066 F(xt)-.15 E (line, if one e)72 637.2 Q(xists.)-.15 E F1 2.5(4.4. Output)72 661.2 R -.2(bu) 2.5 G(ffering).2 E F0 3.463<418c>97 676.8 S .963(nal point about P)113.243 676.8 R .964(ascal input-output must be noted here.)-.15 F .964 (This concerns the b)5.964 F(uf)-.2 E .964(fering of the \214le)-.25 F F2 (output)72 688.8 Q F0 5.455(.I)C 2.955(ti)108.845 688.8 S 2.955(se)117.36 688.8 S .455(xtremely inef)128.495 688.8 R .455(\214cient for the P)-.25 F .454 (ascal system to send each character to the user')-.15 F 2.954(st)-.55 G .454 (erminal as the)446.992 688.8 R .362(program generates it for output; e)72 700.8 R -.15(ve)-.25 G 2.862(nl).15 G .362(ess ef)227.632 700.8 R .362 (\214cient if the output is the input of another program such as the)-.25 F .32 LW 144 708.8 72 708.8 DL F3(\207In P)72 720.6 Q (ascal terms, `read\(ch\)' corresponds to `ch :)-.12 E/F4 8/Symbol SF(=)A F3 (input^; get\(input\)')2 E EP %%Page: 23 23 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7-23)464.55 48 Q 1.092 (line printer daemon)72 84 R/F1 10/Times-Italic@0 SF(lpr)3.592 E F0 3.591 (\(1\). T)3.592 F 3.591(og)-.8 G 1.091(ain ef)210.46 84 R(\214cienc)-.25 E 2.391 -.65(y, t)-.15 H 1.091(he P).65 F 1.091(ascal system `)-.15 F(`b)-.74 E (uf)-.2 E(fers')-.25 E 3.591('t)-.74 G 1.091(he output characters \(i.e. it) 392.996 84 R(sa)72 96 Q -.15(ve)-.2 G 3.532(st).15 G 1.032 (hem in memory until the b)99.622 96 R(uf)-.2 E 1.032 (fer is full and then emits the entire b)-.25 F(uf)-.2 E 1.033 (fer in one system interaction.\))-.25 F(Ho)72 108 Q(we)-.25 E -.15(ve)-.25 G 2.691 -.4(r, t).15 H 4.391(oa).4 G(llo)131.102 108 Q 4.391(wi)-.25 G(nteracti) 155.803 108 Q 2.191 -.15(ve p)-.25 H 1.891(rompting to w).15 F 1.891 (ork as in the e)-.1 F 1.89(xample gi)-.15 F -.15(ve)-.25 G 4.39(na).15 G(bo) 392.57 108 Q -.15(ve)-.15 G 4.39(,t).15 G 1.89(his prompt must be)421.38 108 R .251(printed before the P)72 120 R .251(ascal system w)-.15 F .251 (aits for a response.)-.1 F -.15(Fo)5.251 G 2.751(rt).15 G .251(his reason, P) 312.4 120 R .252(ascal normally prints all the output)-.15 F (which has been generated for the \214le)72 132 Q F1(output)2.5 E F0(whene)2.5 E -.15(ve)-.25 G(r).15 E 14.17(1\) A)97 147.6 R F1(writeln)2.5 E F0(occurs, or) 2.5 E 14.17(2\) The)97 163.2 R(program reads from the terminal, or)2.5 E 14.17 (3\) The)97 178.8 R(procedure)2.5 E F1(messa)2.5 E -.1(ge)-.1 G F0(or)2.6 E F1 (\215ush)2.5 E F0(is called.)2.5 E(Thus, in the code sequence)72 194.4 Q/F2 10 /Times-Bold@0 SF -.25(fo)108 212.4 S(r).25 E F0 2.5(i:)2.5 G/F3 10/Symbol SF(=) 131.08 212.4 Q F0 2.5(1t)2.5 G 2.5(o5)149.35 212.4 S F2(do begin)A F0 (write\(i: 2\);)118 224.4 Q F1(Compute a lot with no output)118 236.4 Q F2 (end;)108 248.4 Q F0(writeln)108 260.4 Q .865(the output inte)72 278.4 R .865 (gers will not print until the)-.15 F F1(writeln)3.364 E F0 3.364(occurs. The) 3.364 F .864(delay can be some)3.364 F .864(what disconcerting, and)-.25 F .04 (you should be a)72 290.4 R -.1(wa)-.15 G .04(re that it will occur).1 F 5.04 (.B)-.55 G 2.54(ys)236.5 290.4 S .04(etting the)247.93 290.4 R F2(b)2.54 E F0 .04(option to 0 before the)2.54 F F2(pr)2.54 E(ogram)-.18 E F0 .04 (statement by insert-)2.54 F(ing a comment of the form)72 302.4 Q(\()108 320.4 Q F3(*)A F0($b0)A F3(*)A F0(\))A .213(we can cause)72 338.4 R F1(output)2.712 E F0 .212(to be completely unb)2.712 F(uf)-.2 E .212 (fered, with a corresponding horrendous de)-.25 F .212(gradation in program) -.15 F(ef)72 350.4 Q(\214cienc)-.25 E 3.8 -.65(y. O)-.15 H (ption control in comments is discussed in section 5.).65 E F2 2.5(4.5. Files,) 72 374.4 R -.18(re)2.5 G(set, and r).18 E(ewrite)-.18 E F0 1.157 (It is possible to use e)97 390 R 1.157(xtended forms of the b)-.15 F 1.157 (uilt-in functions)-.2 F F1 -.37(re)3.657 G(set).37 E F0(and)3.657 E F1 -1.91 -.37(re w)3.657 H(rite).37 E F0 1.157(to get more general)3.657 F .816 (associations of)72 402 R/F4 8/Times-Roman@0 SF(UNIX)3.316 E F0 .816 (\214le names with P)3.316 F .816(ascal \214le v)-.15 F 3.316(ariables. When) -.25 F 3.316<618c>3.316 G .816(le other than)354.148 402 R F1(input)3.315 E F0 (or)3.315 E F1(output)3.315 E F0 .815(is to be)3.315 F .788 (read or written, then the reading or writing must be preceded by a)72 414 R F1 -.37(re)3.288 G(set).37 E F0(or)3.288 E F1 -1.91 -.37(re w)3.288 H(rite).37 E F0 3.288(call. In)3.288 F .788(general, if the)3.288 F -.15(Pa)72 426 S .825 (scal \214le v).15 F .825(ariable has ne)-.25 F -.15(ve)-.25 G 3.325(rb).15 G .824(een used before, there will be no)198.905 426 R F4(UNIX)3.324 E F0 .824 (\214lename associated with it.)3.324 F .824(As we)5.824 F(sa)72 438 Q 3.326 (wi)-.15 G 3.326(ns)93.506 438 S .827 (ection 2.9, by mentioning the \214le in the)105.722 438 R F2(pr)3.327 E(ogram) -.18 E F0 .827(statement, we could cause a)3.327 F F4(UNIX)3.327 E F0 .827 (\214le with the)3.327 F .113(same name as the P)72 450 R .113(ascal v)-.15 F .113(ariable to be associated with it.)-.25 F .113 (If we do not mention a \214le in the)5.113 F F2(pr)2.612 E(ogram)-.18 E F0 (state-)2.612 E(ment and use it for the \214rst time with the statement)72 462 Q(reset\(f\))108 480 Q(or)72 498 Q(re)108 516 Q(write\(f\))-.25 E 1.325 (then the P)72 534 R 1.325(ascal system will generate a temporary name of the \ form `tmp.x' for some character `x', and)-.15 F .448(associate this)72 546 R F4 (UNIX)2.948 E F0 .447(\214le name name with the P)2.947 F .447(ascal \214le.) -.15 F .447(The \214rst such generated name will be `tmp.1' and)5.447 F .229 (the names continue by incrementing their last character through the)72 558 R F4(ASCII)2.729 E F0 2.729(set. The)2.729 F(adv)2.729 E .229 (antage of using such)-.25 F .03(temporary \214les is that the)72 570 R 2.53 (ya)-.15 G .03(re automatically)185.6 570 R F1 -.37(re)2.53 G(mo).37 E(ve)-.1 E F0 2.529(db)C 2.529(yt)294.359 570 S .029(he P)304.668 570 R .029 (ascal system as soon as the)-.15 F 2.529(yb)-.15 G .029(ecome inacces-)442.611 570 R 2.5(sible. The)72 582 R 2.5(ya)-.15 G(re not remo)125.73 582 Q -.15(ve) -.15 G(d, ho).15 E(we)-.25 E -.15(ve)-.25 G .8 -.4(r, i).15 H 2.5(far).4 G (untime error causes termination while the)248.23 582 Q 2.5(ya)-.15 G (re in scope.)426.38 582 Q 2.912 -.8(To c)97 597.6 T 1.312(ause a particular).8 F F4(UNIX)3.812 E F0 1.312(pathname to be associated with a P)3.812 F 1.312 (ascal \214le v)-.15 F 1.313(ariable we can gi)-.25 F 1.613 -.15(ve t)-.25 H (hat).15 E .353(name in the)72 609.6 R F1 -.37(re)2.853 G(set).37 E F0(or)2.853 E F1 -1.91 -.37(re w)2.853 H(rite).37 E F0 .353(call, e.g. we could ha)2.853 F .653 -.15(ve a)-.2 H .353(ssociated the P).15 F .353(ascal \214le)-.15 F F1 (data)2.853 E F0 .353(with the \214le `primes' in)2.853 F(our e)72 621.6 Q (xample in section 3.1 by doing:)-.15 E(reset\(data, \264primes\264\))108 639.6 Q(instead of a simple)72 657.6 Q(reset\(data\))108 675.6 Q .424(In this case i\ t is not essential to mention `data' in the program statement, b)72 693.6 R .424(ut it is still a good idea because)-.2 F .151(is serv)72 705.6 R .151 (es as an aid to program documentation.)-.15 F .151(The second parameter to) 5.151 F F1 -.37(re)2.65 G(set).37 E F0(and)2.65 E F1 -1.91 -.37(re w)2.65 H (rite).37 E F0 .15(may be an)2.65 F 2.65(ys)-.15 G(tring)485.11 705.6 Q -.25 (va)72 717.6 S .427(lue, including a v).25 F 2.927(ariable. Thus)-.25 F .427 (the names of)2.927 F F4(UNIX)2.928 E F0 .428(\214les to be associated with P) 2.928 F .428(ascal \214le v)-.15 F .428(ariables can be)-.25 F (read in at run time.)72 729.6 Q(Full details on \214le name/\214le v)5 E (ariable associations are gi)-.25 E -.15(ve)-.25 G 2.5(ni).15 G 2.5(ns)394.65 729.6 S(ection A.3.)406.04 729.6 Q EP %%Page: 24 24 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 264.65(PSD:7-24 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q/F1 10/Times-Bold@0 SF 2.5(4.6. Ar)72 84 R (gc and ar)-.1 E(gv)-.1 E F0(Each)97 99.6 Q/F2 8/Times-Roman@0 SF(UNIX)4.177 E F0 1.677(process recei)4.177 F -.15(ve)-.25 G 4.177(sav).15 G 1.677 (ariable length sequence of ar)229.407 99.6 R 1.676 (guments each of which is a v)-.18 F(ariable)-.25 E .042 (length character string.)72 111.6 R .043(The b)5.043 F .043(uilt-in function) -.2 F/F3 10/Times-Italic@0 SF(ar)2.543 E(gc)-.37 E F0 .043(and the b)2.543 F .043(uilt-in procedure)-.2 F F3(ar)2.543 E(gv)-.37 E F0 .043 (can be used to access and)2.543 F 1.046(process these ar)72 123.6 R 3.546 (guments. The)-.18 F -.25(va)3.546 G 1.045(lue of the function).25 F F3(ar) 3.545 E(gc)-.37 E F0 1.045(is the number of ar)3.545 F 1.045 (guments to the process.)-.18 F(By)6.045 E(con)72 135.6 Q -.15(ve)-.4 G .478 (ntion, the ar).15 F .478(guments are treated as an array)-.18 F 2.978(,a)-.65 G .478(nd inde)279.934 135.6 R -.15(xe)-.15 G 2.978(df).15 G .478(rom 0 to) 330.58 135.6 R F3(ar)2.978 E(gc)-.37 E F0 .479(\2551, with the zeroth ar)B (gument)-.18 E .143(being the name of the program being e)72 147.6 R -.15(xe) -.15 G 2.643(cuted. The).15 F .143(rest of the ar)2.643 F .142 (guments are those passed to the command)-.18 F(on the command line.)72 159.6 Q (Thus, the command)5 E(%)108 177.6 Q F1 2.5(obj /etc/motd /usr/dict/w)2.5 F (ords hello)-.1 E F0 .309(will in)72 195.6 R -.2(vo)-.4 G .509 -.1(ke t).2 H .309(he program in the \214le).1 F F3(obj)2.809 E F0(with)2.809 E F3(ar)2.809 E (gc)-.37 E F0(ha)2.809 E .309(ving a v)-.2 F .309(alue of 4.)-.25 F .309 (The zeroth element accessed by)5.309 F F3(ar)2.809 E(gv)-.37 E F0 (will be `obj', the \214rst `/etc/motd', etc.)72 207.6 Q -.15(Pa)97 223.2 S .049(scal does not pro).15 F .049(vide v)-.15 F .049 (ariable size arrays, nor does it allo)-.25 F 2.549(wc)-.25 G .048 (haracter strings of v)350.019 223.2 R .048(arying length.)-.25 F -.15(Fo)5.048 G(r).15 E(this reason,)72 235.2 Q F3(ar)2.5 E(gv)-.37 E F0 (is a procedure and has the syntax)2.5 E(ar)108 253.2 Q(gv\(i, a\))-.18 E (where)72 271.2 Q F3(i)2.791 E F0 .291(is an inte)2.791 F .291(ger and)-.15 F F3(a)2.791 E F0 .291(is a string v)2.791 F 2.791(ariable. This)-.25 F .291 (procedure call assigns the \(possibly truncated or blank)2.791 F(padded\))72 283.2 Q F3(i)3.177 E F0 -.18('t)1.666 G 3.177(ha).18 G -.18(rg)130.38 283.2 S .677(ument of the current process to the string v).18 F(ariable)-.25 E F3(a) 3.176 E F0 5.676(.T)C .676(he \214le manipulation routines)365.006 283.2 R F3 -.37(re)3.176 G(set).37 E F0(and)72 295.2 Q F3 -1.91 -.37(re w)2.871 H(rite).37 E F0 .372(will strip trailing blanks from their optional second ar)2.871 F .372 (guments so that this blank padding is not)-.18 F 2.5(ap)72 307.2 S (roblem in the usual case where the ar)83.94 307.2 Q(guments are \214le names.) -.18 E 2.028 -.8(We a)97 322.8 T .428(re no).8 F 2.928(wr)-.25 G .428 (eady to gi)151.374 322.8 R .728 -.15(ve a B)-.25 H(erk).15 E(ele)-.1 E 2.928 (yP)-.15 G .428(ascal program `kat', based on that gi)255.194 322.8 R -.15(ve) -.25 G 2.927(ni).15 G 2.927(ns)423.309 322.8 S .427(ection 3.1 abo)435.126 322.8 R -.15(ve)-.15 G(,).15 E(which can be used with the same syntax as the)72 334.8 Q F2(UNIX)2.5 E F0(system program)2.5 E F3(cat)2.5 E F0(\(1\).)2.5 E(%) 108 352.8 Q F1(cat kat.p)2.5 E F0(program kat\(input, output\);)108 364.8 Q -.25(va)108 376.8 S(r).25 E(ch: char;)118 388.8 Q(i: inte)118 400.8 Q(ger;)-.15 E(name: pack)118 412.8 Q(ed array [1..100] of char;)-.1 E(be)108 424.8 Q(gin) -.15 E 2.5(i:)118 436.8 S/F4 10/Symbol SF(=)126.06 436.8 Q F0(1;)2.5 E(repeat) 118 448.8 Q(if i < ar)128 460.8 Q(gc then be)-.18 E(gin)-.15 E(ar)138 472.8 Q (gv\(i, name\);)-.18 E(reset\(input, name\);)138 484.8 Q 2.5(i:)138 496.8 S F4 (=)146.06 496.8 Q F0(i)2.5 E F4(+)2.5 E F0(1)2.5 E(end;)128 508.8 Q (while not eof do be)128 520.8 Q(gin)-.15 E(while not eoln do be)138 532.8 Q (gin)-.15 E(read\(ch\);)148 544.8 Q(write\(ch\))148 556.8 Q(end;)138 568.8 Q (readln;)138 580.8 Q(writeln)138 592.8 Q(end)128 604.8 Q(until i >)118 616.8 Q F4(=)A F0(ar)2.5 E(gc)-.18 E(end { kat }.)108 628.8 Q(%)108 640.8 Q .357 (Note that the)72 658.8 R F3 -.37(re)2.857 G(set).37 E F0 .357 (call to the \214le)2.857 F F3(input)2.857 E F0 .358 (here, which is necessary for a clear program, may be disallo)2.857 F .358 (wed on)-.25 F 1.131(other systems.)72 670.8 R 1.131 (As this program deals mostly with)6.131 F F3(ar)3.631 E(gc)-.37 E F0(and)3.63 E F3(ar)3.63 E(gv)-.37 E F0(and)3.63 E F2(UNIX)3.63 E F0 1.13 (system dependent considera-)3.63 F(tions, portability is of little concern.)72 682.8 Q(If this program is in the \214le `kat.p', then we can do)97 698.4 Q(%) 108 716.4 Q F1(pi kat.p)2.5 E F0(%)108 728.4 Q F1(mv obj kat)2.5 E EP %%Page: 25 25 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7)462.39 48 Q/F1 10/Symbol SF(-)A F0 (25)A(%)108 84 Q/F2 10/Times-Bold@0 SF(kat primes)2.5 E F0 (obj: Command not found.)108 96 Q(%)108 108 Q F2(kat)2.5 E F0 (obj: Command not found.)108 120 Q(%)108 132 Q .739 (Thus we see that, if it is gi)72 150 R -.15(ve)-.25 G 3.239(na).15 G -.18(rg) 204.442 150 S .739(uments, `kat' will, lik).18 F(e)-.1 E/F3 10/Times-Italic@0 SF(cat,)3.24 E F0(cop)3.24 E 3.24(ye)-.1 G .74(ach one in turn.)353.76 150 R .74(If no ar)5.74 F .74(guments are)-.18 F(gi)72 162 Q -.15(ve)-.25 G (n, it copies from the standard input.).15 E(Thus it will w)5 E (ork as it did before, with)-.1 E(%)108 180 Q F2(kat < primes)2.5 E F0(no)72 198 Q 2.5(we)-.25 G(qui)95.91 198 Q -.25(va)-.25 G(lent to).25 E(%)108 216 Q F2 (kat primes)2.5 E F0 .128(although the mechanisms are quite dif)72 234 R .128 (ferent in the tw)-.25 F 2.628(oc)-.1 G 2.628(ases. Note)298.042 234 R .127 (that if `kat' is gi)2.627 F -.15(ve)-.25 G 2.627(nab).15 G .127 (ad \214le name, for)438.079 234 R -.15(ex)72 246 S(ample:).15 E(%)108 264 Q F2 (kat xxxxqqq)2.5 E F0(obj: Command not found.)108 276 Q(%)108 288 Q .501 (it will gi)72 306 R .801 -.15(ve a d)-.25 H .502 (iagnostic and a post-mortem control \215o).15 F 3.002(wb)-.25 G .502 (acktrace for deb)306.354 306 R 3.002(ugging. If)-.2 F .502 (we were going to use)3.002 F(`kat', we might w)72 318 Q (ant to translate it dif)-.1 E(ferently)-.25 E 2.5(,e)-.65 G(.g.:)263.19 318 Q (%)108 336 Q F2(pi)2.5 E F1 -5.488(--)2.5 G F2(pb kat.p)5.488 E F0(%)108 348 Q F2(mv obj kat)2.5 E F0 .149(Here we ha)72 366 R .449 -.15(ve d)-.2 H .149(isab\ led the post-mortem statistics printing, so as not to get the statistics or th\ e full traceback).15 F .642(on error)72 378 R 5.642(.T)-.55 G(he)118.274 378 Q F2(b)3.142 E F0 .642(option will cause the system to block b)3.142 F(uf)-.2 E .642(fer the input/output so that the program will run)-.25 F .116(more ef)72 390 R .116(\214ciently on lar)-.25 F .116(ge \214les.)-.18 F 1.716 -.8(We c) 5.116 H .116(ould ha).8 F .416 -.15(ve a)-.2 H .116(lso speci\214ed the).15 F F2(t)2.616 E F0 .116(option to turn of)2.616 F 2.616(fr)-.25 G .116 (untime tests if that w)411.416 390 R(as)-.1 E (felt to be a speed hindrance to the program.)72 402 Q (Thus we can try the last e)5 E(xamples ag)-.15 E(ain:)-.05 E(%)108 420 Q F2 (kat xxxxqqq)2.5 E F0(obj: Command not found.)108 432 Q(%)108 444 Q F2 (kat primes)2.5 E F0(%)108 456 Q .213(The interested reader may wish to try wr\ iting a program which accepts command line ar)97 477.6 R .213(guments lik)-.18 F(e)-.1 E F3(pi)72 489.6 Q F0(does, using)2.5 E F3(ar)2.5 E(gc)-.37 E F0(and) 2.5 E F3(ar)2.5 E(gv)-.37 E F0(to process them.)2.5 E F2 2.5(5. Details)72 513.6 R(on the components of the system)2.5 E 2.5(5.1. Options)72 537.6 R F0 (The programs)97 553.2 Q F3(pi)2.5 E F0(,)A F3(pc)2.5 E F0 2.5(,a)C(nd)186.98 553.2 Q(tak)72 568.8 Q 3.623(ean)-.1 G 1.123(umber of options.\207)105.246 568.8 R 1.123(There is a standard)6.123 F/F4 8/Times-Roman@0 SF(UNIX)3.623 E F0 (con)3.623 E -.15(ve)-.4 G 1.124(ntion for passing options to programs on the) .15 F .375(command line, and this con)97 580.8 R -.15(ve)-.4 G .375 (ntion is follo).15 F .375(wed by the Berk)-.25 F(ele)-.1 E 2.875(yP)-.15 G .374(ascal system programs.)360.92 580.8 R .374(As we sa)5.374 F(w)-.15 E .747 (in the e)97 592.8 R .747(xamples abo)-.15 F -.15(ve)-.15 G 3.247(,o).15 G .747 (ption related ar)198.688 592.8 R .747 (guments consisted of the character `\255' follo)-.18 F .748(wed by a single) -.25 F(character option name.)97 604.8 Q .638(Except for the)97 620.4 R F2(b) 3.138 E F0 .638(option which tak)3.138 F .637(es a single digit v)-.1 F .637 (alue, each option may be set on \(enabled\) or of)-.25 F(f)-.25 E 2.5 (\(disabled.\) When)72 632.4 R(an on/of)2.5 E 2.5(fv)-.25 G (alued option appears on the command line of)189.25 632.4 Q F3(pi)2.5 E F0(or) 2.5 E/F5 12/Times-Bold@0 SF -1.104(Ta)242.886 644.4 S(ble of Contents)1.104 E F0(it in)72 680.4 Q -.15(ve)-.4 G(rts the def).15 E (ault setting of that option.)-.1 E(Thus)5 E(%)108 698.4 Q F2(pi)2.5 E F1 -5.488(--)2.5 G F2 2.5(lf)5.488 G(oo.p)143.522 698.4 Q .32 LW 144 706.4 72 706.4 DL F4(\207As)72 718.2 Q/F6 8/Times-Italic@0 SF(pix)2.316 E F4(uses)2.316 E F6(pi)2.316 E F4 .316(to translate P)2.316 F .316(ascal programs, it tak)-.12 F .316(es the options of)-.08 F F6(pi)2.316 E F4 2.316(also. W)2.316 F 2.316 (er)-.64 G .315(efer to them here, ho)334.632 718.2 R(we)-.2 E -.12(ve)-.2 G .955 -.32(r, a).12 H(s).32 E F6(pi)72 728.2 Q F4(options.)2 E EP %%Page: 26 26 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(PSD:7)72 48 Q/F1 10/Symbol SF(-)A F0 262.49(26 Berk)B (ele)-.1 E 2.5(yP)-.15 G(ascal User\264s Manual)422.36 48 Q (enables the listing option)72 84 Q/F2 10/Times-Bold@0 SF(l)2.5 E F0 2.5(,s)C (ince it def)186.45 84 Q(aults of)-.1 E(f, while)-.25 E(%)108 102 Q F2(pi)2.5 E F1 -5.488(--)2.5 G F2 2.5(tf)5.488 G(oo.p)144.072 102 Q F0 (disables the run time tests option)72 120 Q F2(t)2.5 E F0 2.5(,s)C (ince it def)218.11 120 Q(aults on.)-.1 E .903(In additon to in)97 135.6 R -.15 (ve)-.4 G .903(rting the def).15 F .903(ault settings of)-.1 F/F3 10 /Times-Italic@0 SF(pi)3.403 E F0 .904 (options on the command line, it is also possible to)3.403 F(control the)72 147.6 Q F3(pi)2.5 E F0(options within the body of the program by using comment\ s of a special form illustrated by)2.5 E({$l)108 165.6 Q F1(-)A F0(})A .006 (Here we see that the opening comment delimiter \(which could also be a `\()97 187.2 R F1(*)A F0 .006('\) is immediately follo)B(wed)-.25 E .113 (by the character `$'.)72 199.2 R .113(After this `$', which signals the start\ of the option list, we can place a sequence of let-)5.113 F .882 (ters and option controls, separated by `,)72 211.2 R 3.382('c)-.7 G 3.382 (haracters\210. The)245.494 211.2 R .883 (most basic actions for options are to set them,)3.382 F(thus)72 223.2 Q({$l) 108 241.2 Q F1(+)A F0(Enable listing})2.5 E(or to clear them)72 259.2 Q({$t)108 277.2 Q F1(-)A F0(,p)A F1(-)A F0(No run)2.5 E F1(-)A F0 (time tests, no post mortem analysis})A .247(Notice that `)72 295.2 R F1(+)A F0 2.747('a)C -.1(lwa)138.491 295.2 S .247(ys enables an option and `\255' al).1 F -.1(wa)-.1 G .247(ys disables it, no matter what the def).1 F .246(ault is.)-.1 F .246(Thus `\255')5.246 F .171(has a dif)72 307.2 R .171 (ferent meaning in an option comment than it has on the command line.)-.25 F .171(As sho)5.171 F .171(wn in the e)-.25 F(xamples,)-.15 E(normal comment te) 72 319.2 Q(xt may follo)-.15 E 2.5(wt)-.25 G(he option list.)210.76 319.2 Q F2 2.5(5.2. Options)72 343.2 R(common to Pi, Pc, and Pix)2.5 E F0 1.162(The follo) 97 358.8 R 1.161 (wing options are common to both the compiler and the interpreter)-.25 F 6.161 (.W)-.55 G 1.161(ith each option we)426.917 358.8 R(gi)72 370.8 Q 1.291 -.15 (ve i)-.25 H .991(ts def).15 F .991(ault setting, the setting it w)-.1 F .991 (ould ha)-.1 F 1.291 -.15(ve i)-.2 H 3.491(fi).15 G 3.491(ta)286.79 370.8 S .991(ppeared on the command line, and a sample com-)297.501 370.8 R (mand using the option.)72 382.8 Q(Most options are on/of)5 E 2.5(fv)-.25 G (alued, with the)269.83 382.8 Q F2(b)2.5 E F0(option taking a single digit v) 2.5 E(alue.)-.25 E F2(Buffering of the \214le output \255 b)72 406.8 Q F0(The) 97 422.4 Q F2(b)3.169 E F0 .669(option controls the b)3.169 F(uf)-.2 E .668 (fering of the \214le)-.25 F F3(output)3.168 E F0 5.668(.T)C .668(he def) 326.554 422.4 R .668(ault is line b)-.1 F(uf)-.2 E .668 (fering, with \215ushing at)-.25 F .187(each reference to the \214le)72 434.4 R F3(input)2.687 E F0 .188 (and under certain other circumstances detailed in section 5 belo)2.687 F 3.988 -.65(w. M)-.25 H(ention-).65 E(ing)72 446.4 Q F2(b)2.5 E F0 (on the command line, e.g.)2.5 E(%)108 464.4 Q F2(pi)2.5 E F1 -5.488(--)2.5 G F2 2.5(ba)5.488 G(ssembler)148.222 464.4 Q(.p)-1 E F0 .664 (causes standard output to be block b)72 482.4 R(uf)-.2 E .664 (fered, where a block is some system\255de\214ned number of characters.)-.25 F (The)72 494.4 Q F2(b)3.221 E F0 .721 (option may also be controlled in comments.)3.221 F .721 (It, unique among the Berk)5.721 F(ele)-.1 E 3.221(yP)-.15 G .722 (ascal options, tak)417.504 494.4 R .722(es a)-.1 F(single digit v)72 506.4 Q (alue rather than an on or of)-.25 E 2.5(fs)-.25 G 2.5(etting. A)241.75 506.4 R -.25(va)2.5 G(lue of 0, e.g.).25 E({$b0})133 524.4 Q .556(causes the \214le)72 542.4 R F3(output)3.056 E F0 .556(to be unb)3.056 F(uf)-.2 E 3.056(fered. An) -.25 F 3.056(yv)-.15 G .555(alue 2 or greater causes block b)260.568 542.4 R (uf)-.2 E .555(fering and is equi)-.25 F -.25(va)-.25 G .555(lent to).25 F .19 (the \215ag on the command line.)72 554.4 R .191 (The option control comment setting)5.19 F F2(b)2.691 E F0 .191 (must precede the)2.691 F F2(pr)2.691 E(ogram)-.18 E F0(statement.)2.691 E F2 (Include \214le listing \255 i)72 578.4 Q F0(The)97 594 Q F2(i)2.661 E F0 .161 (option tak)2.661 F .161(es the name of an)-.1 F F2(include)2.661 E F0(\214le,) 2.661 E F2(pr)2.661 E(ocedur)-.18 E(e)-.18 E F0(or)2.66 E F2(function)2.66 E F0 .16(name and causes it to be listed)2.66 F(while translating\207.)72 606 Q -.8 (Ty)5 G(pical uses w).8 E(ould be)-.1 E(%)108 624 Q F2(pix)2.5 E F1 -5.488(--) 2.5 G F2 2.5(is)5.488 G(canner)149.332 624 Q(.i compiler)-1 E(.p)-1 E F0 (to mak)72 642 Q 2.5(eal)-.1 G(isting of the routines in the \214le scanner) 116.06 642 Q(.i, and)-.55 E(%)108 660 Q F2(pix)2.5 E F1 -5.488(--)2.5 G F2 2.5 (is)5.488 G(canner compiler)149.332 660 Q(.p)-1 E .32 LW 144 668 72 668 DL/F4 8 /Times-Roman@0 SF .347(\210This format w)72 679.8 R .347 (as chosen because it is used by P)-.08 F .347(ascal 6000-3.4.)-.12 F .346 (In general the options common to both imple-)4.347 F .524 (mentations are controlled in the same w)72 689.8 R .525 (ay so that comment control in options is mostly portable.)-.08 F .525 (It is recom-)4.525 F .734(mended, ho)72 699.8 R(we)-.2 E -.12(ve)-.2 G 1.374 -.32(r, t).12 H .734 (hat only one control be put per comment for maximum portability).32 F 2.734 (,a)-.52 G 2.734(st)361.926 699.8 S .734(he P)369.996 699.8 R .734 (ascal 6000-3.4)-.12 F(implementation will ignore controls after the \214rst o\ ne which it does not recognize.)72 709.8 Q<87>72 721.6 Q/F5 8/Times-Bold@0 SF (Include)A F4(\214les are discussed in section 5.9.)2 E EP %%Page: 27 27 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7)462.39 48 Q/F1 10/Symbol SF(-)A F0 (27)A .184(to mak)72 84 R 2.684(eal)-.1 G .184(isting of only the routine) 116.612 84 R/F2 10/Times-Italic@0 SF(scanner)2.684 E F0 5.184(.T)C .185 (his option is especially useful for conserv)264.376 84 R .185 (ation-minded pro-)-.25 F(grammers making partial program listings.)72 96 Q/F3 10/Times-Bold@0 SF(Mak)72 120 Q 2.5(eal)-.1 G(isting \255 l)109.12 120 Q F0 (The)97 135.6 Q F3(l)2.788 E F0 .288(option enables a listing of the program.) 2.788 F(The)5.288 E F3(l)2.788 E F0 .288(option def)2.788 F .288(aults of)-.1 F 2.788(f. When)-.25 F .287(speci\214ed on the com-)2.787 F .22 (mand line, it causes a header line identifying the v)72 147.6 R .22 (ersion of the translator in use and a line gi)-.15 F .22(ving the modi-)-.25 F .33(\214cation time of the \214le being translated to appear before the actual\ program listing.)72 159.6 R(The)5.33 E F3(l)2.83 E F0 .33(option is pushed) 2.83 F(and popped by the)72 171.6 Q F3(i)2.5 E F0 (option at appropriate points in the program.)2.5 E F3(Standard P)72 195.6 Q (ascal only \255 s)-.1 E F0(The)97 211.2 Q F3(s)2.581 E F0 .081 (option causes man)2.581 F 2.581(yo)-.15 G 2.581(ft)208.075 211.2 S .082 (he features of the)216.766 211.2 R/F4 8/Times-Roman@0 SF(UNIX)2.582 E F0 .082 (implementation which are not found in standard)2.582 F -.15(Pa)72 223.2 S .827 (scal to be diagnosed as `s' w).15 F .827(arning errors.)-.1 F .827 (This option def)5.827 F .827(aults of)-.1 F 3.327(fa)-.25 G .827 (nd is enabled when mentioned on)365.715 223.2 R .154(the command line.)72 235.2 R .154(Some of the features which are diagnosed are: non-standard)5.154 F F3(pr)2.655 E(ocedur)-.18 E(e)-.18 E F0 2.655(sa)C(nd)449.395 235.2 Q F3 (function)2.655 E F0(s,)A -.15(ex)72 247.2 S .575(tensions to the).15 F F3(pr) 3.075 E(ocedur)-.18 E(e)-.18 E F2(write)3.075 E F0 3.075(,a)C .575 (nd the padding of constant strings with blanks.)220.465 247.2 R .575 (In addition, all letters)5.575 F 1.053(are mapped to lo)72 259.2 R 1.053 (wer case e)-.25 F 1.053(xcept in strings and characters so that the case of k) -.15 F -.15(ey)-.1 G -.1(wo).15 G 1.054(rds and identi\214ers is).1 F(ef)72 271.2 Q(fecti)-.25 E -.15(ve)-.25 G(ly ignored.).15 E(The)5 E F3(s)2.5 E F0 (option is most useful when a program is to be transported, thus)2.5 E(%)108 289.2 Q F3(pi)2.5 E F1 -5.488(--)2.5 G F3 2.5(si)5.488 G(sitstd.p)144.332 289.2 Q F0(will produce w)72 307.2 Q(arnings unless the program meets the standard.) -.1 E F3(Runtime tests \255 t and C)72 331.2 Q F0 .782 (These options control the generation of tests that subrange v)97 346.8 R .782 (ariable v)-.25 F .782(alues are within bounds at run)-.25 F(time.)72 358.8 Q F2(pi)6.081 E F0(def)3.581 E 1.081 (aults to generating tests and uses the option)-.1 F F3(t)3.581 E F0 1.081 (to disable them.)3.581 F F2(pc)6.081 E F0(def)3.581 E 1.082 (aults to not generating)-.1 F 1.133(tests, and uses the option)72 370.8 R F3 (C)3.633 E F0 1.133(to enable them.)3.633 F 1.133 (Disabling runtime tests also causes)6.133 F F3(assert)3.633 E F0 1.133 (statements to be)3.633 F(treated as comments.\210)72 382.8 Q F3(Suppr)72 406.8 Q(ess war)-.18 E(ning diagnostics \255 w)-.15 E F0(The)97 422.4 Q F3(w)2.933 E F0 .433(option, which def)2.933 F .434(aults on, allo)-.1 F .434 (ws the translator to print a number of w)-.25 F .434(arnings about inconsis-) -.1 F(tencies it \214nds in the input program.)72 434.4 Q -.45(Tu)5 G (rning this option of).45 E 2.5(fw)-.25 G(ith a comment of the form)322.13 434.4 Q({$w)108 452.4 Q F1(-)A F0(})A(or on the command line)72 470.4 Q(%)108 488.4 Q F3(pi)2.5 E F1 -5.488(--)2.5 G F3 2.5(wt)5.488 G(ryme.p)148.212 488.4 Q F0(suppresses these usually useful diagnostics.)72 506.4 Q F3 (Generate counters f)72 530.4 Q(or a pxp execution pr)-.25 E(o\214le \255 z) -.18 E F0(The)97 546 Q F3(z)2.6 E F0 .1(option, which def)2.6 F .1(aults of)-.1 F .1(f, enables the production of e)-.25 F -.15(xe)-.15 G .1 (cution pro\214les.).15 F .1(By specifying)5.1 F F3(z)2.6 E F0 .1(on the)2.6 F (command line, i.e.)72 558 Q(%)108 576 Q F3(pi)2.5 E F1 -5.488(--)2.5 G F3 2.5 (zf)5.488 G(oo.p)145.182 576 Q F0 .717 (or by enabling it in a comment before the)72 594 R F3(pr)3.217 E(ogram)-.18 E F0 .717(statement causes)3.217 F F2(pi)3.217 E F0(and)3.218 E F2(pc)3.218 E F0 .718(to insert operations in the)3.218 F (interpreter code to count the number of times each statement w)72 606 Q(as e) -.1 E -.15(xe)-.15 G 2.5(cuted. An).15 F -.15(ex)2.5 G(ample of using).15 E -.1 (wa)72 621.6 S 2.961(sg).1 G -2.15 -.25(iv e)95.411 621.6 T 2.961(ni).25 G 2.961(ns)117.972 621.6 S .461 (ection 2.6; its options are described in section 5.6.)129.823 621.6 R .46 (Note that the)5.46 F F3(z)2.96 E F0 .46(option cannot be used on)2.96 F (separately compiled programs.)97 633.6 Q F3 2.5(5.3. Options)72 657.6 R -2.1 -.25(av a)2.5 H(ilable in Pi).25 E -.2(Po)72 681.6 S(st-mortem dump \255 p).2 E F0(The)97 697.2 Q F3(p)2.756 E F0 .256(option def)2.756 F .256(aults on, and c\ auses the runtime system to initiate a post-mortem backtrace when an)-.1 F .598 (error occurs.)72 709.2 R .597(It also cause)5.597 F F2(px)3.097 E F0 .597 (to count statements in the e)3.097 F -.15(xe)-.15 G .597 (cuting program, enforcing a statement limit to).15 F .32 LW 144 717.2 72 717.2 DL F4(\210See section A.1 for a description of)72 729 Q/F5 8/Times-Bold@0 SF (assert)2 E F4(statements.)2 E EP %%Page: 28 28 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 264.65(PSD:7-28 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q(pre)72 84 Q -.15(ve)-.25 G .476 (nt in\214nite loops.).15 F(Specifying)5.476 E/F1 10/Times-Bold@0 SF(p)2.976 E F0 .477(on the command line disables these checks and the ability to gi)2.976 F .777 -.15(ve t)-.25 H(his).15 E .199(post-mortem analysis.)72 96 R .199 (It does mak)5.199 F 2.699(es)-.1 G .199(maller and f)223.715 96 R .199 (aster programs, ho)-.1 F(we)-.25 E -.15(ve)-.25 G 3.799 -.55(r. I).15 H 2.699 (ti).55 G 2.699(sa)389.399 96 S .198(lso possible to control the)400.428 96 R F1(p)72 108 Q F0 .274(option in comments.)2.774 F 1.874 -.8(To p)5.274 H(re).8 E -.15(ve)-.25 G .274(nt the post-mortem backtrace on error).15 F(,)-.4 E F1(p) 2.774 E F0 .274(must be of)2.774 F 2.774(fa)-.25 G 2.774(tt)421.99 108 S .274 (he end of the)430.324 108 R F1(pr)2.774 E(o-)-.18 E(gram)72 120 Q F0 2.5 (statement. Thus,)2.5 F(the P)2.5 E(ascal cross-reference program w)-.15 E (as translated with)-.1 E(%)108 138 Q F1(pi)2.5 E/F2 10/Symbol SF -5.488(--)2.5 G F1(pbt pxr)5.488 E(ef)-.18 E(.p)-.15 E 2.5(5.4. Options)72 168 R -2.1 -.25 (av a)2.5 H(ilable in Px).25 E F0 .435(The \214rst ar)97 183.6 R .435 (gument to)-.18 F/F3 10/Times-Italic@0 SF(px)2.935 E F0 .435 (is the name of the \214le containing the program to be interpreted.)2.935 F .434(If no ar)5.434 F(gu-)-.18 E .348(ments are gi)72 195.6 R -.15(ve)-.25 G .348(n, then the \214le).15 F F3(obj)2.848 E F0 .348(is e)2.848 F -.15(xe)-.15 G 2.848(cuted. If).15 F .348(more ar)2.848 F .349(guments are gi)-.18 F -.15 (ve)-.25 G .349(n, the).15 F 2.849(ya)-.15 G .349(re a)403.784 195.6 R -.25(va) -.2 G .349(ilable to the P).25 F(ascal)-.15 E(program by using the b)72 207.6 Q (uilt-ins)-.2 E F3(ar)2.5 E(gc)-.37 E F0(and)2.5 E F3(ar)2.5 E(gv)-.37 E F0 (as described in section 4.6.)2.5 E F3(Px)97 223.2 Q F0 .413(may also be in) 2.913 F -.2(vo)-.4 G -.1(ke).2 G 2.913(da).1 G(utomatically)200.845 223.2 Q 5.413(.I)-.65 G 2.913(nt)261.438 223.2 S .413(his case, whene)272.131 223.2 R -.15(ve)-.25 G 2.913(raP).15 G .413(ascal object \214le name is gi)363.483 223.2 R -.15(ve)-.25 G 2.912(na).15 G 2.912(sa)492.758 223.2 S (command, the command will be e)72 235.2 Q -.15(xe)-.15 G(cuted with).15 E F3 (px)2.5 E F0(prepended to it; that is)2.5 E(%)108 253.2 Q F1(obj primes)2.5 E F0(will be con)72 271.2 Q -.15(ve)-.4 G(rted to read).15 E(%)108 289.2 Q F1 (px obj primes)2.5 E 2.5(5.5. Options)72 319.2 R -2.1 -.25(av a)2.5 H (ilable in Pc).25 E(Generate assembly language \255 S)72 343.2 Q F0(The progra\ m is compiled and the assembly language output is left in \214le appended .s.) 97 358.8 Q(Thus)5 E(%)108 376.8 Q F1(pc)2.5 E F2 -5.488(--)2.5 G F1 2.5(Sf) 5.488 G(oo.p)147.962 376.8 Q F0(creates a \214le)72 394.8 Q F3(foo.s)2.5 E F0 5 (.N)C 2.5(oe)158.37 394.8 S -.15(xe)170.16 394.8 S(cutable \214le is created.) .15 E F1(Symbolic Deb)72 418.8 Q(ugger Inf)-.2 E(ormation \255 g)-.25 E F0(The) 97 434.4 Q F1(g)3.316 E F0 .816 (option causes the compiler to generate information needed by)3.316 F F3(sdb) 3.317 E F0 .817(\(1\) the symbolic deb)B(ugger)-.2 E(.)-.55 E -.15(Fo)72 446.4 S 2.5(rac).15 G(omplete description of)99.62 446.4 Q F3(sdb)2.5 E F0(see V)2.5 E(olume 2c of the)-1.29 E/F4 8/Times-Roman@0 SF(UNIX)2.5 E F0 (Reference Manual.)2.5 E F1(Redir)72 470.4 Q(ect the output \214le \255 o)-.18 E F0(The)97 486 Q F3(name)2.737 E F0(ar)2.737 E .237(gument after the)-.18 F F1 (-o)2.737 E F0 .237(is used as the name of the output \214le instead of)2.737 F F3(a.out)2.737 E F0 5.237(.I)C .237(ts typical use)451.306 486 R (is to name the compiled program using the root of the \214le name.)72 498 Q (Thus:)5 E(%)108 516 Q F1(pc)2.5 E F2 -5.488(--)2.5 G F1 2.5(om)5.488 G(ypr) 152.652 516 Q(og mypr)-.18 E(og)-.18 E(.p)-.15 E F0 (causes the compiled program to be called)72 534 Q F3(mypr)2.5 E -.1(og)-.45 G F0(.).1 E F1(Generate counters f)72 558 Q(or a)-.25 E F3(pr)2.5 E(of)-.45 E F1 (execution pr)2.5 E(o\214le \255 p)-.18 E F0 .527(The compiler produces code w\ hich counts the number of times each routine is called.)97 573.6 R .527 (The pro\214ling)5.527 F(is based on a periodic sample tak)72 585.6 Q (en by the system rather than by inline counters used by)-.1 E 1.227 (This results in less de)72 601.2 R 1.227(gradation in e)-.15 F -.15(xe)-.15 G 1.227(cution, at some).15 F 1.227(what of a loss in accurac)-.25 F 5.026 -.65 (y. S)-.15 H(ee).65 E F3(pr)3.726 E(of)-.45 E F0 1.226(\(1\) for a more)B (complete description.)97 613.2 Q F1(Run the object code optimizer \255 O)72 637.2 Q F0 1.144 (The output of the compiler is run through the object code optimizer)97 652.8 R 6.145(.T)-.55 G 1.145(his pro)393.48 652.8 R 1.145(vides an increase in)-.15 F (compile time in e)72 664.8 Q (xchange for a decrease in compiled code size and e)-.15 E -.15(xe)-.15 G (cution time.).15 E F1 2.5(5.6. Options)72 688.8 R -2.1 -.25(av a)2.5 H (ilable in Pxp).25 E F3(Pxp)97 704.4 Q F0(tak)2.833 E .333 (es, on its command line, a list of options follo)-.1 F .333 (wed by the program \214le name, which must end)-.25 F .444 (in `.p' as it must for)72 716.4 R F3(pi)2.945 E F0(,)A F3(pc)2.945 E F0 2.945 (,a)C(nd)189.155 716.4 Q F3(pix)2.945 E F0(.)A F3(Pxp)5.445 E F0 .445 (will produce an e)2.945 F -.15(xe)-.15 G .445(cution pro\214le if an).15 F 2.945(yo)-.15 G 2.945(ft)408.675 716.4 S(he)417.73 716.4 Q F1(z)2.945 E F0(,)A F1(t)2.945 E F0(or)2.945 E F1(c)2.945 E F0 .445(options is)2.945 F (speci\214ed on the command line.)72 728.4 Q (If none of these options is speci\214ed, then)5 E EP %%Page: 29 29 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7-29)464.55 48 Q (functions as a program reformatter)72 84 Q(.)-.55 E (It is important to note that only the)97 99.6 Q/F1 10/Times-Bold@0 SF(z)2.5 E F0(and)2.5 E F1(w)2.5 E F0(options of)2.5 E(which are common to)72 115.2 Q/F2 10/Times-Italic@0 SF(pi)2.5 E F0(,)A F2(pc)2.5 E F0 2.5(,a)C(nd)193.09 115.2 Q 1.604(can be controlled in comments.)72 130.8 R 1.603 (All other options must be speci\214ed on the command line to ha)6.604 F 1.903 -.15(ve a)-.2 H -.15(ny).15 G(ef)97 142.8 Q(fect.)-.25 E(The follo)97 158.4 Q (wing options are rele)-.25 E -.25(va)-.25 G(nt to pro\214ling with).25 E F1 (Include the bodies of all r)72 186 Q(outines in the pr)-.18 E(o\214le \255 a) -.18 E F2(Pxp)97 201.6 Q F0 .192 (normally suppresses printing the bodies of routines which were ne)2.692 F -.15 (ve)-.25 G 2.692(re).15 G -.15(xe)401.562 201.6 S .192(cuted, to mak).15 F 2.692(et)-.1 G .192(he pro-)475.208 201.6 R(\214le more compact.)72 213.6 Q (This option forces all routine bodies to be printed.)5 E F1(Suppr)72 237.6 Q (ess declaration parts fr)-.18 E(om a pr)-.18 E(o\214le \255 d)-.18 E F0 .223 (Normally a pro\214le includes declaration parts.)97 253.2 R(Specifying)5.223 E F1(d)2.723 E F0 .223(on the command line suppresses declara-)2.723 F (tion parts.)72 265.2 Q F1(Eliminate include dir)72 289.2 Q(ecti)-.18 E -.1(ve) -.1 G 2.5(s\255e).1 G F0(Normally)97 304.8 Q(,)-.65 E(preserv)72 320.4 Q(es) -.15 E F1(include)3.61 E F0(directi)3.61 E -.15(ve)-.25 G 3.61(st).15 G 3.61 (ot)192.82 320.4 S 1.11(he output when reformatting a program, as though the) 204.21 320.4 R 3.61(yw)-.15 G 1.11(ere comments.)444.57 320.4 R(Specifying)97 332.4 Q F1<ad65>4.35 E F0 1.849(causes the contents of the speci\214ed \214les\ to be reformatted into the output stream)4.35 F 2.5(instead. This)97 344.4 R (is an easy w)2.5 E(ay to eliminate)-.1 E F1(include)2.5 E F0(directi)2.5 E -.15(ve)-.25 G(s, e.g. before transporting a program.).15 E F1(Fully par)72 368.4 Q(enthesize expr)-.18 E(essions \255 f)-.18 E F0(Normally)97 384 Q .525 (prints e)72 399.6 R .526 (xpressions with the minimal parenthesization necessary to preserv)-.15 F 3.026 (et)-.15 G .526(he structure of the input.)380.55 399.6 R(This)5.526 E (option causes)97 411.6 Q F2(pxp)2.5 E F0(to fully parenthesize e)2.5 E 2.5 (xpressions. Thus)-.15 F(the statement which prints as)2.5 E 2.5(d:)133 429.6 S /F3 10/Symbol SF(=)143.28 429.6 Q F0(a)2.5 E F3(+)2.5 E F0 2.5(bm)2.5 G (od c / e)181.48 429.6 Q(with minimal parenthesization, the def)97 447.6 Q (ault, will print as)-.1 E 2.5(d:)133 465.6 S F3(=)143.28 465.6 Q F0(a)2.5 E F3 (+)2.5 E F0(\(\(b mod c\) / e\))2.5 E(with the)97 483.6 Q F1(f)2.5 E F0 (option speci\214ed on the command line.)2.5 E F1(Left justify all pr)72 507.6 Q(ocedur)-.18 E(es and functions \255 j)-.18 E F0(Normally)97 523.2 Q 4.047(,e) -.65 G(ach)145.667 523.2 Q F1(pr)4.047 E(ocedur)-.18 E(e)-.18 E F0(and)4.047 E F1(function)4.047 E F0 1.546 (body is indented to re\215ect its static nesting depth.)4.047 F(This)6.546 E (option pre)72 535.2 Q -.15(ve)-.25 G (nts this nesting and can be used if the indented output w).15 E (ould be too wide.)-.1 E F1(Print a table summarizing pr)72 559.2 Q(ocedur)-.18 E 2.5(ea)-.18 G(nd function calls \255 t)237.46 559.2 Q F0(The)97 574.8 Q F1(t) 2.5 E F0(option causes)2.5 E .054 (to print a table summarizing the number of calls to each)72 590.4 R F1(pr) 2.554 E(ocedur)-.18 E(e)-.18 E F0(and)2.554 E F1(function)2.554 E F0 .054 (in the program.)2.554 F .055(It may be)5.055 F (speci\214ed in combination with the)97 602.4 Q F1(z)2.5 E F0 (option, or separately)2.5 E(.)-.65 E F1(Enable and contr)72 626.4 Q(ol the pr) -.18 E(o\214le \255 z)-.18 E F0(The)97 642 Q F1(z)3.067 E F0 .567 (pro\214le option is v)3.067 F .566(ery similar to the)-.15 F F1(i)3.066 E F0 .566(listing control option of)3.066 F F2(pi)3.066 E F0 5.566(.I)C(f)392.844 642 Q F1(z)3.066 E F0 .566(is speci\214ed on the com-)3.066 F .133 (mand line, then all ar)72 654 R .134(guments up to the source \214le ar)-.18 F .134(gument which ends in `.p' are tak)-.18 F .134(en to be the names of)-.1 F F1(pr)72 666 Q(ocedur)-.18 E(e)-.18 E F0 2.66(sa)C(nd)126.51 666 Q F1(function) 2.66 E F0 2.66(so)C(r)186.28 666 Q F1(include)2.66 E F0 .16 (\214les which are to be pro\214led.)2.66 F .16 (If this list is null, then the whole \214le is)5.16 F(to be pro\214led.)72 678 Q 2.5(At)5 G(ypical command for e)145.33 678 Q (xtracting a pro\214le of part of a lar)-.15 E(ge program w)-.18 E(ould be)-.1 E(%)108 696 Q F1(pxp)2.5 E F3 -5.488(--)2.5 G F1 2.5(zt)5.488 G(est parser) 153.212 696 Q(.i compiler)-1 E(.p)-1 E F0 (This speci\214es that pro\214les of the routines in the \214le)72 714 Q F2 (par)2.5 E(ser)-.1 E(.i)-1.11 E F0(and the routine)2.5 E F2(test)2.5 E F0 (are to be made.)2.5 E EP %%Page: 30 30 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 264.65(PSD:7-30 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q/F1 10/Times-Bold@0 SF 2.5(5.7. F)72 84 R (ormatting pr)-.25 E(ograms using pxp)-.18 E F0(The program)97 99.6 Q (can be used to reformat programs, by using a command of the form)72 115.2 Q(%) 133 133.2 Q F1(pxp dirty)2.5 E(.p > clean.p)-.7 E F0 (Note that since the shell creates the output \214le `clean.p' before)97 151.2 Q -.15(exe)72 166.8 S(cutes, so `clean.p' and `dirty).15 E (.p' must not be the same \214le.)-.65 E/F2 10/Times-Italic@0 SF(Pxp)97 182.4 Q F0 .35(automatically paragraphs the program, performing housek)2.85 F .35 (eeping chores such as comment align-)-.1 F 1.277 (ment, and treating blank lines, lines containing e)72 194.4 R 1.276 (xactly one blank and lines containing only a form-feed)-.15 F .435 (character as though the)72 206.4 R 2.935(yw)-.15 G .435 (ere comments, preserving their v)180.78 206.4 R .435(ertical spacing ef)-.15 F .436(fect in the output.)-.25 F F2(Pxp)5.436 E F0(distin-)2.936 E (guishes between four kinds of comments:)72 218.4 Q 14.17(1\) Left)97 234 R (mar)2.673 E .173(ginal comments, which be)-.18 F .172 (gin in the \214rst column of the input line and are placed in the)-.15 F (\214rst column of an output line.)122 246 Q 14.17(2\) Aligned)97 261.6 R .07 (comments, which are preceded by no input tok)2.57 F .07 (ens on the input line.)-.1 F .07(These are aligned)5.07 F (in the output with the running program te)122 273.6 Q(xt.)-.15 E 14.17(3\) T) 97 289.2 R 1.326 (railing comments, which are preceded in the input line by a tok)-.35 F 1.325 (en with no more than tw)-.1 F(o)-.1 E(spaces separating the tok)122 301.2 Q (en from the comment.)-.1 E 14.17(4\) Right)97 316.8 R(mar)2.673 E .173 (ginal comments, which are preceded in the input line by a tok)-.18 F .173 (en from which the)-.1 F 2.674(ya)-.15 G(re)496.23 316.8 Q .255 (separated by at least three spaces or a tab)122 328.8 R 5.255(.T)-.4 G .255 (hese are aligned do)301.895 328.8 R .255(wn the right mar)-.25 F .255 (gin of the out-)-.18 F(put, currently to the \214rst tab stop after the 40th \ column from the current `)122 340.8 Q(`left mar)-.74 E(gin')-.18 E('.)-.74 E (Consider the follo)72 356.4 Q(wing program.)-.25 E(%)108 374.4 Q F1 (cat comments.p)2.5 E F0 2.5({T)108 386.4 S(his is a left mar)121.41 386.4 Q (ginal comment. })-.18 E(program hello\(output\);)108 398.4 Q -.25(va)108 410.4 S 2.5(ri:i).25 G(nte)136.36 410.4 Q(ger; {This is a trailing comment})-.15 E 2.5(j:i)108 422.4 S(nte)121.34 422.4 Q 7.5(ger; {This)-.15 F(is a right mar)2.5 E(ginal comment})-.18 E 2.5(k:a)108 434.4 S (rray [ 1..10] of array [1..10] of inte)125.22 434.4 Q(ger; {Mar)-.15 E (ginal, b)-.18 E(ut past the mar)-.2 E(gin})-.18 E({)108 446.4 Q (An aligned, multi)113 458.4 Q/F3 10/Symbol SF(-)A F0(line comment)A(which e) 113 470.4 Q(xplains what this program is)-.15 E(all about)113 482.4 Q(})108 494.4 Q(be)108 506.4 Q(gin)-.15 E 2.5(i:)108 518.4 S F3(=)116.06 518.4 Q F0 (1; {T)2.5 E(railing i comment})-.35 E({A left mar)108 530.4 Q(ginal comment}) -.18 E({An aligned comment})110.5 542.4 Q 2.5(j:)108 554.4 S F3(=)116.06 554.4 Q F0 20(1; {Right)2.5 F(mar)2.5 E(ginal comment})-.18 E(k[1] :)108 566.4 Q F3 (=)A F0(1;)2.5 E(writeln\(i, j, k[1]\))108 578.4 Q(end.)108 590.4 Q (When formatted by)72 608.4 Q(the follo)72 624 Q(wing output is produced.)-.25 E(%)133 642 Q F1(pxp comments.p)2.5 E F0 2.5({T)133 654 S(his is a left mar) 146.41 654 Q(ginal comment. })-.18 E(program hello\(output\);)133 678 Q -.25 (va)133 690 S(r).25 E(i: inte)143 702 Q(ger; {This is a trailing comment})-.15 E(j: inte)143 714 Q 183.04(ger; {This)-.15 F(is a right mar)2.5 E (ginal comment})-.18 E(k: array [1..10] of array [1..10] of inte)143 726 Q 54.76(ger; {Mar)-.15 F(ginal, b)-.18 E(ut past the mar)-.2 E(gin})-.18 E EP %%Page: 31 31 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7)462.39 48 Q/F1 10/Symbol SF(-)A F0 (31)A({)133 84 Q(An aligned, multi)138 96 Q F1(-)A F0(line comment)A(which e) 138 108 Q(xplains what this program is)-.15 E(all about)138 120 Q(})133 132 Q (be)133 144 Q(gin)-.15 E 2.5(i:)143 156 S F1(=)151.06 156 Q F0(1; {T)2.5 E (railing i comment})-.35 E({A left mar)133 168 Q(ginal comment})-.18 E ({An aligned comment})143 180 Q 2.5(j:)143 192 S F1(=)151.06 192 Q F0 197.67 (1; {Right)2.5 F(mar)2.5 E(ginal comment})-.18 E(k[1] :)143 204 Q F1(=)A F0(1;) 2.5 E(writeln\(i, j, k[1]\))143 216 Q(end.)133 228 Q(%)133 240 Q(The follo)97 258 Q(wing formatting related options are currently a)-.25 E -.25(va)-.2 G (ilable in).25 E(The options)72 273.6 Q/F2 10/Times-Bold@0 SF(f)2.5 E F0(and) 2.5 E F2(j)2.5 E F0(described in the pre)2.5 E (vious section may also be of interest.)-.25 E F2(Strip comments \255s)72 297.6 Q F0(The)97 313.2 Q F2(s)2.5 E F0(option causes)2.5 E(to remo)72 328.8 Q .3 -.15(ve a)-.15 H(ll comments from the input te).15 E(xt.)-.15 E F2(Underline k) 72 352.8 Q(eyw)-.1 E .4 LW 173.89 355.3 168.89 355.3 DL(ords \255)139.3 352.8 Q F0 2.5(Ac)97 368.4 S(ommand line ar)111.16 368.4 Q(gument of the form)-.18 E 264.44 370.9 259.44 370.9 DL F2<ad>253.74 368.4 Q F0(as in)7.5 E(%)108 386.4 Q F2(pxp)2.5 E 147.942 388.9 142.942 388.9 DL F1 -5.488(--)137.45 386.4 S F2 (dirty)150.442 386.4 Q(.p)-.7 E F0(can be used to cause)72 404.4 Q (to underline all k)72 420 Q -.15(ey)-.1 G -.1(wo).15 G (rds in the output for enhanced readability).1 E(.)-.65 E F2 (Specify indenting unit \255 [23456789])72 444 Q F0(The normal unit which)97 459.6 Q .341(uses to indent a structure statement le)72 475.2 R -.15(ve)-.25 G 2.841(li).15 G 2.841(s4s)241.467 475.2 S 2.841(paces. By)259.929 475.2 R(gi) 2.841 E .341(ving an ar)-.25 F .342(gument of the form)-.18 F F2<ad>2.842 E/F3 10/Times-Italic@0 SF(d)A F0(with)2.842 E F3(d)2.842 E F0 2.842(ad)2.842 G (igit,)488.16 475.2 Q(2)97 487.2 Q F1<a3>2.5 E F3(d)2.5 E F1<a3>2.5 E F0 2.5 (9y)2.5 G(ou can specify that)140.48 487.2 Q F3(d)2.5 E F0 (spaces are to be used per le)2.5 E -.15(ve)-.25 G 2.5(li).15 G(nstead.)351.69 487.2 Q F2 2.5(5.8. Pxr)72 511.2 R(ef)-.18 E F0 .04 (The cross-reference program)97 526.8 R F3(pxr)2.54 E(ef)-.37 E F0 .04 (may be used to mak)2.54 F 2.54(ec)-.1 G .04(ross-referenced listings of P) 329.31 526.8 R .04(ascal programs.)-.15 F 1.6 -.8(To p)72 538.8 T (roduce a cross-reference of the program in the \214le `foo.p' one can e).8 E -.15(xe)-.15 G(cute the command:).15 E(%)108 556.8 Q F2(pxr)2.5 E(ef f)-.18 E (oo.p)-.25 E F0 .08(The cross-reference is, unfortunately)72 574.8 R 2.58(,n) -.65 G .08(ot block structured.)228.84 574.8 R .08(Full details on)5.08 F F3 (pxr)2.58 E(ef)-.37 E F0 .08(are gi)2.58 F -.15(ve)-.25 G 2.58(ni).15 G 2.58 (ni)436.27 574.8 S .08(ts manual sec-)446.63 574.8 R(tion)72 586.8 Q F3(pxr)2.5 E(ef)-.37 E F0(\(1\).)2.5 E F2 2.5(5.9. Multi-\214le)72 610.8 R(pr)2.5 E (ograms)-.18 E F0 3.583(At)97 626.4 S -.15(ex)110.583 626.4 S 3.583(ti).15 G 1.082(nclusion f)129.016 626.4 R 1.082(acility is a)-.1 F -.25(va)-.2 G 1.082 (ilable with Berk).25 F(ele)-.1 E 3.582(yP)-.15 G 3.582(ascal. This)313.988 626.4 R -.1(fa)3.582 G 1.082(cility allo).1 F 1.082(ws the interpolation of) -.25 F .3(source te)72 638.4 R .3 (xt from other \214les into the source stream of the translator)-.15 F 5.301 (.I)-.55 G 2.801(tc)349.853 638.4 S .301(an be used to di)359.874 638.4 R .301 (vide lar)-.25 F .301(ge programs)-.18 F (into more manageable pieces for ease in editing, listing, and maintenance.)72 650.4 Q(The)97 666 Q F2(include)2.61 E F0 -.1(fa)2.61 G .11 (cility is based on that of the).1 F/F4 8/Times-Roman@0 SF(UNIX)2.609 E F0 2.609(Cc)2.109 G(ompiler)306.198 666 Q 5.109(.T)-.55 G 2.609(ot)349.677 666 S .109(rigger it you can place the character)360.066 666 R .197(`#' in the \214r\ st portion of a line and then, after an arbitrary number of blanks or tabs, th\ e w)72 678 R .197(ord `include' fol-)-.1 F(lo)72 690 Q .657 (wed by a \214lename enclosed in single `\264' or double `"' quotation marks.) -.25 F .656(The \214le name may be follo)5.656 F(wed)-.25 E .863 (by a semicolon `;' if you wish to treat this as a pseudo-P)72 702 R .863 (ascal statement.)-.15 F .863(The \214lenames of included \214les)5.863 F (must end in `.i'.)72 714 Q(An e)5 E (xample of the use of included \214les in a main program w)-.15 E(ould be:)-.1 E EP %%Page: 32 32 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 264.65(PSD:7-32 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q/F1 10/Times-Bold@0 SF(pr)108 84 Q(ogram) -.18 E F0(compiler\(input, output, obj\);)2.5 E(#)108 108 Q F1(include)A F0 ("globals.i")2.5 E(#)108 120 Q F1(include)A F0("scanner)2.5 E(.i")-.55 E(#)108 132 Q F1(include)A F0("parser)2.5 E(.i")-.55 E(#)108 144 Q F1(include)A F0 ("semantics.i")2.5 E F1(begin)108 168 Q F0 2.5({m)118 180 S(ain program }) 133.08 180 Q F1(end)108 192 Q F0(.)A .144(At the point the)97 213.6 R F1 (include)2.644 E F0 .144(pseudo-statement is encountered in the input, the lin\ es from the included \214le)2.644 F 1.054 (are interpolated into the input stream.)72 225.6 R -.15(Fo)6.054 G 3.554(rt) .15 G 1.054(he purposes of translation and runtime diagnostics and state-) 253.378 225.6 R .528(ment numbers in the listings and post-mortem backtraces, \ the lines in the included \214le are numbered from)72 237.6 R 2.5(1. Nested)72 249.6 R(includes are possible up to 10 deep.)2.5 E .158 (See the descriptions of the)97 265.2 R F1(i)2.658 E F0 .158(option of)2.658 F /F2 10/Times-Italic@0 SF(pi)2.658 E F0 .158(in section 5.2 abo)2.658 F -.15(ve) -.15 G 2.658(;t).15 G .158(his can be used to control listing when)349.294 265.2 R F1(include)72 277.2 Q F0(\214les are present.)2.5 E .554 (When a non-tri)97 292.8 R .553(vial line is encountered in the source te)-.25 F .553(xt after an)-.15 F F1(include)3.053 E F0 .553 (\214nishes, the `popped' \214le-)3.053 F (name is printed, in the same manner as abo)72 304.8 Q -.15(ve)-.15 G(.).15 E -.15(Fo)97 320.4 S 3.175(rt).15 G .676(he purposes of error diagnostics when n\ ot making a listing, the \214lename will be printed before)116.695 320.4 R(eac\ h diagnostic if the current \214lename has changed since the last \214lename w) 72 332.4 Q(as printed.)-.1 E F1 2.5(5.10. Separate)72 356.4 R (Compilation with Pc)2.5 E F0 4.584(As)97 372 S 2.084(eparate compilation f) 112.694 372 R 2.084(acility is pro)-.1 F 2.084(vided with the Berk)-.15 F(ele) -.1 E 4.584(yP)-.15 G 2.084(ascal compiler)367.576 372 R(,)-.4 E F2(pc)4.584 E F0 7.083(.T)C 2.083(his f)459.517 372 R(acility)-.1 E(allo)72 384 Q .01 (ws programs to be di)-.25 F .011 (vided into a number of \214les and the pieces to be compiled indi)-.25 F (vidually)-.25 E 2.511(,t)-.65 G 2.511(ob)459.638 384 S 2.511(el)472.149 384 S (ink)481.88 384 Q(ed)-.1 E .178(together at some later time.)72 396 R .178 (This is especially useful for lar)5.178 F .177 (ge programs, where small changes w)-.18 F .177(ould other)-.1 F(-)-.2 E (wise require time-consuming re-compilation of the entire program.)72 408 Q (Normally)97 423.6 Q(,)-.65 E F2(pc)3.836 E F0 -.15(ex)3.836 G 1.337 (pects to be gi).15 F -.15(ve)-.25 G 3.837(ne).15 G 1.337(ntire P)242.96 423.6 R 1.337(ascal programs.)-.15 F(Ho)6.337 E(we)-.25 E -.15(ve)-.25 G 2.137 -.4 (r, i).15 H 3.837(fg).4 G -2.15 -.25(iv e)397.855 423.6 T 3.837(nt).25 G(he) 421.292 423.6 Q F1<ad63>3.837 E F0 1.337(option on the)3.837 F .515(command li\ ne, it will accept a sequence of de\214nitions and declarations, and compile t\ hem into a)72 435.6 R F1(.o)3.015 E F0 .515(\214le, to)3.015 F .495(be link)72 447.6 R .495(ed with a P)-.1 F .495(ascal program at a later time.)-.15 F .495 (In order that procedures and functions be a)5.495 F -.25(va)-.2 G .495 (ilable across).25 F .25(separately compiled \214les, the)72 459.6 R 2.75(ym) -.15 G .249(ust be declared with the directi)204.78 459.6 R -.15(ve)-.25 G F1 (exter)2.899 E(nal)-.15 E F0 5.249(.T)C .249(his directi)389.545 459.6 R .549 -.15(ve i)-.25 H 2.749(ss).15 G .249(imilar to the)454.612 459.6 R(directi)72 471.6 Q -.15(ve)-.25 G F1 -.25(fo)2.769 G(rward).25 E F0 .119(in that it must \ precede the resolution of the function or procedure, and formal parameters) 2.619 F .216(and function result types must be speci\214ed at the)72 483.6 R F1 (exter)2.716 E(nal)-.15 E F0 .216 (declaration and may not be speci\214ed at the reso-)2.716 F(lution.)72 495.6 Q -.8(Ty)97 511.2 S 1.64 (pe checking is performed across separately compiled \214les.).8 F 1.64 (Since P)6.64 F 1.64(ascal type de\214ntions de\214ne)-.15 F 1.018 (unique types, an)72 523.2 R 3.518(yt)-.15 G 1.018(ypes which are shared betwe\ en separately compiled \214les must be the same de\214nition.)150.454 523.2 R .028(This seemingly impossible problem is solv)72 535.2 R .029(ed using a f) -.15 F .029(acility similar to the)-.1 F F1(include)2.529 E F0 -.1(fa)2.529 G .029(cility discussed abo).1 F -.15(ve)-.15 G(.).15 E .406 (De\214nitions may be placed in \214les with the e)72 547.2 R(xtension)-.15 E F1(.h)2.906 E F0 .406(and the \214les included by separately compiled \214les.) 2.906 F .308(Each de\214nition from a)72 559.2 R F1(.h)2.808 E F0 .309 (\214le de\214nes a unique type, and all uses of a de\214nition from the same) 2.808 F F1(.h)2.809 E F0 .309(\214le de\214ne)2.809 F 1.07(the same type.)72 571.2 R(Similarly)6.07 E 3.57(,t)-.65 G 1.07(he f)183.13 571.2 R 1.07 (acility is e)-.1 F 1.07(xtended to allo)-.15 F 3.57(wt)-.25 G 1.07 (he de\214nition of)317.37 571.2 R F1(const)3.57 E F0 3.57(sa)C 1.07 (nd the declaration of)418.31 571.2 R F1(label)72 583.2 Q F0(s,)A F1 -.1(va) 4.035 G(r).1 E F0 1.535(s, and)B F1(exter)4.035 E 1.535(nal function)-.15 F F0 4.035(sa)C(nd)233.025 583.2 Q F1(pr)4.035 E(ocedur)-.18 E(e)-.18 E F0 4.035 (s. Thus)B F1(pr)4.035 E(ocedur)-.18 E(e)-.18 E F0 4.036(sa)C(nd)383.426 583.2 Q F1(function)4.036 E F0 4.036(sw)C 1.536(hich are used)448.168 583.2 R .474 (between separately compiled \214les must be declared)72 595.2 R F1(exter)2.974 E(nal)-.15 E F0 2.974(,a)C .474(nd must be so declared in a)328.084 595.2 R F1 (.h)2.974 E F0 .474(\214le included)2.974 F 1.673(by an)72 607.2 R 4.173<798c> -.15 G 1.673(le which calls or resolv)110.196 607.2 R 1.674(es the)-.15 F F1 (function)4.174 E F0(or)4.174 E F1(pr)4.174 E(ocedur)-.18 E(e)-.18 E F0 6.674 (.C)C(on)349.998 607.2 Q -.15(ve)-.4 G(rsely).15 E(,)-.65 E F1(function)4.174 E F0 4.174(sa)C(nd)442.416 607.2 Q F1(pr)4.174 E(ocedur)-.18 E(e)-.18 E F0(s)A (declared)72 619.2 Q F1(exter)3.318 E(nal)-.15 E F0 .817 (may only be so declared in)3.318 F F1(.h)3.317 E F0 3.317(\214les. These)3.317 F .817(\214les may be included only at the outermost)3.317 F(le)72 631.2 Q -.15 (ve)-.25 G .065(l, and thus de\214ne or declare global objects.).15 F .065 (Note that since only)5.065 F F1(exter)2.565 E .065(nal function)-.15 F F0(and) 2.565 E F1(pr)2.565 E(ocedur)-.18 E(e)-.18 E F0(dec-)2.565 E .132 (larations \(and not resolutions\) are allo)72 643.2 R .131(wed in)-.25 F F1 (.h)2.631 E F0 .131(\214les, statically nested)2.631 F F1(function)2.631 E F0 2.631(sa)C(nd)399.966 643.2 Q F1(pr)2.631 E(ocedur)-.18 E(e)-.18 E F0 2.631(sc) C .131(an not be)467.078 643.2 R(declared)72 655.2 Q F1(exter)2.5 E(nal)-.15 E F0(.)A(An e)97 670.8 Q(xample of the use of included)-.15 E F1(.h)2.5 E F0 (\214les in a program w)2.5 E(ould be:)-.1 E F1(pr)108 688.8 Q(ogram)-.18 E F0 (compiler\(input, output, obj\);)2.5 E(#)108 712.8 Q F1(include)A F0 ("globals.h")2.5 E(#)108 724.8 Q F1(include)A F0("scanner)2.5 E(.h")-.55 E EP %%Page: 33 33 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7)462.39 48 Q/F1 10/Symbol SF(-)A F0 (33)A(#)108 84 Q/F2 10/Times-Bold@0 SF(include)A F0("parser)2.5 E(.h")-.55 E(#) 108 96 Q F2(include)A F0("semantics.h")2.5 E F2(begin)108 120 Q F0 2.5({m)118 132 S(ain program })133.08 132 Q F2(end)108 144 Q F0(.)A .282(This might inclu\ de in the main program the de\214nitions and declarations of all the global)97 165.6 R F2(label)2.783 E F0(s,)A F2(con-)2.783 E(st)72 177.6 Q F0 .624(s, and)B F2(type)A F0(s)A F2 -.1(va)3.124 G(r).1 E F0 3.124(sf)C .623 (rom the \214le globals.h, and the)153.202 177.6 R F2(exter)3.123 E .623 (nal function)-.15 F F0(and)3.123 E F2(pr)3.123 E(ocedur)-.18 E(e)-.18 E F0 .623(declarations for each)3.123 F .093 (of the separately compiled \214les for the scanner)72 189.6 R 2.593(,p)-.4 G .093(arser and semantics.)269.244 189.6 R .093(The header \214le)5.093 F/F3 10 /Times-Italic@0 SF(scanner)2.593 E(.h)-1.11 E F0 -.1(wo)2.594 G .094(uld con-) .1 F(tain declarations of the form:)72 201.6 Q F2(type)108 219.6 Q F0(tok)118 231.6 Q(en)-.1 E F1(=)2.5 E F2 -.18(re)2.5 G(cord).18 E F0 2.5({t)133 243.6 S (ok)143.08 243.6 Q(en \214elds })-.1 E F2(end)118 255.6 Q F0(;)A F2(function) 108 279.6 Q F0(scan\()2.5 E F2 -.1(va)C(r).1 E F0(input\214le: te)2.5 E (xt\): tok)-.15 E(en;)-.1 E F2(exter)118 291.6 Q(nal)-.15 E F0(;)A (Then the scanner might be in a separately compiled \214le containing:)72 309.6 Q(#)108 327.6 Q F2(include)A F0("globals.h")2.5 E(#)108 339.6 Q F2(include)A F0 ("scanner)2.5 E(.h")-.55 E F2(function)108 363.6 Q F0(scan;)2.5 E F2(begin)108 375.6 Q F0 2.5({s)118 387.6 S(canner code })129.19 387.6 Q F2(end)108 399.6 Q F0(;)A .675 (which includes the same global de\214nitions and declarations and resolv)72 417.6 R .675(es the scanner functions and proce-)-.15 F(dures declared)72 429.6 Q F2(exter)2.5 E(nal)-.15 E F0(in the \214le scanner)2.5 E(.h.)-.55 E F2 2.5 (A. A)72 453.6 R(ppendix to W)-.25 E(irth')-.18 E 2.5(sP)-.37 G(ascal Report) 182.77 453.6 Q F0 .35(This section is an appendix to the de\214nition of the P) 97 469.2 R .35(ascal language in Niklaus W)-.15 F(irth')-.4 E(s)-.55 E F3 -.8 (Pa)2.85 G .35(scal Report).8 F F0 .796 (and, with that Report, precisely de\214nes the Berk)72 481.2 R(ele)-.1 E 3.296 (yi)-.15 G 3.296(mplementation. This)293.09 481.2 R .796 (appendix includes a summary)3.296 F 1.162(of e)72 493.2 R 1.162 (xtensions to the language, gi)-.15 F -.15(ve)-.25 G 3.662(st).15 G 1.162(he w) 226.462 493.2 R 1.162 (ays in which the unde\214ned speci\214cations were resolv)-.1 F 1.162(ed, gi) -.15 F -.15(ve)-.25 G(s).15 E 1.653(limitations and restrictions of the curren\ t implementation, and lists the added functions and procedures)72 505.2 R -.2 (av)72 517.2 S 2.555(ailable. It)-.05 F .056(concludes with a list of dif)2.555 F .056(ferences with the commonly a)-.25 F -.25(va)-.2 G .056(ilable P).25 F .056(ascal 6000\2553.4 implementa-)-.15 F (tion, and some comments on standard and portable P)72 529.2 Q(ascal.)-.15 E F2 2.5(A.1. Extensions)72 553.2 R(to the language P)2.5 E(ascal)-.1 E F0 .892 (This section de\214nes non-standard language constructs a)97 568.8 R -.25(va) -.2 G .892(ilable in Berk).25 F(ele)-.1 E 3.391(yP)-.15 G 3.391(ascal. The) 415.517 568.8 R F2(s)3.391 E F0(standard)3.391 E -.15(Pa)72 580.8 S .091 (scal option of the translators).15 F F3(pi)2.591 E F0(and)2.591 E F3(pc)2.591 E F0 .091(can be used to detect these e)2.591 F .091 (xtensions in programs which are to be)-.15 F(transported.)72 592.8 Q F2 (String padding)72 616.8 Q F0(Berk)97 632.4 Q(ele)-.1 E 2.679(yP)-.15 G .179 (ascal will pad constant strings with blanks in e)140.939 632.4 R .178 (xpressions and as v)-.15 F .178(alue parameters to mak)-.25 F(e)-.1 E (them as long as is required.)72 644.4 Q(The follo)5 E(wing is a le)-.25 E -.05 (ga)-.15 G 2.5(lB).05 G(erk)290.14 644.4 Q(ele)-.1 E 2.5(yP)-.15 G (ascal program:)327.23 644.4 Q F2(pr)108 662.4 Q(ogram)-.18 E F0(x\(output\);) 2.5 E F2 -.1(va)108 674.4 S(r).1 E F0 2.5(z:)2.5 G F2(pack)A(ed array)-.1 E F0 2.5([1.)2.5 G 2.5(.1)212.23 674.4 S 2.5(3])222.23 674.4 S F2(of)A F0(char;)2.5 E F2(begin)108 686.4 Q F0 2.5(z:)118 698.4 S F1(=)127.72 698.4 Q F0 (\264red\264;)2.5 E(writeln\(z\))118 710.4 Q F2(end)108 722.4 Q F0(;)A EP %%Page: 34 34 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(PSD:7)72 48 Q/F1 10/Symbol SF(-)A F0 262.49(34 Berk)B (ele)-.1 E 2.5(yP)-.15 G(ascal User\264s Manual)422.36 48 Q (The padded blanks are added on the right.)72 84 Q(Thus the assignment abo)5 E .3 -.15(ve i)-.15 H 2.5(se).15 G(qui)369.15 84 Q -.25(va)-.25 G(lent to:).25 E 2.5(z:)108 102 S F1(=)117.72 102 Q F0 22.5(\264red \264)2.5 F (which is standard P)72 120 Q(ascal.)-.15 E/F2 10/Times-Bold@0 SF (Octal constants, octal and hexadecimal write)72 144 Q F0 .399 (Octal constants may be gi)97 159.6 R -.15(ve)-.25 G 2.899(na).15 G 2.899(sas) 223.295 159.6 S .399(equence of octal digits follo)241.313 159.6 R .4 (wed by the character `b' or `B'.)-.25 F(The)5.4 E(forms)72 171.6 Q(write\(a:n) 108 189.6 Q F2(oct)2.5 E F0(\))A(and)72 207.6 Q(write\(a:n)108 225.6 Q F2(hex) 2.5 E F0(\))A .907(cause the internal representation of e)72 243.6 R(xpression) -.15 E/F3 10/Times-Italic@0 SF(a,)3.407 E F0 .907 (which must be Boolean, character)3.407 F 3.406(,i)-.4 G(nte)423.642 243.6 Q (ger)-.15 E 3.406(,p)-.4 G(ointer)458.988 243.6 Q 3.406(,o)-.4 G 3.406(ra) 492.824 243.6 S(user)72 255.6 Q (-de\214ned enumerated type, to be written in octal or he)-.2 E (xadecimal respecti)-.15 E -.15(ve)-.25 G(ly).15 E(.)-.65 E F2 (Assert statement)72 279.6 Q F0(An)97 295.2 Q F2(assert)2.591 E F0 .091 (statement causes a)2.591 F F3(Boolean)2.591 E F0 -.15(ex)2.591 G .091 (pression to be e).15 F -.25(va)-.25 G .092 (luated each time the statement is e).25 F -.15(xe)-.15 G(cuted.).15 E 3.018 (Ar)72 307.2 S .518(untime error results if an)85.568 307.2 R 3.018(yo)-.15 G 3.018(ft)199.378 307.2 S .517(he e)208.506 307.2 R .517(xpressions e)-.15 F -.25(va)-.25 G .517(luates to be).25 F F3(false)3.017 E F0 5.517(.T)C(he) 366.488 307.2 Q F2(assert)3.017 E F0 .517(statement is treated as a)3.017 F (comment if run-time tests are disabled.)72 319.2 Q(The syntax for)5 E F2 (assert)2.5 E F0(is:)2.5 E F2(assert)108 337.2 Q F0(<e)2.5 E(xpr>)-.15 E F2 (Enumerated type input-output)72 367.2 Q F0 .651 (Enumerated types may be read and written.)97 382.8 R .652 (On output the string name associated with the enumer)5.651 F(-)-.2 E .414 (ated v)72 394.8 R .414(alue is output.)-.25 F .414(If the v)5.414 F .414 (alue is out of range, a runtime error occurs.)-.25 F .413 (On input an identi\214er is read and)5.414 F(look)72 406.8 Q .404 (ed up in a table of names associated with the type of the v)-.1 F .405 (ariable, and the appropriate internal v)-.25 F .405(alue is)-.25 F (assigned to the v)72 418.8 Q(ariable being read.)-.25 E (If the name is not found in the table a runtime error occurs.)5 E F2(Structur) 72 442.8 Q 2.5(er)-.18 G(etur)119.68 442.8 Q(ning functions)-.15 E F0 .853 (An e)97 458.4 R .852(xtension has been added which allo)-.15 F .852 (ws functions to return arbitrary sized structures rather than)-.25 F (just scalars as in the standard.)72 470.4 Q F2(Separate compilation)72 494.4 Q F0 .138(The compiler)97 510 R F3(pc)2.638 E F0 .138(has been e)2.638 F .138 (xtended to allo)-.15 F 2.639(ws)-.25 G .139(eparate compilation of programs.) 280.446 510 R .139(Procedures and func-)5.139 F .941 (tions declared at the global le)72 522 R -.15(ve)-.25 G 3.441(lm).15 G .941 (ay be compiled separately)217.226 522 R 5.941(.T)-.65 G .94 (ype checking of calls to separately com-)337.29 522 R 1.07(piled routines is \ performed at load time to insure that the program as a whole is consistent.)72 534 R 1.071(See section)6.071 F(5.10 for details.)72 546 Q F2 2.5 (A.2. Resolution)72 570 R(of the unde\214ned speci\214cations)2.5 E (File name \255 \214le v)72 594 Q(ariable associations)-.1 E F0 .048(Each P)97 609.6 R .048(ascal \214le v)-.15 F .048(ariable is associated with a named)-.25 F/F4 8/Times-Roman@0 SF(UNIX)2.548 E F0 2.547(\214le. Except)2.547 F(for)2.547 E F3(input)2.547 E F0(and)2.547 E F3(output,)2.547 E F0 .047(which are)2.547 F -.15(ex)72 621.6 S(ceptions to some of the rules, a name can become associated\ with a \214le in an).15 E 2.5(yo)-.15 G 2.5(ft)400.25 621.6 S(hree w)408.86 621.6 Q(ays:)-.1 E 26.67(1\) If)84.5 637.2 R 2.561(ag)2.561 G .061(lobal P) 143.222 637.2 R .061(ascal \214le v)-.15 F .061(ariable appears in the)-.25 F F2(pr)2.561 E(ogram)-.18 E F0 .061(statement then it is associated with)2.561 F F4(UNIX)2.562 E F0(\214le of the same name.)122 649.2 Q 26.67(2\) If)84.5 664.8 R 3.325<618c>3.325 G .825(le w)145.31 664.8 R .825(as reset or re)-.1 F .824 (written using the e)-.25 F .824(xtended tw)-.15 F(o-ar)-.1 E .824 (gument form of)-.18 F F3 -.37(re)3.324 G(set).37 E F0(or)3.324 E F3 -1.91 -.37 (re w)3.324 H(rite).37 E F0(then)3.324 E(the gi)122 676.8 Q -.15(ve)-.25 G 2.5 (nn).15 G(ame is associated.)166.04 676.8 Q 26.67(3\) If)84.5 692.4 R 3.434 <618c>3.434 G .935(le which has ne)145.528 692.4 R -.15(ve)-.25 G 3.435(rh).15 G(ad)231.068 692.4 Q F4(UNIX)3.435 E F0 .935(name associated is reset or re) 3.435 F .935(written without specifying a)-.25 F .724(name via the second ar) 122 704.4 R .724 (gument, then a temporary name of the form `tmp.x' is associated with)-.18 F .058(the \214le.)122 716.4 R -.7(Te)5.058 G .059(mporary names start with `tmp\ .1' and continue by incrementing the last character in).7 F(the)122 728.4 Q F4 (USASCII)2.5 E F0 2.5(ordering. T)2 F(emporary \214les are remo)-.7 E -.15(ve) -.15 G 2.5(da).15 G(utomatically when their scope is e)332.952 728.4 Q(xited.) -.15 E EP %%Page: 35 35 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7-35)464.55 48 Q/F1 10/Times-Bold@0 SF (The pr)72 84 Q(ogram statement)-.18 E F0(The syntax of the)97 99.6 Q F1(pr)2.5 E(ogram)-.18 E F0(statement is:)2.5 E F1(pr)108 117.6 Q(ogram)-.18 E F0 (<id> \( <\214le id> { , <\214le id > } \) ;)2.5 E .195 (The \214le identi\214ers \(other than)72 135.6 R/F2 10/Times-Italic@0 SF (input)2.695 E F0(and)2.695 E F2(output)2.695 E F0 2.695(\)m)C .195 (ust be declared as v)274.66 135.6 R .195(ariables of)-.25 F F1(\214le)2.695 E F0 .194(type in the global dec-)2.694 F(laration part.)72 147.6 Q F1 (The \214les input and output)72 171.6 Q F0 .711(The formal parameters)97 187.2 R F2(input)3.212 E F0(and)3.212 E F2(output)3.212 E F0 .712 (are associated with the)3.212 F/F3 8/Times-Roman@0 SF(UNIX)3.212 E F0 .712 (standard input and output and)3.212 F(ha)72 199.2 Q .3 -.15(ve a s)-.2 H(ome) .15 E(what special status.)-.25 E(The follo)5 E(wing rules must be noted:)-.25 E 26.67(1\) The)84.5 214.8 R .098(program heading)2.598 F F1(must)2.598 E F0 .098(contains the formal parameter)2.598 F F2(output.)2.598 E F0(If)5.098 E F2 (input)2.598 E F0 .098(is used, e)2.598 F .097(xplicitly or)-.15 F(implicitly) 122 226.8 Q 2.5(,t)-.65 G(hen it must also be declared here.)168.03 226.8 Q 26.67(2\) Unlik)84.5 242.4 R 3.042(ea)-.1 G .542(ll other \214les, the P) 156.602 242.4 R .542(ascal \214les)-.15 F F2(input)3.042 E F0(and)3.042 E F2 (output)3.042 E F0 .543(must not be de\214ned in a declaration, as)3.042 F (their declaration is automatically:)122 254.4 Q F1 -.1(va)158 272.4 S(r).1 E F0(input, output: te)2.5 E(xt)-.15 E 26.67(3\) The)84.5 294 R(procedure)2.816 E F2 -.37(re)2.816 G(set).37 E F0 .315(may be used on)2.816 F F2(input.)2.815 E F0 .315(If no)5.315 F F3(UNIX)2.815 E F0 .315(\214le name has e)2.815 F -.15 (ve)-.25 G 2.815(rb).15 G .315(een associated with)425.61 294 R F2(input,)122 306 Q F0 .292(and no \214le name is gi)2.792 F -.15(ve)-.25 G .293 (n, then an attempt will be made to `re).15 F(wind')-.25 E F2(input.)2.793 E F0 .293(If this f)5.293 F .293(ails, a)-.1 F .932(run time error will occur)122 318 R(.)-.55 E F2(Re)5.931 E(write)-.15 E F0 .931 (calls to output act as for an)3.431 F 3.431(yo)-.15 G .931(ther \214le, e) 392.936 318 R .931(xcept that)-.15 F F2(output)3.431 E F0 (initially has no associated \214le.)122 330 Q(This means that a simple)5 E(re) 158 348 Q(write\(output\))-.25 E(associates a temporary name with)122 366 Q F2 (output.)2.5 E F1(Details f)72 390 Q(or \214les)-.25 E F0 .565 (If a \214le other than)97 405.6 R F2(input)3.065 E F0 .566 (is to be read, then reading must be initiated by a call to the procedure)3.065 F F2 -.37(re)3.066 G(set).37 E F0 .444(which causes the P)72 417.6 R .444 (ascal system to attempt to open the associated)-.15 F F3(UNIX)2.944 E F0 .443 (\214le for reading.)2.943 F .443(If this f)5.443 F .443(ails, then a)-.1 F .745(runtime error occurs.)72 429.6 R .745(Writing of a \214le other than)5.745 F F2(output)3.245 E F0 .745(must be initiated by a)3.245 F F2 -1.91 -.37(re w) 3.245 H(rite).37 E F0 .745(call, which causes)3.245 F(the P)72 441.6 Q (ascal system to create the associated)-.15 E F3(UNIX)2.5 E F0 (\214le and to then open the \214le for writing only)2.5 E(.)-.65 E F1 (Buffering)72 465.6 Q F0 .492(The b)97 481.2 R(uf)-.2 E .491(fering for)-.25 F F2(output)2.991 E F0 .491(is determined by the v)2.991 F .491(alue of the)-.25 F F1(b)2.991 E F0 .491(option at the end of the)2.991 F F1(pr)2.991 E(ogram) -.18 E F0(state-)2.991 E 3.032(ment. If)72 493.2 R .532(it has its def)3.032 F .532(ault v)-.1 F .532(alue 1, then)-.25 F F2(output)3.032 E F0 .532(is b)3.032 F(uf)-.2 E .532(fered in blocks of up to 512 characters, \215ushed when-)-.25 F -2.15 -.25(ev e)72 505.2 T 2.687(raw).25 G .186 (riteln occurs and at each reference to the \214le)105.844 505.2 R F2(input.) 2.686 E F0 .186(If it has the v)5.186 F .186(alue 0,)-.25 F F2(output)2.686 E F0 .186(is unb)2.686 F(uf)-.2 E 2.686(fered. An)-.25 F(y)-.15 E -.25(va)72 517.2 S .391(lue of 2 or more gi).25 F -.15(ve)-.25 G 2.891(sb).15 G .392 (lock b)178.676 517.2 R(uf)-.2 E .392(fering without line or)-.25 F F2(input) 2.892 E F0 .392(reference \215ushing.)2.892 F .392 (All other output \214les are)5.392 F(al)72 529.2 Q -.1(wa)-.1 G 1.349(ys b).1 F(uf)-.2 E 1.349(fered in blocks of 512 characters.)-.25 F 1.348(All output b) 6.348 F(uf)-.2 E 1.348(fers are \215ushed when the \214les are closed at)-.25 F .207(scope e)72 541.2 R .207(xit, whene)-.15 F -.15(ve)-.25 G 2.707(rt).15 G .207(he procedure)161.491 541.2 R F2(messa)2.707 E -.1(ge)-.1 G F0 .208 (is called, and can be \215ushed using the b)2.807 F .208(uilt-in procedure)-.2 F F2(\215ush.)2.708 E F0 .608(An important point for an interacti)97 556.8 R .908 -.15(ve i)-.25 H .608(mplementation is the de\214nition of `input).15 F/F4 10/Symbol SF<ad>A F0 3.108('. If)B F2(input)3.108 E F0 .608(is a tele-)3.108 F 1.551(type, and the P)72 568.8 R 1.551 (ascal system reads a character at the be)-.15 F 1.551(ginning of e)-.15 F -.15 (xe)-.15 G 1.551(cution to de\214ne `input).15 F F4<ad>A F0 1.552(', then no)B 1.064(prompt could be printed by the program before the user is required to ty\ pe some input.)72 580.8 R -.15(Fo)6.064 G 3.563(rt).15 G 1.063(his reason,) 460.167 580.8 R(`input)72 592.8 Q F4<ad>A F0 2.879('i)C 2.879(sn)110.909 592.8 S .379(ot de\214ned by the system until its de\214nition is needed, reading fr\ om a \214le occurring only when)122.678 592.8 R(necessary)72 604.8 Q(.)-.65 E F1(The character set)72 628.8 Q F0(Se)97 644.4 Q -.15(ve)-.25 G 3.133(nb).15 G (it)129.173 644.4 Q F3(USASCII)3.133 E F0 .633(is the character set used on) 3.133 F F3(UNIX)3.133 E F0 5.633(.T)C .633(he standard P)320.114 644.4 R .633 (ascal symbols `and', 'or', 'not',)-.15 F('<)72 656.4 Q F4(=)A F0 .193(', '>)B F4(=)A F0 .193(', '<>', and the uparro)B 2.693(w`)-.25 G F4<ad>212.238 656.4 Q F0 2.693('\()C .192(for pointer quali\214cation\) are recognized.\207)227.621 656.4 R .192(Less portable are the syn-)5.192 F(on)72 668.4 Q (yms tilde `~' for)-.15 E F1(not)2.5 E F0 2.5(,`)C(&' for)170.17 668.4 Q F1 (and)2.5 E F0 2.5(,a)C(nd `|' for)223.5 668.4 Q F1(or)2.5 E F0(.)A .559 (Upper and lo)97 684 R .559(wer case are considered to be distinct.)-.25 F -2.15 -.25(Ke y)5.559 H -.1(wo).25 G .559(rds and b).1 F(uilt-in)-.2 E F1(pr) 3.06 E(ocedur)-.18 E(e)-.18 E F0(and)3.06 E F1(function)3.06 E .32 LW 144 692 72 692 DL F3 .214(\207On man)72 703.8 R 2.214(yt)-.12 G .214 (erminals and printers, the up arro)110.084 703.8 R 2.215(wi)-.2 G 2.215(sr) 227.37 703.8 S .215(epresented as a circum\215e)235.361 703.8 R 2.215(x`)-.12 G 2.215(^'. These)325.405 703.8 R .215(are not distinct charac-)2.215 F(ters, b) 72 713.8 Q(ut rather dif)-.16 E (ferent graphic representations of the same internal codes.)-.2 E (The proposed standard for P)72 725.6 Q(ascal considers them to be the same.) -.12 E EP %%Page: 36 36 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 264.65(PSD:7-36 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q .514(names are composed of all lo)72 84 R .514(wer case letters.)-.25 F .514(Thus the identi\214ers GO)5.514 F .874 -.18 (TO a)-.4 H .514(nd GOto are distinct both from).18 F (each other and from the k)72 96 Q -.15(ey)-.1 G -.1(wo).15 G(rd).1 E/F1 10 /Times-Bold@0 SF(goto)2.5 E F0 5(.T)C(he standard type `boolean' is also a) 238.55 96 Q -.25(va)-.2 G(ilable as `Boolean'.).25 E .402(Character strings an\ d constants may be delimited by the character `\264' or by the character `#'; \ the lat-)97 111.6 R .86(ter is sometimes con)72 123.6 R -.15(ve)-.4 G .86 (nient when programs are to be transported.).15 F .86 (Note that the `#' character has special)5.86 F (meaning when it is the \214rst character on a line \255 see)72 135.6 Q/F2 10 /Times-Italic@0 SF(Multi-\214le pr)2.5 E -.1(og)-.45 G -.15(ra).1 G(ms).15 E F0 (belo)2.5 E -.65(w.)-.25 G F1(The standard types)72 159.6 Q F0 (The standard type)97 175.2 Q F2(inte)2.5 E -.1(ge)-.4 G(r).1 E F0 (is conceptually de\214ned as)2.5 E F1(type)108 193.2 Q F0(inte)2.5 E(ger)-.15 E/F3 10/Symbol SF(=)2.5 E F0(minint .. maxint;)2.5 E F2(Inte)72 211.2 Q -.1(ge) -.4 G(r).1 E F0(is implemented with 32 bit tw)2.5 E(os complement arithmetic.) -.1 E(Prede\214ned constants of type)5 E F2(inte)2.5 E -.1(ge)-.4 G(r).1 E F0 (are:)2.5 E F1(const)108 229.2 Q F0(maxint)2.5 E F3(=)2.5 E F0 (2147483647; minint)2.5 E F3 2.5(=-)2.5 G F0(2147483648;)268.37 229.2 Q (The standard type)97 250.8 Q F2 -.15(ch)2.5 G(ar).15 E F0 (is conceptually de\214ned as)2.5 E F1(type)108 268.8 Q F0(char)2.5 E F3(=)2.5 E F0(minchar .. maxchar;)2.5 E .532(Built-in character constants are `minchar'\ and `maxchar', `bell' and `tab'; ord\(minchar\))72 286.8 R F3(=)3.033 E F0 .533(0, ord\(maxchar\))3.033 F F3(=)72 298.8 Q F0(127.)2.5 E .621(The type)97 314.4 R F2 -.37(re)3.121 G(al).37 E F0 .621 (is implemented using 64 bit \215oating point arithmetic.)3.121 F .62 (The \215oating point arithmetic is)5.62 F .357 (done in `rounded' mode, and pro)72 326.4 R .358 (vides approximately 17 digits of precision with numbers as small as 10 to)-.15 F(the ne)72 338.4 Q -.05(ga)-.15 G(ti).05 E .3 -.15(ve 3)-.25 H(8th po).15 E (wer and as lar)-.25 E(ge as 10 to the 38th po)-.18 E(wer)-.25 E(.)-.55 E F1 (Comments)72 362.4 Q F0 .247 (Comments can be delimited by either `{' and `}' or by `\()97 378 R F3(*)A F0 2.747('a)C .247(nd `)342.294 378 R F3(*)A F0 2.747(\)'. If)B .247 (the character `{' appears in a)2.747 F .255 (comment delimited by `{' and `}', a w)72 390 R .255 (arning diagnostic is printed.)-.1 F 2.755(As)5.255 G .255(imilar w)359.25 390 R .255(arning will be printed if the)-.1 F .602(sequence `\()72 402 R F3(*)A F0 3.102('a)C .602(ppears in a comment delimited by `\()134.284 402 R F3(*)A F0 3.102('a)C .602(nd `)298.748 402 R F3(*)A F0 3.102(\)'. The)B .601 (restriction implied by this w)3.102 F .601(arning is)-.1 F (not part of standard P)72 414 Q(ascal, b)-.15 E(ut detects man)-.2 E 2.5(yo) -.15 G(therwise subtle errors.)257.86 414 Q F1(Option contr)72 438 Q(ol)-.18 E F0 .557(Options of the translators may be controlled in tw)97 453.6 R 3.057(od) -.1 G .557(istinct w)313.281 453.6 R 3.057(ays. A)-.1 F .557 (number of options may appear)3.057 F .355(on the command line in)72 465.6 R -.2(vo)-.4 G .355(king the translator).2 F 5.355(.T)-.55 G .355 (hese options are gi)264.155 465.6 R -.15(ve)-.25 G 2.855(na).15 G 2.855(so) 361.265 465.6 S .355(ne or more strings of letters pre-)373.01 465.6 R .059 (ceded by the character `\255' and cause the def)72 477.6 R .059 (ault setting of each gi)-.1 F -.15(ve)-.25 G 2.56(no).15 G .06 (ption to be changed.)356.43 477.6 R .06(This method of)5.06 F (communication of options is e)72 489.6 Q(xpected to predominate for)-.15 E/F4 8/Times-Roman@0 SF(UNIX)2.5 E F0 5(.T)C(hus the command)337.092 489.6 Q(%)108 507.6 Q F1(pi \255l \255s f)2.5 E(oo.p)-.25 E F0 .29(translates the \214le foo\ .p with the listing option enabled \(as it normally is of)72 525.6 R .289 (f\), and with only standard P)-.25 F(ascal)-.15 E(features a)72 537.6 Q -.25 (va)-.2 G(ilable.).25 E .756(If more control o)97 553.2 R -.15(ve)-.15 G 3.256 (rt).15 G .756 (he portions of the program where options are enabled is required, then option) 185.814 553.2 R .083(control in comments can and should be used.)72 565.2 R .082(The format for option control in comments is identical to that)5.082 F .55 (used in P)72 577.2 R .55(ascal 6000\2553.4.)-.15 F .551(One places the charac\ ter `$' as the \214rst character of the comment and follo)5.55 F .551(ws it) -.25 F 1.385(by a comma separated list of directi)72 589.2 R -.15(ve)-.25 G 3.884(s. Thus).15 F 1.384(an equi)3.884 F -.25(va)-.25 G 1.384 (lent to the command line e).25 F 1.384(xample gi)-.15 F -.15(ve)-.25 G 3.884 (na).15 G(bo)484.86 589.2 Q -.15(ve)-.15 G -.1(wo)72 601.2 S(uld be:).1 E({$l) 108 619.2 Q F3(+)A F0(,s)A F3(+)A F0(listing on, standard P)2.5 E(ascal})-.15 E .108(as the \214rst line of the program.)72 637.2 R .108(The `l' option is mor\ e appropriately speci\214ed on the command line, since it)5.108 F .764(is e)72 649.2 R .764(xtremely unlik)-.15 F .764(ely in an interacti)-.1 F 1.064 -.15 (ve e)-.25 H -.4(nv).15 G .764(ironment that one w).4 F .764 (ants a listing of the program each time it is)-.1 F(translated.)72 661.2 Q (Directi)97 676.8 Q -.15(ve)-.25 G 2.869(sc).15 G .369 (onsist of a letter designating the option, follo)145.009 676.8 R .369 (wed either by a `)-.25 F F3(+)A F0 2.87('t)C 2.87(ot)409.93 676.8 S .37 (urn the option on, or)420.58 676.8 R(by a `\255' to turn the option of)72 688.8 Q 2.5(f. The)-.25 F F1(b)2.5 E F0(option tak)2.5 E (es a single digit instead of a `)-.1 E F3(+)A F0 2.5('o)C 2.5(r`)396.36 688.8 S(\255'.)405.52 688.8 Q EP %%Page: 37 37 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7-37)464.55 48 Q/F1 10/Times-Bold@0 SF (Notes on the listings)72 84 Q F0 .219 (The \214rst page of a listing includes a banner line indicating the v)97 99.6 R .219(ersion and date of generation of)-.15 F/F2 10/Times-Italic@0 SF(pi)2.719 E F0(or)2.718 E F2(pc)72 111.6 Q F0 5.241(.I)C 2.741(ta)92.511 111.6 S .242 (lso includes the)102.472 111.6 R/F3 8/Times-Roman@0 SF(UNIX)2.742 E F0 .242(p\ ath name supplied for the source \214le and the date of last modi\214cation of\ that)2.742 F(\214le.)72 123.6 Q -.4(Wi)97 139.2 S .524 (thin the body of the listing, lines are numbered consecuti).4 F -.15(ve)-.25 G .523(ly and correspond to the line numbers).15 F .319(for the editor)72 151.2 R 5.319(.C)-.55 G(urrently)138.787 151.2 Q 2.819(,t)-.65 G .519 -.1(wo s)177.896 151.2 T .32(pecial kinds of lines may be used to format the listing: a line co\ nsisting of a).1 F .41(form-feed character)72 163.2 R 2.91(,c)-.4 G .409(ontro\ l-l, which causes a page eject in the listing, and a line with no characters w\ hich)160.98 163.2 R .747(causes the line number to be suppressed in the listin\ g, creating a truly blank line.)72 175.2 R .748(These lines thus corre-)5.748 F .614(spond to `eject' and `space' macros found in man)72 187.2 R 3.113(ya)-.15 G 3.113(ssemblers. Non-printing)287.042 187.2 R .613 (characters are printed as the)3.113 F(character `?' in the listing.\207)72 199.2 Q F1(The standard pr)72 223.2 Q(ocedur)-.18 E 2.5(ew)-.18 G(rite)185.25 223.2 Q F0 2.258(If no minimum \214eld length parameter is speci\214ed for a)97 238.8 R F2(write)4.757 E(,)-.1 E F0 2.257(the follo)4.757 F 2.257(wing def)-.25 F 2.257(ault v)-.1 F 2.257(alues are)-.25 F(assumed:)72 250.8 Q(inte)214.18 268.8 Q 62.865(ger 10)-.15 F 75.495(real 22)214.18 280.8 R 12.5(Boolean length) 214.18 292.8 R(of `true' or `f)2.5 E(alse')-.1 E 78.275(char 1)214.18 304.8 R 34.79(string length)214.18 316.8 R(of the string)2.5 E 78.265(oct 11)214.18 328.8 R(he)214.18 340.8 Q 83.695(x8)-.15 G .074(The end of each line in a te)72 358.8 R .075(xt \214le should be e)-.15 F .075 (xplicitly indicated by `writeln\(f\)', where `writeln\(output\)' may)-.15 F .37(be written simply as `writeln'.)72 370.8 R -.15(Fo)5.37 G(r).15 E F3(UNIX) 2.87 E F0 2.869(,t)C .369(he b)244.421 370.8 R .369 (uilt-in function `page\(f\)' puts a single)-.2 F F3(ASCII)2.869 E F0 .369 (form-feed char)2.869 F(-)-.2 E .15(acter on the output \214le.)72 382.8 R -.15 (Fo)5.15 G 2.65(rp).15 G .15(rograms which are to be transported the \214lter) 191.63 382.8 R F2(pcc)2.65 E F0 .15(can be used to interpret car)2.65 F(-)-.2 E (riage control, as)72 394.8 Q F3(UNIX)2.5 E F0(does not normally do so.)2.5 E F1 2.5(A.3. Restrictions)72 418.8 R(and limitations)2.5 E(Files)72 442.8 Q F0(\ Files cannot be members of \214les or members of dynamically allocated structu\ res.)97 458.4 Q F1(Arrays, sets and strings)72 482.4 Q F0 1.142 (The calculations in)97 498 R -.2(vo)-.4 G 1.141 (lving array subscripts and set elements are done with 16 bit arithmetic.).2 F (This)6.141 E .913(restricts the types o)72 510 R -.15(ve)-.15 G 3.413(rw).15 G .914(hich arrays and sets may be de\214ned.)175.332 510 R .914(The lo)5.914 F .914(wer bound of such a range must be)-.25 F .5 (greater than or equal to \25532768, and the upper bound less than 32768.)72 522 R .5(In particular)5.5 F 3(,s)-.4 G .5(trings may ha)422.18 522 R .8 -.15 (ve a)-.2 H -.15(ny).15 G(length from 1 to 65535 characters, and sets may cont\ ain no more than 65535 elements.)72 534 Q F1(Line and symbol length)72 558 Q F0 .373(There is no intrinsic limit on the length of identi\214ers.)97 573.6 R .374(Identi\214ers are considered to be distinct if the)5.374 F(y)-.15 E(dif)72 585.6 Q .458(fer in an)-.25 F 2.958(ys)-.15 G .458(ingle position o)128.794 585.6 R -.15(ve)-.15 G 2.957(rt).15 G .457(heir entire length.)210.146 585.6 R .457(There is a limit, ho)5.457 F(we)-.25 E -.15(ve)-.25 G 1.257 -.4(r, o).15 H 2.957(nt).4 G .457(he maximum input line)409.569 585.6 R 2.5(length. This)72 597.6 R(limit is quite generous ho)2.5 E(we)-.25 E -.15(ve)-.25 G .8 -.4(r, c) .15 H(urrently e).4 E(xceeding 160 characters.)-.15 E F1(Pr)72 621.6 Q(ocedur) -.18 E 2.5(ea)-.18 G(nd function nesting and pr)123.57 621.6 Q(ogram size)-.18 E F0 .352(At most 20 le)97 637.2 R -.15(ve)-.25 G .352(ls of).15 F F1(pr)2.852 E(ocedur)-.18 E(e)-.18 E F0(and)2.853 E F1(function)2.853 E F0 .353 (nesting are allo)2.853 F 2.853(wed. There)-.25 F .353 (is no fundamental, transla-)2.853 F .59 (tor de\214ned limit on the size of the program which can be translated.)72 649.2 R .589(The ultimate limit is supplied by the)5.589 F(hardw)72 661.2 Q .32 (are and thus, on the)-.1 F F3(PDP)2.82 E F0 .32 (-11, by the 16 bit address space.)B .321(If one runs up ag)5.32 F .321 (ainst the `ran out of mem-)-.05 F .725(ory' diagnostic the program may yet tr\ anslate if smaller procedures are used, as a lot of space is freed by)72 673.2 R(the translator at the completion of each)72 685.2 Q F1(pr)2.5 E(ocedur)-.18 E (e)-.18 E F0(or)2.5 E F1(function)2.5 E F0(in the current implementation.)2.5 E .32 LW 144 698.2 72 698.2 DL F3 1.008 (\207The character generated by a control-i indents to the ne)72 710 R 1.008 (xt `tab stop'.)-.12 F -.64(Ta)5.008 G 3.008(bs).64 G 1.008(tops are set e) 327.176 710 R -.12(ve)-.2 G 1.008(ry 8 columns in).12 F/F4 6.4/Times-Roman@0 SF (UNIX)72 720 Q F3 4(.T)C(abs thus pro)98.242 720 Q(vide a quick w)-.12 E (ay of indenting in the program.)-.08 E EP %%Page: 38 38 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 264.65(PSD:7-38 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q 1.193(On the)97 84 R/F1 8/Times-Roman@0 SF -1.08(VA)3.693 G(X)1.08 E F0 1.194 (-11, there is an implementation de\214ned limit of 65536 bytes per v)B 3.694 (ariable. There)-.25 F 1.194(is no)3.694 F(limit on the number of v)72 96 Q (ariables.)-.25 E/F2 10/Times-Bold@0 SF(Ov)72 120 Q(er\215o)-.1 E(w)-.1 E F0 1.897(There is currently no checking for o)97 135.6 R -.15(ve)-.15 G(r\215o).15 E 4.397(wo)-.25 G 4.397(na)291.629 135.6 S 1.897 (rithmetic operations at run-time on the)305.466 135.6 R F1(PDP)4.397 E F0 (-11.)A(Ov)72 147.6 Q(er\215o)-.15 E 2.5(wc)-.25 G(hecking is performed on the) 116.31 147.6 Q F1 -1.08(VA)2.5 G(X)1.08 E F0(-11 by the hardw)A(are.)-.1 E F2 2.5(A.4. Added)72 171.6 R(types, operators, pr)2.5 E(ocedur)-.18 E (es and functions)-.18 E(Additional pr)72 195.6 Q(ede\214ned types)-.18 E F0 (The type)97 211.2 Q/F3 10/Times-Italic@0 SF(alfa)2.5 E F0(is prede\214ned as:) 2.5 E F2(type)108 229.2 Q F0(alf)2.5 E(a)-.1 E/F4 10/Symbol SF(=)2.5 E F2(pack) 2.5 E(ed array)-.1 E F0 2.5([1)2.5 G(..10 ])224.38 229.2 Q F2(of char)2.5 E F0 (The type)97 250.8 Q F3(intset)2.5 E F0(is prede\214ned as:)2.5 E F2(type)108 268.8 Q F0(intset)2.5 E F4(=)2.5 E F2(set of)2.5 E F0(0..127)2.5 E .956 (In most cases the conte)72 286.8 R .956(xt of an e)-.15 F .956(xpression in) -.15 F -.2(vo)-.4 G .957(lving a constant set allo).2 F .957 (ws the translator to determine the)-.25 F .13(type of the set, e)72 298.8 R -.15(ve)-.25 G 2.63(nt).15 G .129 (hough the constant set itself may not uniquely determine this type.)157.79 298.8 R .129(In the cases where)5.129 F .886 (it is not possible to determine the type of the set from local conte)72 310.8 R .886(xt, the e)-.15 F .886(xpression type def)-.15 F .886(aults to a set)-.1 F -.15(ove)72 322.8 S 3.021(rt).15 G .521 (he entire base type unless the base type is inte)95.271 322.8 R 3.021 (ger\207. In)-.15 F .521(the latter case the type def)3.021 F .521 (aults to the current)-.1 F(binding of)72 334.8 Q F3(intset,)2.5 E F0 (which must be `)2.5 E(`type set of \(a subrange of\) inte)-.74 E(ger')-.15 E 2.5('a)-.74 G 2.5(tt)356.98 334.8 S(hat point.)365.04 334.8 Q(Note that if)97 350.4 Q F3(intset)2.5 E F0(is rede\214ned via:)2.5 E F2(type)108 368.4 Q F0 (intset)2.5 E F4(=)2.5 E F2(set of)2.5 E F0(0..58;)2.5 E(then the def)72 386.4 Q(ault inte)-.1 E(ger set is the implicit)-.15 E F3(intset)2.5 E F0(of P)2.5 E (ascal 6000\2553.4)-.15 E F2(Additional pr)72 410.4 Q(ede\214ned operators)-.18 E F0(The relationals `<' and `>' of proper set inclusion are a)97 426 Q -.25 (va)-.2 G 2.5(ilable. W).25 F(ith)-.4 E F3(a)2.5 E F0(and)2.5 E F3(b)2.5 E F0 (sets, note that)2.5 E(\()108 444 Q F2(not)A F0(\()2.5 E F3(a)A F0(<)2.5 E F3 (b)2.5 E F0(\)\) <> \()A F3(a)A F0(>)2.5 E F4(=)A F3(b)2.5 E F0(\))A(As an e)72 462 Q(xample consider the sets)-.15 E F3(a)2.5 E F4(=)2.5 E F0([0,2] and)2.5 E F3(b)2.5 E F4(=)2.5 E F0 2.5([1]. The)2.5 F (only relation true between these sets is `<>'.)2.5 E F2(Non-standard pr)72 486 Q(ocedur)-.18 E(es)-.18 E F0(ar)72 501.6 Q 88.53(gv\(i,a\) where)-.18 F F3(i) 2.556 E F0 .056(is an inte)2.556 F .056(ger and)-.15 F F3(a)2.556 E F0 .056 (is a string v)2.556 F .055(ariable assigns the \(possibly truncated)-.25 F .021(or blank padded\))197 513.6 R F3(i)2.521 E F0 -.18('t)1.666 G 2.521(ha).18 G -.18(rg)289.66 513.6 S .021(ument of the in).18 F -.2(vo)-.4 G .021 (cation of the current).2 F F1(UNIX)2.521 E F0(process)2.521 E(to the v)197 525.6 Q(ariable)-.25 E F3(a)2.5 E F0 5(.T)C(he range of v)275.07 525.6 Q(alid) -.25 E F3(i)2.5 E F0(is)2.5 E F3(0)2.5 E F0(to)2.5 E F3(ar)2.5 E(gc\2551)-.37 E F0(.)A 94.74(date\(a\) assigns)72 541.2 R .827(the current date to the alf) 3.327 F 3.327(av)-.1 G(ariable)346.019 541.2 Q F3(a)3.327 E F0 .826 (in the format `dd mmm yy ',)3.327 F (where `mmm' is the \214rst three characters of the month, i.e. `)197 553.2 Q (Apr'.)-.8 E 93.06(\215ush\(f\) writes)72 568.8 R(the output b)2.5 E(uf)-.2 E (fered for P)-.25 E(ascal \214le)-.15 E F3(f)2.5 E F0(into the associated)2.5 E F1(UNIX)2.5 E F0(\214le.)2.5 E 107.5(halt terminates)72 584.4 R(the e)2.5 E -.15(xe)-.15 G(cution of the program with a control \215o).15 E 2.5(wb)-.25 G (acktrace.)441.97 584.4 Q 66.11(linelimit\(f,x\)\210 with)72 600 R F3(f)2.892 E F0 2.892(at)2.892 G -.15(ex)233.456 600 S .392(t\214le and).15 F F3(x)2.892 E F0 .392(an inte)2.892 F .392(ger e)-.15 F .392 (xpression causes the program to be abnor)-.15 F(-)-.2 E .333 (mally terminated if more than)197 612 R F3(x)2.833 E F0 .332 (lines are written on \214le)2.833 F F3(f)2.832 E F0 5.332(.I)C(f)438.18 612 Q F3(x)2.832 E F0 .332(is less than 0)2.832 F(then no limit is imposed.)197 624 Q 66.96(message\(x,...\) causes)72 639.6 R .395(the parameters, which ha)2.895 F .695 -.15(ve t)-.2 H .395(he format of those to the b).15 F(uilt-in)-.2 E F2 (pr)2.895 E(oce-)-.18 E(dur)197 651.6 Q(e)-.18 E F3(write)2.885 E(,)-.1 E F0 .385(to be written unb)2.885 F(uf)-.2 E .385 (fered on the diagnostic unit 2, almost al)-.25 F -.1(wa)-.1 G(ys).1 E (the user')197 663.6 Q 2.5(st)-.55 G(erminal.)240.33 663.6 Q .32 LW 144 686.4 72 686.4 DL F1 .971(\207The current translator mak)72 698.2 R .971(es a specia\ l case of the construct `if ... in [ ... ]' and enforces only the more lax)-.08 F(restriction on 16 bit arithmetic gi)72 708.2 Q -.12(ve)-.2 G 2(na).12 G(bo) 194.336 708.2 Q .24 -.12(ve i)-.12 H 2(nt).12 G(his case.)222.096 708.2 Q (\210Currently ignored by pdp-11)72 720 Q/F5 8/Times-Italic@0 SF(px)2 E F1(.)A EP %%Page: 39 39 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(Berk)72 48 Q(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)115.76 48 Q(PSD:7-39)464.55 48 Q 106.94(null a)72 84 R .064(procedure of no ar)2.564 F .065(guments which does absolutely nothing.) -.18 F .065(It is useful as a)5.065 F(place holder)197 96 Q 2.5(,a)-.4 G (nd is generated by)255.19 96 Q(in place of the in)72 111.6 Q (visible empty statement.)-.4 E(remo)72 127.2 Q -.15(ve)-.15 G 81.71 (\(a\) where).15 F/F1 10/Times-Italic@0 SF(a)2.562 E F0 .062 (is a string causes the)2.562 F/F2 8/Times-Roman@0 SF(UNIX)2.562 E F0 .062 (\214le whose name is)2.562 F F1(a,)2.562 E F0 .061(with trailing blanks)2.562 F(eliminated, to be remo)197 139.2 Q -.15(ve)-.15 G(d.).15 E 86.69 (reset\(f,a\) where)72 154.8 R F1(a)2.765 E F0 .265 (is a string causes the \214le whose name is)2.765 F F1(a)2.766 E F0 .266 (\(with blanks trimmed\) to)2.766 F(be associated with)197 166.8 Q F1(f)2.5 E F0(in addition to the normal function of)2.5 E F1 -.37(re)2.5 G(set.).37 E F0 (re)72 182.4 Q 77.5(write\(f,a\) is)-.25 F(analogous to `reset' abo)2.5 E -.15 (ve)-.15 G(.).15 E 87.49(stlimit\(i\) where)72 198 R F1(i)3.159 E F0 .659 (is an inte)3.159 F .658(ger sets the statement limit to be)-.15 F F1(i)3.158 E F0 3.158(statements. Specifying)3.158 F(the)197 210 Q/F3 10/Times-Bold@0 SF(p) 2.5 E F0(option to)2.5 E F1(pc)2.5 E F0(disables statement limit counting.)2.5 E 93.62(time\(a\) causes)72 225.6 R 1.041(the current time in the form `)3.54 F (hh:mm:ss ')2.5 E 1.041(to be assigned to the alf)3.541 F(a)-.1 E -.25(va)197 237.6 S(riable).25 E F1(a.)2.5 E F3(Non-standard functions)72 261.6 Q F0(ar)72 277.2 Q 105.47(gc returns)-.18 F .298(the count of ar)2.799 F .298 (guments when the P)-.18 F .298(ascal program w)-.15 F .298(as in)-.1 F -.2(vo) -.4 G -.1(ke).2 G(d.).1 E F1(Ar)5.298 E(gc)-.37 E F0(is al)197 289.2 Q -.1(wa) -.1 G(ys at least 1.).1 E 93.63(card\(x\) returns)72 304.8 R .585 (the cardinality of the set)3.085 F F1(x,)3.085 E F0 .586 (i.e. the number of elements contained in)3.085 F(the set.)197 316.8 Q 100.84 (clock returns)72 332.4 R .731(an inte)3.231 F .731 (ger which is the number of central processor milliseconds of)-.15 F (user time used by this process.)197 344.4 Q -.15(ex)72 360 S 91.55 (po\(x\) yields).15 F .815(the inte)3.315 F .815(ger v)-.15 F .815(alued e)-.25 F .815(xponent of the \215oating-point representation of)-.15 F F1(x)3.315 E F0 (;)A -.15(ex)197 372 S(po\().15 E F1(x)A F0(\))A/F4 10/Symbol SF(=)2.5 E F0 (entier\(log2\(abs\()2.5 E F1(x)A F0(\)\)\).)A 80.29(random\(x\) where)72 387.6 R F1(x)2.5 E F0(is a real parameter)2.5 E 2.5(,e)-.4 G -.25(va)313.24 387.6 S (luated b).25 E(ut otherwise ignored, in)-.2 E -.2(vo)-.4 G -.1(ke).2 G 2.5 (sal).1 G(inear)484.01 387.6 Q 1.143(congruential random number generator)197 399.6 R 6.144(.S)-.55 G(uccessi)370.434 399.6 Q 1.444 -.15(ve s)-.25 H 1.144 (eeds are generated as).15 F(\(seed)197 411.6 Q F4(*)A F0(a)A F4(+)3.305 E F0 .804(c\) mod m and the ne)3.305 F 3.304(wr)-.25 G .804 (andom number is a normalization of the)339.196 411.6 R 3.19 (seed to the range 0.0 to 1.0; a is 62605, c is 113218009, and m is)197 423.6 R 2.5(536870912. The)197 435.6 R(initial seed is 7774755.)2.5 E 95.29 (seed\(i\) where)72 451.2 R F1(i)2.818 E F0 .317(is an inte)2.818 F .317 (ger sets the random number generator seed to)-.15 F F1(i)2.817 E F0 .317 (and returns)2.817 F(the pre)197 463.2 Q(vious seed.)-.25 E (Thus seed\(seed\(i\)\) has no ef)5 E(fect e)-.25 E(xcept to yield v)-.15 E (alue)-.25 E F1(i.)2.5 E F0 88.06(sysclock an)72 478.8 R(inte)2.945 E .445 (ger function of no ar)-.15 F .446 (guments returns the number of central processor)-.18 F (milliseconds of system time used by this process.)197 490.8 Q 71.4 (unde\214ned\(x\) a)72 506.4 R 1.777(Boolean function.)4.277 F 1.777(Its ar) 6.777 F 1.777(gument is a real number and it al)-.18 F -.1(wa)-.1 G 1.776 (ys returns).1 F -.1(fa)197 518.4 S(lse.).1 E -.1(wa)72 534 S 83.72(llclock an) .1 F(inte)5.367 E 2.867(ger function of no ar)-.15 F 2.867 (guments returns the time in seconds since)-.18 F (00:00:00 GMT January 1, 1970.)197 546 Q F3 2.5(A.5. Remarks)72 570 R (on standard and portable P)2.5 E(ascal)-.1 E F0 1.957 (It is occasionally desirable to prepare P)97 585.6 R 1.956 (ascal programs which will be acceptable at other P)-.15 F(ascal)-.15 E 2.829 (installations. While)72 597.6 R .329(certain system dependencies are bound to\ creep in, judicious design and programming)2.829 F 1.225 (practice can usually eliminate most of the non-portable usages.)72 609.6 R -.4 (Wi)6.225 G(rth').4 E(s)-.55 E F1 -.8(Pa)3.725 G 1.225(scal Report).8 F F0 1.225(concludes with a)3.725 F(standard for implementation and program e)72 621.6 Q(xchange.)-.15 E 1.66(In particular)97 637.2 R 4.16(,t)-.4 G 1.66 (he follo)156.85 637.2 R 1.66(wing dif)-.25 F 1.66 (ferences may cause trouble when attempting to transport programs)-.25 F 1.61 (between this implementation and P)72 649.2 R 1.609(ascal 6000\2553.4.)-.15 F 1.609(Using the)6.609 F F3(s)4.109 E F0 1.609(translator option may serv)4.109 F 4.109(et)-.15 G 4.109(oi)463.231 649.2 S(ndicate)475.12 649.2 Q(man)72 661.2 Q 2.5(yp)-.15 G(roblem areas.\207)101.57 661.2 Q .32 LW 144 698.2 72 698.2 DL F2(\207The)72 710 Q/F5 8/Times-Bold@0 SF(s)2.899 E F2 .899(option does not, ho) 2.899 F(we)-.2 E -.12(ve)-.2 G 1.539 -.32(r, c).12 H .899 (heck that identi\214ers dif).32 F .899(fer in the \214rst 8 characters.)-.2 F /F6 8/Times-Italic@0 SF(Pi)4.899 E F2(and)2.899 E F6(pc)2.9 E F2 .9 (also do not)2.9 F(check the semantics of)72 720 Q F5(pack)2 E(ed)-.08 E F2(.)A EP %%Page: 40 40 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 264.65(PSD:7-40 Berk)72 48 R(ele)-.1 E 2.5(yP)-.15 G (ascal User\264s Manual)422.36 48 Q/F1 10/Times-Bold@0 SF -.25(Fe)72 84 S(atur) .25 E(es not a)-.18 E -.1(va)-.25 G(ilable in Berk).1 E(eley P)-.1 E(ascal)-.1 E F0(Se)97 99.6 Q(gmented \214les and associated functions and procedures.)-.15 E(The function)97 115.2 Q/F2 10/Times-Italic@0 SF(trunc)2.5 E F0(with tw)2.5 E 2.5(oa)-.1 G -.18(rg)216.61 115.2 S(uments.).18 E(Arrays whose indices e)97 130.8 Q(xceed the capacity of 16 bit arithmetic.)-.15 E F1 -.25(Fe)72 154.8 S (atur).25 E(es a)-.18 E -.1(va)-.25 G(ilable in Berk).1 E(eley P)-.1 E(ascal b) -.1 E(ut not in P)-.2 E(ascal 6000-3.4)-.1 E F0(The procedures)97 170.4 Q F2 -.37(re)2.5 G(set).37 E F0(and)2.5 E F2 -1.91 -.37(re w)2.5 H(rite).37 E F0 (with \214le names.)2.5 E(The functions)97 186 Q F2(ar)2.5 E(gc, seed, syscloc) -.37 E(k,)-.2 E F0(and)2.5 E F2(wallcloc)2.5 E(k.)-.2 E F0(The procedures)97 201.6 Q F2(ar)2.5 E(gv)-.37 E 2.5<2c8d>-.74 G(ush,)188.64 201.6 Q F0(and)2.5 E F2 -.37(re)2.5 G(mo).37 E(ve)-.1 E(.)-.15 E(Messa)97 217.2 Q -.1(ge)-.1 G F0 (with ar)2.6 E(guments other than character strings.)-.18 E F2(Write)97 232.8 Q F0(with k)2.5 E -.15(ey)-.1 G -.1(wo).15 G(rd).1 E F1(hex)2.5 E F0(.)A(The)97 248.4 Q F1(assert)2.5 E F0(statement.)2.5 E (Reading and writing of enumerated types.)97 264 Q(Allo)97 279.6 Q (wing functions to return structures.)-.25 E(Separate compilation of programs.) 97 295.2 Q(Comparison of records.)97 310.8 Q F1(Other pr)72 334.8 Q(oblem ar) -.18 E(eas)-.18 E F0 .234 (Sets and strings are more general in .UP ; see the restrictions gi)97 350.4 R -.15(ve)-.25 G 2.733(ni).15 G 2.733(nt)372.378 350.4 S .233(he Jensen-W)382.891 350.4 R(irth)-.4 E F2 .233(User Manual)2.733 F F0 (for details on the 6000\2553.4 restrictions.)72 362.4 Q .002 (The character set dif)97 378 R .002 (ferences may cause problems, especially the use of the function)-.25 F F2 -.15 (ch)2.502 G -1.11(r,).15 G F0 .002(characters as)3.612 F(ar)72 390 Q .812 (guments to)-.18 F F2(or)3.312 E(d,)-.37 E F0 .812 (and comparisons of characters, since the character set ordering dif)3.312 F .812(fers between the tw)-.25 F(o)-.1 E(machines.)72 402 Q .109(The P)97 417.6 R .109(ascal 6000\2553.4 compiler uses a less strict notion of type equi)-.15 F -.25(va)-.25 G 2.61(lence. In).25 F(Berk)2.61 E(ele)-.1 E 2.61(yP)-.15 G .11 (ascal, types)457.79 417.6 R 2.268(are considered identical only if the)72 429.6 R 4.768(ya)-.15 G 2.268(re represented by the same type identi\214er) 235.978 429.6 R 7.268(.T)-.55 G 2.268(hus, in particular)429.874 429.6 R(,)-.4 E(unnamed types are unique to the v)72 441.6 Q (ariables/\214elds declared with them.)-.25 E -.15(Pa)97 457.2 S .141 (scal 6000\2553.4 doesn').15 F 2.641(tr)-.18 G .142 (ecognize our option \215ags, so it is wise to put the control of Berk)201.053 457.2 R(ele)-.1 E 2.642(yP)-.15 G(ascal)484.01 457.2 Q (options to the end of option lists or)72 469.2 Q 2.5(,b)-.4 G (etter yet, restrict the option list length to one.)221.33 469.2 Q -.15(Fo)97 484.8 S 2.729(rP).15 G .228(ascal 6000\2553.4 the ordering of \214les in the p\ rogram statement has signi\214cance.)118.879 484.8 R .228(It is desirable to) 5.228 F(place)72 496.8 Q F2(input)2.5 E F0(and)2.5 E F2(output)2.5 E F0 (as the \214rst tw)2.5 E 2.5<6f8c>-.1 G(les in the)230.23 496.8 Q F1(pr)2.5 E (ogram)-.18 E F0(statement.)2.5 E F1(Ackno)72 544.8 Q(wledgments)-.1 E F0 .787 (The \214nancial support of W)97 560.4 R .788(illiam Jo)-.4 F 3.288(ya)-.1 G .788(nd Susan Graham by the National Science F)255.656 560.4 R .788 (oundation under)-.15 F 1.058 (grants MCS74-07644-A04, MCS78-07291, and MCS80-05144, and the W)72 572.4 R 1.057(illiam Jo)-.4 F 3.557(yb)-.1 G 3.557(ya)427.127 572.4 S(n)440.124 572.4 Q /F3 8/Times-Roman@0 SF(IBM)3.557 E F0(Graduate)3.557 E(Fello)72 584.4 Q (wship are gratefully ackno)-.25 E(wledged.)-.25 E EP %%Trailer end %%EOF