PASCAL USERS GROUP Pascal ews NUMBER 17

COMMUNICATIONS ABOUT THE PASCAL BY PASCA~ERS

MARCHI 1980

j t PASCAL NEWS #17 MARCH, 1980 INDEX

POLICY, COUPONS, INDEX, ETC.

1 EDITOR'S CONTRIBUTION 2 HERE AND THERE WITH Pascal 2 Tidbits 5 Pascal in the news 6 Books 7 Book Review: Alagic & Arbib 8 Articles 9 Conferences and Seminars 12 ADA: an ISO report 13 Pascal in teaching

17 APPLICATIONS 17 Introduction 18 REFERENCER -- a cross referencer for procedures 29 MAP -- a macro processor for Pascal 41 XREF -- a cross reference program 46 A string package - OMSI 47 A complex arithemetic package 52 A string package - U. of Witwaterst~and 53 ARTICLES 54 Conformant Arrays in Pascal" -- A.H.J. Sale ttnotett 57 Pascal Survey" -- Robert R. Ransom 59 Converting an Application Program from OMSI to AAEC" 60 Does Scope = Block in Pascal?" -- T.P. Baker 62 A Note on Pascal Scopes" -- T.P. Baker 63 Alternate Approach to Type Equivalence" - W.MacGregor 65 Fixing Pascals I/O" -- R. Cichelli 66 SIMPASCAL" -- J. Deminet 68 Some Observations on Pascal and Personal Style"- Sale 71 OPEN FORUM FOR MEMBERS 83 Pascal Standards Progress Report 85 IMPLEMENTATION NOTES 85 Editorial 86 Implementation Critiques 89 Validation Suite Reports 101 Checklists

------

Contributors to this issue (#17) were:

EDITOR Rick Shaw Here & There John Eisenberg Books & Articles Rich Stevens Applications Rich Cichelli, Andy Mickel Standards Jim Miner, Tony Addyman Implementation Notes Bob Dietrich Administration Moe Ford, Kathy Ford, Jennie Sinclair JOINING PASCAL USER'S GROUP? p

Membership is open to anyone: Particularly the Pascal user, teacher, maintainer, implementor, distributor, or just plain fan. Please enclose the proper prepayment (check payable to "Pascal User's Group"); we will not bill you. - Please do not send us purchase orders; we cannot endure the paper work! - When you join PUG any time within an academic year: July 1 to June 30, you will receive all issues of Pascal News for that year. - We produce Pascal News as a means-toward the end of promoting Pascal and communicating news ---or- events surrounding Pascal to persons interested in .Pascal. We are simply interested in the news ourselves and prefer to share it through Pascal ~. We desire to minimize paperwork, because we have other work to do. ------American Region (North and South America): Send $6.00 per year to the address on the reverse side. International telephone: 1-404-252-2600. European (Europe, North Africa, Western and Central Asia): Join RGeg(t~n) through PU . Send £4.00 per year to: Pascal Users Group, c/o Computer Studies Group, Mathematics Department, The University, Southampton 509 5NH, United Kingdom; or pay by direct transfer into our Post Giro account (28 513 4000); International telephone: 44-703-559122 x700. - Australasian Region (Austral ia, East Asia - incl. Japan): PUG (AUS ) . Send $A8.00 per year to: Pascal Users Group, c/o Arthur Sale, Department of Information Science, University of Tasmania, Box 252C GPO, Hobart, Tasmania 7001, Australia. International telephone: 61-02-23 0561 x435

PUG (USf) produces Pascal News and keeps all mailing addresses on a common list. Regional representarr.ves collect memberships from their regions as a serv ice, and they repr int and distribute Pascal News using a proof copy and mailing labels sent from PUG(USA). Persons in the Australasian and European Regions must join through their regional representatives. People in other places can join through PUG(USA).

RENEWING?

Please renew early (before August) and please write us a line or two to tell us what you are doing with Pascal, and tell us what you think of PUG and Pascal News. Renewing for more than one year saves us time.

ORDERING BACK ISSUES OR EXTRA ISSUES?

Our unusual policy of automatically sending all issues of Pascal News to " anyone who joins within a academic year (July 1 to June 30) means TIi'8t we eliminate many requests for backissues ahead of time, and we don't have to reprint important information in every issue--especially about Pascal implementations! Issues 1 .. 8 (January, 1974 - May 1977) are ~ of print. (A few copies of issue 8 remain at PUG (UK) available for £2 each.) Issues 9 .. 12 (September, 1977 - June, 1978) are available from PUG (USA) c all for $10.00 arid from PUG(AUS) all for $AID. Issues 13 .. 16 are available from PUG (UK) all for £6; from PUG(AUS) all for $AIO; and from PUG (USA) all for $10.00. Extra single copies of new issues (current academic year) are: $3.00 each - PUG(USA); £2 each - PUG (UK); and $A3 each - PUG(AUS).

SENDING MATERIAL fOR PUBLICATION?

Your experiences with Pascal (teaching and otherwise), ideas, letters, opinions, notices, news, articles, conference announcements, reports, implementation information, applications, etc. are welcome. Please send material single-spaced and in camera-ready (use a dark ribbon and lines 18.5 em wide) form. - All letters will be printed unless they contain a request to the contrary. - - - - ALL-PURRJSECOUPON- - - - - (17-Mar-80)

Pascal User's Group, c/o Rick Shaw Digital Equipment Corporation 5775 Peachtree Dunwoody Road Atlanta, Georgia 30342 USA

Membership is for an academic year (ending June 30th). Membership fee and All Purpose Coupon is sent to your Regional Representative. SEE THE POLICY SECTION ON THE REVERS~ SIDE FOR PRICES AND ALTERNATE ADDRESS if you are located in the European or Australasian Regions. Membership and Renewal are the same price. The U. S. Postal Service does not forward Pascal News. ------[ ] 1 year ending June 30, 1980 [ ] Enter me as a new member for: [ ] . , 2 years ending June 30, 1981 [ ] Renew my subscription for: [ ] 3 years ending June 30, 1982

[ ] Send Back Issue(s)

My new/correct address/phone is listed below

Enclosed please find a contribution, idea, article or opinion which is submitted for publication in the Pascal News.

[ ] COlll11ents:

$ ENCLOSED PLEASE FIND: A$ £ -- .

NAME

ADDRESS

PHONE

COMPUTER

DATE f(l.ICY: PASCAL USERS GRaJP (17-Mar-80)

Purpose : The Pascal User's Group (POCi) pranotes the use of the progrcmning language Pascal as well as the ideas behind Pascal through the vehicle of Pascal News. PUG is intentionally designed to be non political, and as such, it is not an "entity" ~ich takes stands on issues or support causes or other efforts however well-intentioned. Informality is our guiding principle; there are no officers or meeti~s of PUG. The increasing availability of Pascal makes it a viable alternative for software production and justifies its further use. We all strive to make using Pascal a respectable activity. Membership: Anyone can join PUG, particularly the Pascal user, teacher, maintainer, implementor, distributor, or just plain fan. Memberships from libraries are also encouraged. See the ALL-PURPOSECOOPONfor details.

Facts about Pascal, mE PRffiIWfo1INGLAt«;UAGE:

Pascal is a small, practical, and general-IXJrpose (but -not all-purpose) programming language possessing algorithmic and data structures to aid systematic progrcmning. Pascal was intended to be easy to learn and read by hlUlans, and efficient to translate by canputers. 1J Pascal has met these goals and is being used successfully for: o * teaching programming concepts - * developing reliable "production" software -. * implementing software efficiently on today's machines () writing portable software * '< Pascal implementations exist for more than 105 dif :erent canputer systems, and this nunber increases every month. The "Implementation Notes" section of Pascal News describes how to obtain them. The standard reference and tutorial manual for Pascal is: Pascal - User Manual and Report (Second, study edition) by Kathleen Jensen and . Springer-Verlag Publishers: New York, Heidelberg, Berlin 1978 (corrected printing), 167 pages, paperback, $7.90. Introductory textbooks about Pascal are described in the "Here and There" section of Pascal News.

The programming language, Pascal, was naned after the mathematician and religious fanatic Blaise Pascal (1623-1662). Pascal is not an acronym. Remember, Pascal User's Group is each ind i vid ual member's group. We currentl y have more than 3351 active members in more than 41 countries. this year Pascal News is averaging more than 120 pages per issue. RLICY: PASCAL NEWS ( 17-Mar-80) . Pascal News is the official but informal publication of the User's Group. . Pascal News contains all we (the editors) lmow about Pascal; we use it as the vehicle to answer all inquiries because our physical energy and resources for answering individual requests are finite. As PUG grows, we unfortunately succl.lllb to the reality of: 1. Having to insist that people ~o need to know "about Pascal" join PUG and read Pascal News - that is why we spend time to produce it! 2. Refusing to return phone calls or answer letters full of questions - we will pass the questions on to the readership of Pascal News. Please understand what the collective effect of individual inquiries has at the "concentrators" (our phones and mailboxes). We are trying honestly to say: "We cannot promise more that we can do."

· Pascal News is produced 3 or 4 times during an acadenic year; usually in Septenbe-r;-Novanber, February, and May.

· AU. THE NEWS THAT'S FIT, WE PRINT. Please send material (brevity is a virtue) for Pascal News single-spaced and canera-ready (use dark ribbon and 18.5 em lines!) ----

~ · Remember: AU. LETTERS TO US WTI.L BE PRINTED UNLESS THEY CONTAIN A REQUEST .-u TO THE CONTRARY. · Pascal News is divided into flexible sections: -) POLICY - explains the way we do things (AU.-PURPOSE COUPON, etc.) D. EDITOR'S CONTRIBUTION- passes along the opinion and point of view of the editor together with changes in the mechanics of PUGoperation, etc.

HERE AND THERE WITH PASCAL - presents news from people, conference anoouncements and reports, new books and articles (inclooing reviews), notices of Pascal in the news, history, menbership rosters, etc.

APPLICATIONS - presents and docunents source prograns written in Pascal for various algorithms, and software tools for a Pascal environment; news of significant applications programs. Also critiques regarding progran/ algorithm certification, performance, standards conformance, style, output convenience, and general design. ARTICLES- contains formal, subnitted contributions (such as Pascal philosophy, use of Pascal as a teaching tool, use of Pascal at different computer installations, how to promote Pascal, etc.). OPEN FORUM FOR MEMBERS - contains short, infonnal correspondence anong members which is of interest to the readership of Pascal News. IMPLEMENTATI~ NOTES - reports news of Pascal implenentations: contacts for maintainers, implenentors, distributors, and docunentors of various implementations as well as where to send bug reports. Qualitative and quantitative descriptions and comparisons of various implementations are publicized. Sections contain infonnation about Portable Pascals, Pascal Variants, Feature-Implementation Notes, and Machine-Dependent Implementations. APPLICATION FOR LICENSE TO USE VALIDATION SUITE FOR PASCAL

Name and address of requestor: (Company name if requestor is a company)

Phone Number:

Name and address to which information should be addressed (Write lias above" if the same)

Signature of requestor:

Date:

In making this application, which should be signed by a responsible person in the case of a company, the requestor agrees that:

a) The Validation Suite is recognized as being the copyrighted, proprietary prop- erty of R. A. Freak and A.H.J. Sale, and

b) The requestor will not distribute or otherwise make available machine-readable copies of the Validation Suite, modified or unmodified, to any third party without written permission of the copyright holders.

In return, the copyright holders grant full permission to use the programs and doc- umentation contained in the Validation Suite for the purpose of validation, acceptance tests, benchmarking, preparation of comparative reports, and similar pur- poses, and to make available the listings of the results of compilation and execution of the programs to third parties in the course of the above activities. In such doc- uments, reference shall be made to. the original copyright notice and its source.

~ Distribution charge: $50.00

~ Make checks payable to ANPA/RI in US dollars drawn on a US bank. Remittance must accompany application. Mail request to:

Source Code Delivery Medium Specification: ANPA/RI 9-track, 800 bpi, NRZI, Odd Parity, 600' Magnetic Tape P.O. Box 598 Easton, Pa. 18042 ( ) ANSI-Standard USA Attn: R.J. Cichelli a) Select character code set: ( ) ASCII ( ) EBCDIC

b) Each logical record is an 80 character card image. Select block size in logical records per block. ( ) 40 ( ) 20 ( ) 10

( ) Special DEC System Alternates: ( ) RSX-IAS PIP Format ( ) DOS-RSTS FLX Format

lce use on y Signed Date Richard J. Cichelli On behalf of A.H.J. Sale & R.A. Freak MARCH, 1980 PAGE 1 PASCAL NEWS #17 Editor's Contribution

GETIING STARTED Let me start my first editorial by saying, "I can't believe how hard this job is!!" My esteem for Andy Mickel has always been high, but after the last few months, it has gone up astronomically! I don't know how one person had all the time-there are so manv things to do, and I have been lucky enough to have alot of help. My section editors have been very prompt (for the most part!) and have made the job "do-able". And, I might add, PUG has hired some part-time clerical help that is out of this world! To round it off, the switch to a coomercial printer (ch, the luxury of a university print shop) has been quite successful. I could not ask for better service. Their prices are close to those we paid in the past. My thanks must go to the membership, who have been so patient with me. This issue represents a tremendous learning curve for me (and culture shock!). Things will go smoother starting next issue. NEXT ISSUE (118) - SPECIAL!! Speaking of next issue, we at PUG are pleased to announce that the next one will be completely devoted to the ISO Draft Standard for Pascal. (See Jim Miner's article this issue for a discussion of this and other items concerning standards. )

We are currently preparing this docllJlent for reproduction; it will be out no later than one month after this issu~ (#17).

AOOUT TIiIS ISSUE WOtl!! Is there alot of good stuff in this issue! Pascal has been on everyone's tongue lately,--SO "Here and There" is chock full of "newsy" information. We also have a large m.mber of books and articles that have been reviewed this quarter, as well. as an excellent in-depth review of the text Alagic and Arbib by one of our readers. (We could use more contributions such as this.)

The "Articles" section is kicked off by lucid discussion of "Conformant Array Paraneters" authored by Arthur Sale (who else!). This article is highly recamnended for review by all readers because of its controversial, proposed inclusion into the ISO standard. There is no lack of contributions to the "Software Tools" section either. Nearly one-quarter of the issue is devoted to publishing programs and algorithms. This quarter many checklists are included in the "Implementation Notes" section, as well as some contributions to ur new section, "Validation Sui te Reports".

A great deal of fine work went into this issue. We hope you like it. /

John Corli.., Loyola Univer.ity of ChicaRo, 6525 N. Sheridan Road, Chicago Here and There With Pascal IL 60026: "Loyola Unfvera1ty...haa acquired th.. Pascal compH"r from the ' University of Manitobs for academic fnstructiona] lIRe...we are (*Interested*) fn acquiring PASCAL l1br.rle. that we could u.e In our computer sel..nc.. cla.s (*79/05/14*) T TTTTTT " Oon R. Couch, 5100 Montr..al Or., ~.n .Io.~, CA 95130: T am a .tlldent In. r.o~8w~11 CnlJ"R~ PilAr,.) "T T cnllrl'lP. ...nd tllIl!! P.'H~...1 on II rnp-II/IO ('ompllt~r...t Afn@rtrlt" MfcrolYlltflmll. Tnc." T C*nC' c11'1tft*) T R. II. ~, Digl t.1 Cnn."1 t Ing Cnrporat fon, P.O. Anx 12~0~, ~an .Ioae, CA T 95152. 'Our company haa .Iuat rel..aaed 8 P88cal Complier (1'2derlvatlv~) for T IOA[T~ the popular CP/M mlcrncomplltel system." (*79/09/26*)

J. Mack~, Compo Scl Oept., Box 3CU, New Mexico State University, Las Jim GaRne, M.O., Datamed Res..arch,1433 RoscomareRd., to. Angele., CA 90024: '~o". your medical application. editor (if any)? Cruces, NH 88001: "We have added an usertlonal checking capabllfty tp UCSIJ 1"11 do It If you Pasc8l and have developed a debugging system based on assertlonal che~klng need." (*79/05/30*) and symbolic execution. A paper on the system will be presented at ACM Anton L. Gilbert, Information Science., U.S. Army White Sanda Miaalle Range, 79..." (*79/05/14*) NM 88002: "r am a new Pascal users. It wi 11 be used 1n my reaearch group.. .on 8 POP-I 1/70, 1'01'-11/35, a 1'01'-11/34 (* al I und..r RSX-IIM) and a Ron Barstad, P.O. Box 6000, B-118, Phoenix, AZ 85005: "The Psscal on the I). One of my employ..ea... I. eapecl811y fntereat..d In Pa.cal (*US~iana*) L68 (Multics) is only a subset. The L66 version from POP-II/IS (RT-I in Image'Proce.alnRReaearch." Waterloo 10 s full blown batch and/or T~S version. (*79/09/14*) (*79/06/12*)

Dr.Oddur ~enedikt8son. Science Institute,University of Ycp-land,DunhsR8 1, Ricardo O. Giovannone, Rox 3606, University Park Rranch, taR Cruces, NM' Reykjavik: "We...are looking for a PASCAL compHer for...our POP-II RSX-IIM 88003: "! am a graduate student Rt New Mexico State Unfversity.. .ueing this system and so for have found only the OMSI product which we find a bit on language .fnc.. fall "78 and I really like It At the moment, I am working 1n a project dealing with fmplementation of Rn F.ducAttona] DAta Rase System the expensive aide at $1500. We wOllld aloo rather have the I'-code type using compiler If available. Can YOIlmake any auggestlons? (*78/11/23*) Paecal as a hORt ]RngIJR~p. .. .\o,'E'hope to finish fn thfs fAll. We arE' IIslng UC~D Paacal Verslnn 1.4." (*79/08/20*) Rick ~, Nationwide Insurance,One Nationwide Plaza, Columbus, OR 43211;: "Our prob lem Is one of finding a I'aacal implementation which matches ollr Mark ~, Computer BusinE'~8 Syst@fnS, Rox 421 Truro , Nova Scotia B2N 5C5: operating environment: a 18rg,,-.cale IBM/AMDAHL c"nter running MVS 3.7 "I am ualng a OEC POP-II IInder R~TS/E". (*79/05i23*) and...both the TSO and VSI'C in ter8ctive sy.tem.." (*79/10/10*) Roedy~, 147A F:sst 27th Avenue, Vancouver, British (;olumbfa V5N 2W5: ...... ppG loking after 8 computer acqutsitf.on for the provincial F.lectric and (:8S lD Palll C. ~, Industrle., Box R, Elwin-Mt. 7.ion Rd., Mt. 7.lon, IL 62549: "r"m 00 "We are hoping to implement the OMSI pASCAt.-1 package on a OEC utility. !"m looking forward to using PaRcsl to implement our records & man o pOP-II/34...under RSX-II/M...to develop proce.s control programa to run on a acheduling .ystem. At preaent Aurrollgha 1800, DEC plJp-II/70, Tandem, IJnivac network of OEC LST-II/23 microa I would appreciate hearing from any OMSI 1100, Cyber 170 are all potential winnera. I am partlclliarly inter..atedIn PASCAL-I users wi th expe rf ence in dig! tal cont rol appl i catt on8." Paacal on the.e machln"a." (*79/09/04*) (* 79/09/2 7*) Davfd L. Hamby, CombllatlonEngineering,TNc., 1000 Prosp..rt HilI Rd., Glenn A. Burklund, 3903 Carolyn Ave., Fairfax, VA 22031: "Have North Star Windsor, CT 06095: "Tntprpst", aTe Tesl time proceFJFJ monitoring. Looking for (UCSIJ) pa.cal It Is mI8..uble. Going p..c8l/7 for sdentlfc and process support software in a machine fndE'penoent high 1evel 1AnRtlRp,e." ) engtnepr1nR appJirAttnns. Thfl fllnct. & proc. are th matn features of (*79/06/18* Intere.t. It 19 vlrtuallv almpo.slhl" to Implem..nt IInder North ~tar M. to H:>;rper, Oak Ridge Natlnnal Lahs, Aida. 1505, Rm. III', Oak Rld"e, TN PaBcRl. Unless it is practical to implement th~s~ calls easily, Pascal will 37830: T have pursued your reff'renCeA at JPL re~ardi ng II Pascal for ModComp wither on th" vln (*79/10/09*) minicomputers and the pro.p<'Cta look promising." (*79/06/26*)

John D. ]!ush, Minnesota Power 6, Light Co., 30 West Superior ~t., Duluth, MN David VA 23692: fir C. E. Holme., P.O. BOK 1708, Grafton, Teach..r of 55802: have been trying to get programmers and DP M'ana~ers at M'P&L micro-computer desiRn, system design, ~nrl pro~rammin~. owns 48K Z80 Altair interested in Pascal. Ry finding for our Prime and IBM' machines, I 8800, CP/M, UCSO Pascal, and Ithlca Inter.y"tem Pa.cal/7. compll..r. hope to gf_ve some of these peopJe a chance to experiment with the lan~ua~e." (*79/10/29*) (*79/10/03*)

Mike lIuRhe., P.O. Box .'93, Rapid City, SO 57709: "r am currently about three Jim~, School of Dentistry, University of th.. Pacific, 2155 Wehst"r fourths of the way there on a busin~ss-ortented Pascal compiler for St., San Francisco CA 94115: '~he ~chool of Denti.try ha. rec"ntly acquired second-generation BCD machines. Implem..ntation Is for the RCA 301, but an Om.i Pascal Compiler...conflgllred to op..rate under R~X-IIM and will be Th" the problems are .Imilar to th.. lAM 1401 and 1620, lIurroOJghs B600, <'tc. T installed on a 1'01'-11/34. W.. plan to use I'a.cal primarily for would be interested in getting in touch with Anyone else having such administrative purposes, but it will also be available for uses In other Quixotic interests." C*no date*) area.." (*79/05/22*) r' [ G. P. Janaa, 4447 Burhanan, Warren, MI 48092: "I own an Apple I with two M. II. ClauafnR, 5603 Fi.her Dr., Dayton, OH 45424: "If the !MttH"' still at disk drives. I have on order, since SeptPmber, the Applf'Lan~uage Card and i9911e, I vote not to affiliate with ACM. T see no particular advantaRe." am awaiting same." (*79/10/18*) (*79/lJ7/06*)

------Gregory A. Marks. ~nstitute for Sociai Research. University of Michigan, Peter T. Jawbsen Ceremain Microsystems, 759 Glen Canyon Rd.. Santa Cruz. CA SQR(A), MI 48106: All I ever hear about UCSD Pascal Is the good comments. 95060: "I use bo~h UCSD snd OMSI Pascal." (*79/09/09*) Where can I get the opposite viewpoints; the problem in their extensions and Implementation." (*79/06/29*) John W. Jensen, Jensen Farms, RR#l Box 142, Everly, IA 51338: "I have been working on computer programs for a complete feedlot mana~ement system for Richard R. Martin, 634 Dallas Ave. H21, Grand Prairie, TX 75050: am about 4 years. The programs are written In RPG and run on an IBM System 34 running the UCSD Pascal on my Z80 system and am interested in keeping"I up which...I am losing access to l...am wiling to look at something tn the with other implementations. My use for Pascal is in writing a CAT system $10-15000 range not counting software...(* here follows a description of with color graphics (RAMI'EK). For a living , I manage a computer store" -) . hardware being considered Basic is the mo~t popular language...but I'm (*79/08/27*) not convinced that Basic is the best language to program in. ~ascal has been called the software superstar. Yet it appears to me to be rather slow H. E. M~rkovitz. Culp & Tanner. Inc., 585 Manzanita Suite 6. Chico. CA in being accepted. I have seen very little commerical software available 95926: I am trying to build up a Pascal scientific library and would like (such as accounting packages, etc.)." (*79/10/01 *) to see if anyone else could lend me a hand. P.-S. Does the user's group have such a scientific library?" (*79/07/23*) Donald R. Kelley, 2451 Hinghsm Court, Woodbridge, VA 22192: "Just getting started using Pascal - have been working with assembly and BASIC." Sakari M. Mattila, Lokkalantie 18 B 43, SF-00330 Helsinki 33, Finland: (*79/10/01*) a computer scientist at Technical Research Centre of Finland. EDP research"I am division. We have University of Minnesota Pascal 6000 release 3 on COC and Wallace~, 9002 Dunloggin Rd., Ellicott City, HIJ 21043: "I have an OSI some other on minis." (*79/07/07*) Challenger III and have been trying for some time to get Pascal for it. Althought It has a Z80 chip (as well as a 6502 and a 6800) OSI apparently Frank Monaco. 679 Lowell Drive. Marietta. GA 30060: "Keep up the good work.1I used a slightly different implementation,and the version used by most Z8D (*79/03/09*) computers (I'm told) doesn't run on 05T. HOwever. I'm told that it will soon Jerry Moore, Dunn, Moore & Associates, 2935 E. Broadway Suite 201 Tuscon be ready either fDr the 6502 or the Z80 In 051." (*79/05/07*) . AZ 85716: "We are a systems house in Tucson working pri~ari1y With. Jack~, 320 19th Ave. S., Minneapol1s, MN 55454: "Re: ~ dependent Perkin-Elmer (Interdata) and Alpha Microsystems minicomputers. We have a Implementations:remove NCR 200 implementationthat is listed In News #9/10 project slightly outside our normal sphere of influencet and.. .for wh:f.ch p. 105. This has been replaced by an NCR 8400 implementationand will be Pascal is most desirable. (*The project is*) 8 hydrologic model of complex must available February 1980. I will make more Information avallable at that irrigation systems for Saudi Arabian Naval base (* which -) run on an time." (*79/08/07*) IBM 3032in SaudiArabia. Developmentwillhaveto be done on DEC system.. .unless I can find some IBM 370 time nearby. I would be very appreciative if you would consider my plight briefly forward any w. A. Lane, Canadian Tire Corporation, Limited. Box 770. Station K, Toronto. and ONtario M4P 2V8: "We are a large retailing company in Canada with suggestions." (*79/09/04*) approxima tely 315 stores country wide. We are presently implementing "point of Sale" systems in these stores and are utilizing Datapoint. NCR and Amdahl Hal Morris, Prindle and Patrick Architects:planners, 199 S. Fifth St., computers. We alRo have several other machines including IBM system 34's. Columbus, OH 43215: "The company...is an architecture firm which has a PDP- IV Phase and Basic minl's." (*79/08/22*) 11/34 running RT-il and TSX. Our applicationsare Accounting, Word ...... Processing. and and some statistics simulation My own impression is MpeclaI1y PSBcal. Our quandary, at preaent. revolves Gregory L. Nelson. Apt. 31. 2280 California St.. Mountain View, CA Qit040: arund the.. .relative merits of UCSO Pascal. the Per 8rinch Hansen sequential "Hsve ImplementedSwedIsh Pascal V5 and NBS Pascal Vl.4d (a prelfminary version, the Intersystems Pascal/Z. the Alpha Micro version. the new 6A09 version) under RSX-IIM V3.1 on a PDP-ll/70 system. Rotb Pascals lack Motorola version, the soon to be released Data General Micro NCNa version, linkages sufficient to consider them for systems etc. etc. etc. Can you kindly bring some !lluminst1on to us?" (* no date *) implementation." (*79/03/12*)

Neil~. Computer Systems and Services. Tnc.. Rox 31407 Dallas TX C. E. Leonard, 14008 S.E. Harrison, Portland, OR 97233: "I presently own an Exidy sorcerer (Z80) with 32K and want to Implement Pascal to go with my one 7S231: "I wanted an accounting package 1n Pascal or BASIC to. be conv~rted to year of Pascal studies at Portland Community College." (*79/08/31*) run on a TI 990/2 for a large non-chain restaurant." (*79/09/05*)

Craig ~, Enertec, 19 Jenkins Ave., Lansdale, PA 19446: "We sre actively Jerry ~, Eastern Kentucky University, Richmond, KY 40475: "I have extended Pascal-S with strings. scalars. graphics. execution proftIer and using Concurrent Pascsl to write real time programs for the Z80. The many features useful 'In 8 teaching environment - runs under RSTS on a language has been extended to allow the writing of device drivers directly PDP-ll/70." (*79/06/11*) in C.P.; the /kernel knows nothing about I/O." (*79/06/05*)

Robert C. Luckey, M.D., P.S., 1110 Gillmore Ave., Richland, WA99352: "It is Raymond E. Penley, 3578F Kelly Circle, Bolling AFB, DC 20336: "Just with distress that I read In the truly excellent issue 13 of your (*Andy's*) purchased Pascal/Z from Ithaca Intersystems. This is a Z80 compiler that withdrawal from active lead position. You obviously have that combination makes assembly code directly from the Pascal source. Will let you know more of talent to co-ordinate a complex development such as that of a new high when I get it running. I don't have enough memory right now." (*79/09/24*) level computer language. None of the alternativea offered to the present II arrangement at all compares with what we have now. (*79/03/26*) Martin ~. Perltsky. Bendix Corporation, P.O. Drawer 831. Lewisburg. WV 24901: 1 am available for membership on standardizationcommittees. etc. Phong Thanh~, 6415 Prospect Terrace, Alexandria, VA 22310: "I am currently am a member of IEEE and ISA. One of my specialties is compiler design." usins Pascal on a PDP-Il and am going to have a Pascal compiler for the (*79/10/30*) Honeywell Level-6 very, 800n." (*no date*) f /

Robert H. Scheer, CDP, SheridAn OakA Cyhernetics, 1915 LarkdAle Dr., Stephen A. PitU, 305 Jannan Dr., Midweat City, OK 73110: have ordered "I Glenview. It 60025: "T have had some limited experience with Pascal on an Apple Computer's Paacd system for my Apple] [." (*79/08/24*) Alpha Micro system and expect to start a project on 8 North StarHorizon microcomputer system before the yeAr is over. I am also an instructor in Stephen M. Platt, 4060 Irving St., Philadelphia, PA 19104: "In my work (CS computer science at Northwestern University's Division of Continuin~ gr8d .tuden~of P.) people are .tartlng to prefer Palcal to PORTRAN for EducAtion in Chic8~O. T Am Invest1~Rttn~the p0881blity of uSlnR PS8c81 8S reasono of portablllty(l) and eaae of ule. Prom my own view, it 'I a choice a meAns, of te8('hln~ Rtrllrtllred prORrammtnR techniqups." (*07/07/09"') of hours dehu!!glng 100 l1nea nf fORTRAN or not h!IVlng to dehug 700-1000 lines of Pascd.. .you pet the idea. Keep up the good work." (*79/09/13*) R. C. Shaw, The CrAnlle. ~prtng RrAnk New MlllA, Nr ~tockport, CheAhire, ~K12 48H: "I wou]d b@ intereBtEl'd in information on PAscal ImplpmentationR on Michael S. Plelher. RDI aox 258, Hoewell. NJ 08525: "I am currently ualng either Argus 700 or Modu]Ar One machlneA." (*07/09/13*) the AAEC compiler on an IBM 370/168 (RCA, Cherry Hill NJ). They 8lso hsve a l'aacal P4 compUer." (*79/08/05*) Thomas W. Sidle, TecholcA] Staff, Scleotlflc CAlculations, Inc., 4245-B Capitola, CA 95010: "We Are interested In bringing up PAscal on VAXII/780, Hardy .T. Pottinger, EE Dept., Univ. of Missouri Rolla, Rolla, MO 65401: '''We Prime 400 (and larger), and IBM 370/148 (and larger) computers." are using Unlv@rsity of Lancaster's implementationfor Nova from Gamma Tech (*07/07/24*) under RDOS and DOS. Like it a lot. We will be experimenting with microcomputer versions Rnd concurrent Pascal during coming year." Connie .10 Sil1in, KsnsAs City Southern InduAtrles, Inc. 114 W. 11th ~t., (*79(08/01 *) Kansss City, MO 64105: "We at KCSI Are interested in thf"Pascal programming language And thp compl1f"r for Pascal. We now hAve the TRM 370/158 and 3032 Pred W. Powell, P.O. Box 2543, Staunton, VA 22401: "I have heen working (OS-V~2) ooon to be 3033 (MV~). primarily on a TI 990/10 computer which haA a TI supported P8sca] compiler. I expect to soon be using A TI 990/5 system which does not currently support T. R. Simonson, G.M. StmonRon & T.R. SiR'onson Consulting Fn~tnep.r8, 612 the P88cal compO.p.r. if T1 does not change tnat problem 800n, I intend to Howard Street, San Francisco, CA 96105: "I real1r.e that pue may have simply put the Psscal l' compiler on that system. Thanks for your help and for the collapsed. I rertainly hope not, for I have thoroughly enjoyed the good job you are doing with PUG." (*79/10/011*) .Tohn Purvia, Sperry Univac contact. I bplieve you stAted that some cross compilerR exist for creat1n~ Computer Systems, 55 City Centre Dr., Mis81s8ugu8, Ontario L5B IM4: "I am 8 8080 or ZROmachine code. If you know of one for CDC mAchines T would software lnRtructorwith Sperry Univac 1n Toronto. Our Mini Computer appreciate your jnttlng down tbe source." (*79/10/12*) Operation 18 becoming involved with Pascal, 80 J 8m very interested 1n out what is happening with a PAscal uaer group." (*79/08/24*) finding Lee L. C. Sorensol1, 10226 VictoriA Ave, Whittier, CA 90604: "I do not yet have 8 lArgp pno11gh Aystem for Pascal, but I hope to l~nrn from YOllr group Frederick A. Putnam, Joseph R. Mares Asst. Prof.. Dept. of Chemical and to Implement it In my system some day." (*79/06/07*) Engineering. MaasAchusetts Institute of Technology. Cambrdige, MA 02139: "Here 1n the Chemical EnRtneering Department, we have a Data General Eclipse T. J. Sullivan, 712 Rand Ave., Oakland, CA 94610: "I work with BART (*Bay running (among other things) Gamma Technology's Pascal." (*79/10/17*) AreA Rapid Translt*) And am a neophyte to Pascal but Am highly interested in all aspects of the language; particularly interested in programming for rea] Holly Robinson, Winthrop Publishers. Inc.. 17 Dunster St.. Cambridge, MA time procesa control." (*79/06/07*) 02138: '~e are about to publish two titlea which will be of considerable intereat to your PASCAL NF,WS readership: PROGRAMMING FOR POETS: ! GENTLE Kevin Talbot, 3029 127th Phce ~.E., aellevue, WA 911005: "The Ayatem I use INTRODUCTION.USING PASCAL, .!!1. Conway & Archer; and! 'pRIMERON PASCAL by the IA An HP3000 (PaAcAI P/3000 hy rra]ey, et. a].)" (*no dAte*) same authors." (*79/10/03*) Ron Tenny, President,G.W. Tenny Co. Inc., 372L Scottsville Rd., Box A, Armsndo R. Rodriguez, P.O. Box 5771, Stanford. CA 94305: "J am In charge of ScottAvUle, NY 14546: "We Are currently using a DFC 1\/31, with 256KB the compilers for Paaca! at LOT~, SAn, GS8, SUMEX, and SCORE at Stanford, memory, eight terminals, two printers, and dual 20MB drives in a business 811 of them DEC-IO or DEC-20. I am preparing a note on our improved version Application environment. We want to Implement Pascal lInder RSTS/E (CTS-500) of the Hamburg compiler for DEC-IO and DEC-20." (*79/06/21*) and are looking for a good DBMS pa('ka~e to FO with the Pascal code."

Wayne Roaing, Digital Equipment Corp., TW-C03, 1925 Andover St., Tewksbury Wi\l1am W. Tunnicliffe, Bobst Graphic, INc., P.O. Box 462, Bohemls, NY MA 01876: "I was a 12/15/78 lost soul. I figured for $4/yeAr you had gone 11716: "ThankA, volunteers!" (*79/08/20*) out of business or YOll folkA had been eaten by 8 FORTRAN compiler. (I'm on UCSD naw but want to get 8 32-bit Zurich venion up on A 68000. demand Rex M. Venator, MAjor II~A, 12451 ~klpper Circle, Woodbrld~e, VA 22192, paging off 8n 8 inch Winchester hard diok.)" (*79/08/20*) "While working on my t1ARtf"rSat GporgiA Tech I bpcamf" A PAscal ~fAnAt ic~ and since then my enthusiasm has not diminished. T Attempt to follow all aspets Louis V. Ruffino. Federal SystemA DiviAion, IBM, IRIOO Frederick Pike, of the language from the standardization efforts to PaRCA} ~s first Gaithersburg MlJ 20854: "Your puhs are excellent, but keep up the great descendant ADA in DOD. I would most certainly 11ke to Join your group and work. provide what assistance I can from an unofficial DOD per~pective." I look forward to PUG .just like BYTEI" (*79/07/09*) (*79/05/16*) Carl Sandin, 314 ShAdow Creek Dr.. Seahrook, TX 77586: have a ~OL-20, "I Dick Wsttson, 10 nutton St. ~., Manchester, NH 03104: "I surely would with~Star disksand Diablo printer. I'm trying t~ get started in predate info on PDP-II compilers (RT-II compatlb]e)." (*79/10/31*) North Stsr PAsca!." (*79/08/06*) Anna Watson, 3701) Dplwood Drive, Panama City, FL 32407: UDon~t be discouraged,Andy. You~re- putting out R fe-ally tnterestfnp: publ1cation. expect to use it ss a reference too] lAter." (*79/08/12*) _.~...... -..

Sydney S. Weinstein, COP, CCP, 170 Centennial Road, Wsrmlnster, PA 18974: "1 am now working for Fischer and Porter Company, and am developing data V.P. Personnel SSI60, New York Times: '~Inlmum of 1 year experience. communications softwart! for local networks for them. We use C as our main Prograo:ming experience with Pascal, PLM, PII, ALGOL, or FORTRAN" V.P. development language, but arc a180 looking at Pas<.:al especially 8S it Personnel SSI60 Times (*79/10/28*) develops for the PDP-li and 8086 computers. Pascsl 1a the bssis of our new 'experimental' process control language." (*79/08/19*) Perkin-Elmer Corporation, Msln Avenue, NOrwalk, CT 06856: Looking for a micro-computer programlrer whose responsibili ties include "developing high Tom Westhoff, Willmark A.V.T.l., Box 1097, Willmsr, MN 56201: "Are there sny level language (PL/l,Pascal) techniques to improve software development for Pascal implementations for Ot110 Scientific Challenger II disk systems?" micro-computers. (*79/10/28*) (*79/09/07*)

ROQney E. Wil1ard, M.D. I Lorna Linda Medical Center Clinical Laboratory, Lorna MANUFACTURERS' ADVERTISEMENTS: Linda, CA 92350: "I am trying to get a Z80 UCSD-CP/M system together and running." (*no. date.) Apple Computer Co.,10260 Band ley Drive, Cupertino, CA"95014: Vsrlous advertisements for their version of UCSD Pascal R. S. ~, 260 Trafalgar Lane, Aiken, SC 29801: "Iim a research analyst working for the DuPont Company at the Savannah River Laboratory. My Columbia Dsta Producta, Inc, 9050 Red Branch Road, Columbia, MD 21045: interests in Pascal are both personal i.e., on a home micro and Advertising "a unique family of computer systems, the Commander series" professional. The company is looking into the possiblity of using a Pascal which will run Pascal under CP/M. (* Computer Design, October 1979*) bssed 'black-box' between our big DL8in frames and any arbitrary microcomputer to make the micros look like all the other IBH-TSO terminals Enertec, 8 company in Pennsylvania, has sent a flyer about their version of in the shop." (*79/07/03*) concurrent Pascal, which runs on the HP3000, and has an interpreter/kerne) for a Z-80 Micro-computer. P-code for a given program is "about one-third t-fax Wunderlich, c/o Textronix, Inc., P.O. Box 500, Beaverton, OR 97077: the size of the P-code from Brlnch-Hansen's concurrent Pascal compiler." On "Both of us (*Hax Wunderlich 6£ Steve Jumonville.) are software en@ineers for the Z-SO, tlexecutionspeed at 4KHz is fast enough to handle 1200 baud Tektronix, Inc. We are presently using OMSI Pascal for production testing terminals with all 1/0 to the IN, OUT level written in ConcurrentPascal. purposes on an LSI-ll/2 wit.. RT-l1." (*no date.) P-codes execute in 20 microseconds (push constant) to 500 microseconds (divide, context switch) Richard Vensen, Ph.D., clinical Psychologist, 2403 Talbot Road, Baltimore, MD 21216: "I al1running UCSD Fascal version 1.5 on a Heathkit H-II Computer Pertec Computer Corp, Chatsworth, CA advertises a uPascal Blaiser software with 32K words of 16 bJt memory. The computer is a 16 bit machine." developmentsystem, intended for systems and real-time applications (*79/07/01*) programming," with 64K RAM, I megabyte of mass storage. The CPU directly executes Pascal; price is $5995 in single-unit quantities. (*Minl-Mlcro Fred Zeise, Data Systems Design, 3130 Coronado Or.tve, Santa Clara CA: "We Systems October 1979*) are usingESI/OHSI Pascal and will be getting UCSO Pascal 1.5 soon." (*79/05/07*) Rational Dats Systems, 245 W 55th St., New York, NY 10019: has provided a Pascal that is "compatible with the entire (.oata General.) line - from PPPPPP Eclipse to microNova. All versions sre source compatible and each can P P cross-compile for any of the other systems. The AOS version is pr iced at P P $3500." (*Computer Design, October Iq79*) PPPPPP P Southwest Technical Products Corp., 219 W. Rhapsody, San Antonio, TX 78216 P advertlaes the S/09 with MC6809 proceasor. "Both multiuser and PASCAL IN THE NEWS mult !taskl ng/mult luaer operst Ing ayatems are ava lIable for the S/09. BASIC, Pascal, and an Asaembler sre Immediately available." Cost with 128K bytes of RAM Is $2995. JOBS: Sperry Univsc MinicomputerOPerations, 2722 Michelson Dr., Irvine, CA 92713 (* Note-these listings are Intended primarily to show that there are Indeed has various advertisementsfor the System (SPS) openings for Pascal programmers "out thereu. By the time you see these running under their SUMMIT operating system which supports a Pascal Hstings, the joba may wellbe filled.*) compiler, debugger, program formatter,and concordance program. SPS also includes a text editor and document formatter. Control Data Corporation, Communications Systems Division, 3285 E. Carpenter Avenue, P.O. Box 4380-p, Anaheim, CA 92803: "Professional openlnga exist In Stirling/Bekdorf,4407 Parkwood, San Antonio, TX 78218, advertlsea the areasof data communications netowrk,messageswitchingand front-end combination coding and CRT layout sheets to 'speed software development and systems. Experienced candidates should be familiar In any of the documentation for Pascal programmers". Two pads of 50 cost $26.85 plus following: Assembly/Pascal/Algol languages, Microprocessors,Real Time $3.25 for handlln8' Systerns,CommunicatIons protocols,test procedure deve 1opment, test tool development. II Contact .Jess Holguin. (.Computerworld 79/09/24*) Texas Instruments:Various advertisements for the D5990 Model wh ich runs Pascal on 8 system that stores l'Up to 4,600,000 characters uSin, double-sided, double-density diskette storage". Also advertisements 1n Hewlett-Packard, West 120 Century Road, Paramus, N.J 07652: "We have opportunities both in Commercial and Scientific areas. Scientific various places for their Microprocessor Pasc.al System with source editor, experience is desired using FORTRAN, Assembler, BASlC, Pascal, data base, compiler, host debugger, confiRurator, nat ive-code generator, and run-time data communications with real-time operating systems. (*79/10/12*) support.

t /

Three Rivers Computer Corp., 160 N. Craig St., Pittsburgb, PA. 15213: has a stand-alone system that can take up to 1 MeRsbyte of RAM, with interactive graphics (J024 lines on a 15-1nl':h screen), and a speech output module. Mass .torage Is provided by 12 Megabyte Winchester disk drive with a 24 Megabyte dtsk option. "The unit contains a 16-bit processor that operates with P-Code, a high-leveJ instruction langtl8pe based on Pa~cal. The processor BOOKS ABOUT PASCAL can reportedly execute in excess of one million P-Codes per second. The system's and memory has a 32-bit segmf'nted virtual addressing mechanism," Alagie, S. and Arbib, M. S., The Design of Welt-structured and Correet PJ"ogroms, has 4K bytes of option. writable microstare as an (*Computerworld, Springer-Verlag, 1978, 292 pages. 79/10/22*) Bowles, K. L., Microcomputer Problem SO~lJing Using Pascal, springer-Verlag, 1977, 563 page..

Brinch Hansen, P., The Architecture o[ (}m~ur'rentFPO[7pamR, Prentice-Hall,1977.

David A. Mundie hAS an artf('lp on the relative merits of Pascal VA. RASIC 1n Coleman, MncMillan Press, 1978, Recreational Computing, Sept-Oct 1979. It conclude"" with "Most PaRcAl D., A StY'lwtu.red T'r'ogMrr7TIin(1Aprn'oanh to Data, 222 pages. lovers ATP deeply romm1tted to portability and standardization. It is not our fault that BASTC dialects have proliferatedso wildly that there exl.ts Conway, R. w., Gries, D. and Zimmerman, E. C., A Pr.imeron Pilocal, Winthrop no Rtandard BA~IC to comparf> with Pascal.1t Publishers Inc., 1976, 433 pages. Arthur Sale passes on R note from Computing, I November }979, which mentions Findlay, B. and Watt, D., PASC'AL: An Introriuctton to Methodical p"[1ogramTling, that the European Space Agency (ESA) wi 11 be using concurrent Pascal "to Computer Science Press (VK Edition by Pitman International) 1978. pro~rRm ESA"s lAtest venture Into the simulation of satellite subsystems, the Multiple Processor Reconfigurable Simulator." Grogono, P., progpaJ117T1ingin Pascal, l\ddison-wes1e~, 1978, 359 pag~s. N~te: Those persons using the firat printing of thts text may oh~aLn a ~tst <:f The Big Byte (Unlver.ityof CaJgary) notes 1n its September 1979 issue that corrections fpom: BarY'Y COl~eliuB, Dept. of Computep Stwhes, Un1..ver8tty "the development of a Pascal compiler under Multics is near completion." of HuLl, Hull, IIU6 7RX, F:l1gland. EArly Warn1np. Newsletter (Universityof Nehraska Computer Network) has a Hartmann, A. C., A (~ml~'D">r'ent- fJaHcal C()mpil(~l"' [01' MinicoI711'/iterR, Sprinter-Verlag "nN release of Stanford Pascal. This version is a consioerahle improvement over previous versions. For the mORt part, changes to the system are Lecture Notes in Computer Science, No. 50, 1977. enhRncementR and wi 11 not affect Pascal programs that ran under the previous Jensen, Wirth, springer-Verlag Lecture version." A change has been made to nested comments, giving a comptler K. and N., Paseat {lser Manual- and Report, option to tnRke constructs stich as (* x:-y (* comment *) *) legal or produce Notes in Computer Science, No. 18, 2nd Edition, 1976, 167 pages. an error as the user desires. (* 79/09/13*) Kieburtz, R. B., Str'Uetured Pr'ognamming and Pr'oblem-Solving with Paseal, Prentiee- Log On (HasseyUniversityComputer Centre), notes that "We are to implement Hall Inc., 1978, 365 pages. a Pascal compiler" for a newly-acquired IBMSeriesII minicomputer. In usage statistics for the B6700, Pascal comes in second place with 10% of usage Rohl, J. S. and Barrett, H. J., P1'ogramming 1J1.',aPa8~al, Camhridge University Press, (981 accesses) during June 1979. (*July 1979*) in press.

ICSA NewRlptter (Rfcp University, Houston TX), tell!=; "Pascal users don"t Schneider, G. M., Weingart, S. W., and Perlman, D. M., I1n lntroducti.on to Progr>am- despair. Although Pascal is currentJy not avaIlable at lCSA, we hope to 'ning and PJ"oblem Solving with Pascal, wiley and Sons, 1978, ]94 pages. remedy the situation 900n. Plans are underway to install Pascal 8000 this fall." (*79/09/17*) Webster, C. A. G., Introdu.ction to Paseal, Heyden, 1976, 129 pages. Welsh, J. and Elder, J., IntPOdu~tion to Pascal, Prentice-Hall Inc., in press.

Wilson, I. R. and Addyman, A. M., A Practical Introduction to ra8ca~, Springer- Verlag, 1978, 148 page..

Wirth, N., Systematie Progranming: An rntroduction, Prentice-Hall, 1973, 169 pages.

Wirth, N., Al{70Y'£thme+ nata Sh']J(!tu'f'P,q Pr~grarnn, Prentice-Hall, 1976, 366 pages.

CT> and to an eXdmpLe in a preceolng sfction. thtretore reQuiring a lit- A 1;'9;" s.; A ru ill t ~.. A. "tni Desi~n of well-Structureo ~pringer-V€rld~, Ne~ Yurk, 197a. tle detecti~e work to deter.,ine e_actly ~ni'h example should Le Correct ProyrarrJs," revie.e~!) j have founo my.elf com~l.tely oa1tled by an 'obwto~sly erroneous' backw~ro refererlce, only to realt2~' after of thlS bOOk is to pr~sent The RI~Jor goal the tech- some consternation, that ] hau pj~5eJ hack into an earl;~r rlique~ of to~-uown urogram design ana verification of ~f:ctiun! ~ro9rdm correctness tlano-in-nar,d. It thus aims to give re~~ers d n~~ ~ay of lookinp at aLqor\thmS and their The SE:cono, and perllaps mort: si~n\ftc~r1t, cOlflpla;nt JealS .,;tf'1 ues;~nt 5yntheSl11n~ t~n yfurs of research in the the tor"ldtting uf ana 5yn~bol' us~a ;n pascal pro~r3m ~.dmDles. ~roce~s. It ~rovi~e5 many eAan,ule~ of progrdm and The ;ndentJt;on sCheme is incon5;st~nt. Thus, on page b9, we ~roof ~evelo~mfnt ~ittl tflt ai~ 01 ~ tormal and informal fino: l.redtment 01 ,",uarp's m..thOQ uf in\lar;ant5.... eof(f) 1he secono~r, Joal at thtS OOOk ;s to teach the reaoer .!!i!f"" 1111 ., b:f~iQ S ::: S t ~ ; to use the proyr",mflliny lan';tlJaqe poscal.... (t) "ow ~e t from the Preface

This re~iewer is ~ ~ascal production ~ro9rammer and this review 111£ i :~ 1 l~ numstuu ~II t5 presented in libht at that bdck~round. ~hile man1 production gr ; IUglQ := graJ€ [i 'JJ rrogr~mmer~, not familiar .ith ttl~ ~a~cal language, ~a1 find this .. gr l,ook to be some~hdt oifficult at first r~do;n9' it ;s well ~orth 11 gr"F G ItH~Q tot~rao~ := totgrage f!~~ num~raues := numwr.d', Dot.. ly~es eQ2' Dtvelvping Progra~s with PrQofs of Correctness respectl"elYt in al~ progrdffi trdgments (tne, are acce~table ~ith- in the proc1 comm~ntSf since the) hdv~ a loy;cal meaning). Proceuures ana .u~ctions Reeur::.ic.n lhis te.t has been uSed ;n at least onp grauuate level co~rse ann pro~romm;ng with ano .ithout votos so cO'1tain~ m~ter;al cf interest to th~ more eruJite Pascal progrdmmer. Even thougt~ tne 9Qtn~ "I~y be rough at times, I (hd~ter conta1ns on excellent tntroJuction to log;cdl formulas; stongly recommend tni~ bOOk t~ anyonf s~r;ouslY intere5te~ ;n (ha~ter contains dn eXC~llent ~r;mer on set theory (expanded pr09rdmminy lan~udges, anu esoec;dlly to Fascal programmers. later tn (haptfr ~). A oi~lio9raphy, glossary ano sutject index are inclu(jta dS are t..o a~fJE'nu;ces: the s,,,tax of Pascal and a com~lE'te renumeratl0n of Pascdl Sloltment Proof Rulei. G. G. Gustafson, >an Dieao (A lYI\ografJht is clean and uncluttered ~tth e~tremely fe~ ty~09raph- ;cal torror s. Reference J have only tNO com~ld;ntS re~Jrd;ng this bOOk. The first, .n annoyance, is the ~xcess;vE' use of r~fertnce numoers appendea to l1J Jensen, K. dno ~irth, ~. "PASCAL - user ~anual dnd Report," examples. The authors also b~9in ref~rence renumbering at the ~~tonu Ed;t;o" (Corrected P,intin~), Sur;n~~r-Verlag, N.~ York, ~ection l~vel r.ttler tha'l it the cha~t.r l.vel. This c.uses , y 7d. unnectSiary ditfi~ulties to the re~oer whut ;gnor;n~ the s~ction numcer, provided ~t the top of tht odo-numoered Pdges, thumbS t.ack to find ~ referenced e~ample (tn one case, th~ rtference is ......

/ /

ARTICLES ABOUT PASCAL Gragono, P., "On Layout, Identifiersand Semicolons in Pascal Programs," ACM SIGPLANNotices,(Apr79). Addyman, A. M., et al., IIA Draft Description of Pascal," Software - Practice and Experience, vol. 9, 381-424, (1979). Gustafson, G. G., "Some Practical Experiences Formatting Pascal Programs," ACM SIGPLANNotices,(Sep79). Atkinson, L. V. ,"Pascal Scalars as State Indicators," Software - Practice and Experience, Vol. 9, 427-431, (1979). Hansen, G. J., Shoults, G. A., and Cointment, J. D., "Constructionof a Trans- portable, Multi-pass Compiler for Extended Pascal," ACM SIGPLAN Notices, Ball, M. S., "Pascal 1100: "An Implementationof the Pascal Language for: Univac (Aug 79). 1100 Series Computers," NTIS: IID-A059 861/5WC, (1 Ju1 78). Heimbigner, D., "Writing Device Drivers in Concurrent Pascal," ACM SIGOPS, (Nov 78). Barron, D., "On Programming Style, and Pascal," Computer Bulletin, 2,2, (Sep 79). Holdsworth, D., "Pascal on Modestly-configured Microprocessor Systems," IUCC Bate, Johnson, Pascal to Work," Electronics, R. R. and D. S. "Putting (7 Jun 79). Bulletin, 1:., 1, (1979). Bishop, J. M., Practice Experience, "an PublicationPascal," Software - and Vol. 9, Holt, R. C., and Wortman, D. B., "A Model for ImplementingEuclid Modules and 711-717, (1979). TypeTemplates,"ACM SIGPLANNotices,(Aug 79). Bishop, J. M., "Implementing Strings in Pascal," Software - Practice and Experience, Joslin, D. A., "A Case for Acquiring Pascal," Software - Practice and Experience, Vol. 9, 779-788, (1979). Vol. 9, 691-692, (1979). Compiler for PDP-ll," NTIS, AD-A061402/ Bonyun, D. A. and Holt, R. C., "Euclid LeBJ lC, R. J., "Extensions to Pascal for Separate Compilation," ACM SIGPLAN 4WC, (Apr78). Notices, (Sep 78). Benyun, D. A. and Holt, R. C., "Euclid Compiler for POP-II," NTIS: AD-A061 406/ LeBlanc, R. J., and Fischer, C., Separate 3: 5WC, (Oct 78). "On Implementing Compilation in Block- :> StructuredLanguages,"ACM SIGPLAN Notices,(Aug 79). n"" ,::r Brlnch Hansen, P. and Hayden, C., "Microcomputer Comparison," Software - Practice and Luckham, D. C., and Suzuki, N., "Verification of Array, Record, and Pointer Experience, Vol. 9, 211-217, (1979). Operations in Pascal," ACM Transactionson ProgranuningLanquages and Systems, .....

Graham, S. L., Berkeley, U. C., Haley, C. B., and Joy W. N., "Practical LR Error perkins, D. R., and Sites, R. L., "Machine-independentPascal Code Optimization," Recovery," ACMSIGPLAN Notices, (Aug 79). ACM SIGPLAN Notices, (Aug 79). 00 Powell, M. S., "Experip.nce of Transporting and Using the SOLO Operating SY8tem, It Software - Practi~~and Experiel,ce, Vol. 9, 5(,1-569, (1979).

T iOiIJ II Pugh, J. and Simpson, D., "Pascal Errors - Empirical Evidence, Computer Bulletin, (Mar 79) .

Ravenel, B. W., "Toward a Pascal Standard," IEEE Computer, (Apr 79).

Rudmik, A. and Lee, E. S., "Compiler Design for Efficient Code Generation and Program Optimization," ACM SIGPLAN Notices, (Aug 79). UCSD !LC!.rkshop Proceedings_

Sale, A., "SCOPE and PASCAL," ACM SIGPLAN Notices, (Sep 79). The Proceedinjl,s of the July 19711 ueSD Workshop on Pascal Extensions (see Pascal News #13, pages 12..15) are now available for $25 from: II Sale, and the Sequence Abstraction in Pascal, Software A. H. J., IIStrings - Institute for Information Systems Practice and Experience, Vol. 9, 671-683, (1979). lIail Code C-021 University of California, San Diego Schaue~, H~, IIMICROPASCAL - A Portable Language Processor for Microprogramming La Jolla, CA 93093 Education," Euromicro Journal, ~, 89-92, (l979)~ U~A

Schneider, G~ M., uPascalt An Overview," IEEE Computer, (Apr 79). Payment must acconopany all orders. Shimasaki, M., et 0.1., IIA Pascal Program Analysis System and Profile of Pascal I Several persons involved with the Workshop expressed to me Compilers," Proceedings of the Twelfth Hawaii InternationalConference on the1 r unhappiness With the Pruceeuings. Because of this t System Sciences, (ED.) Fairley, R. E., (1979). 1 ssked Ruth Itigjl,ins, who served on the Edi torial Board, to provide some background infornlation. Ruth graciously at;reed Silberschatz, A., liOn the Safety of the 10 Primitive in Concurrent Pascal,'I to do HOt and Lhe following note 1s the result."} Computer Journal, Vol. 22, No.2, (May 79). -Jim !liner

Sites, R. L. and Perkins, D. R., "Universal P-Code Definition,'. NTIS: PB-292082/SWC, (Jan 79).

sitea, R. L~, "Maohine-indel'endf'nt Register Allocation, II ACM SIGPLAN Notices, (Aug 79).

Smith, G~ and Anderson, R~, IiLSI-ll Writable Control Store Enhancements to U. C. S. D. Pascal," NTIS: UCIO-18046, (OCt 78). ***************** u:> 00""" Tanenbaum, A. S., "A Comparison of Pascal and ALGOL 68," Computer Journal, Vol. 21, C> No.4, (Nov 78).

Tanenbaum, A. S., "Implications of Structured Programming for Machine Architecture," Communications of the ACM, (Mar 78).

WallAce, IIMora on Interactive Input in Pascal," ACM SIGPLAN Notices, (Sep 79). B'I Comments on the Proceedings of the UCSO Workshop on System Programming Extensions to the Pascal language. II watt, D. A., "An Extended Attribute Grammar for Pascal, ACM SIGPLAN Notices. The Proceedings of the UCSD Workshopon SystemProgrammingExtensions to the Wickman, K., "Pascal is a Natural," IEEE Spectrum, (Mar 79). Pascal Language are now available. I would like to provide some information for the benefit of those who did not attend the workshop but will obtain a Wiggers, R. and Van De Riat, R. P., "Practice and Experience with BASIS: An copy of the proceedings. Interactive Programming System for IntroductoryCourses in Informatics," Software - Practice and Experience, Vol 9., 463-476, (1979). Near the end of the second week of the Workshop, it became clear that we would not be able to approve the wording of a final document within the time frame Wirth, N.. "MODULA-2,"ETH Zurich, Institut fUr Inforll\8tik, No. 27, (Dec 78). of the Workshop. And yet, since the proceedings would be purported to represent consensus of about 50 industry representatives, it was important Wirth, N., "Reflections About Computer Science, II Univ. of york (England) Dept. that they be accurate. To that end, the Workshop participants appointed an of Computer Science, Report No. 19, (Jul 78). Editorial Board whose function was to compile a draft of the proceedings for UCSO to distribute to Workshopattendees for commentwith respect to accurac~ -0 Wirth, N., Collection of PAscal Programs," ETH Zurich, Institut fUr Informatik, :0- "A review those comments, attempt to edit the draft to reflect the comments and C'> No. 33, (Jul 79). prepare a final version. Preparation and distribution of copies was provided ,." by the Information Sciences Institute, UCSO. u:> The Editorial Board met in August, 1978, to prepare the draft. It was distributed to Workshop members with the phrase "Not for distribution" on each page. The comment period was to last until the end of October. The next date when most of the Editorial Board could meet was January II, 1979. At that time, we went through each section of the proceedings and tried to incorporate comments as fairly as possible. Wethen wrote instructions to Gillian Ackland, the UCSDperson whowas doing the actual editing and distribution of the document. Wealso wrote a cover letter to accompany the proceedings. Copies of both of these are enclosed. In late April or early May, I received a phone call from Gillian. She said she had had a very busy winter quarter and had not been able to do anything at all on the proceedings. However, in the Spring, she had gone on with the work but had a few questions. Instructions 1 through 5 (see enclosed) were OK, but why didn't the Editorial Board members want their names included except in the Workshop attendees list? I told her that we had discussed this at length and agreed that we did not want our names to lend credibility or be Dear Gillian: misconstrued as endorsement of the poor technical quality of the document. Many thanks for getting your new version of Sections B thru She had another question regarding Section G (Proposed Experiments) on the to us. There was some concern about how certain comments had been subsection on Type Secure External Compilation. This section had sparked handled. Having the updated version allowed us to check. several, carefully written, long letters disputing the accuracy of what claimed to be a representation of the part on which there had been agreement. We have decided that, on the basis of responses from reviewers, The Board could find no way to treat these fairly except to instruct Gillian the proceedings do not merit publication. However, the Workshop to include the letters also in that section. For some reason, Ken Bowles and part~cipants deserve an accurate report. Therefore, enclosed are the Terry Miller did not want to do that. Instead, they left the section as it was reqUlred corrections. in the fi rst draft and added, as an editori a1 comment, the sentence "The accuracy of this representation has been disputed." She asked me if that was Regarding overall format, all right. I said that the Board had considered that approach but felt it would be educationally important to include all of the disagreement to show 1 . Replace Sec t i on A with the enc 1osed; how pervasive the dispute was. Anything less would be misleading and, therefore, unfair to the workshop participants. Gillian suggested that they rewrite the 2. Edit Sections B through G as shown. Although you did not section, incorporating the comments ~s best they could. I told her that the send us your copy of G, the Board edited a copy from rewritten section would have to be approved by, at least, those who had the first draft to our complete satisfaction; disputed the first version. It seemed to me that the simplest, fairest, and 3. Delete Section H, Section I, and Appendix X; ...... most professionally honest way to handle it was to make the whole technical CD 00 controversy available to the readers. In addition, it would help to demonstrate C how complicated the issue of external compilation really is. 4. Insert page numbers in the Table of Contents; 5. The list of participants should be in alphabetical order When one receives a copy of the proceedings one can see that the cover letter by name of individual accompanied by affiliation, omitting is not included; the words "not for distribution" do not appear ,,$ per the Board's instructions; and the subsection on Type Secure External Compilation addresses and phone numbers. does not include any of the related technical controversy. Finally, a final copy was not sent to the Editorial Board Chairman as requested in 8 (see enclosed). 6. The members of the Editorial Board do not wish to have their names appear anywhere except among those of Workshop I was told that the matter was handled in such a way in the interest of time, participants. that the whole thing had dragged on far too long and any further delay was not iustified compared to the desirability of getting it distributed. It is not clear to me how the Board's instructions could have added noticeable 7. Since the Board feels that these proceedings do not merit delay. wide distribution (even though persons reguesting individual copies should receive them at cost), the phrase NOT FOR DISTRIBUTION will remain on each page. 8. Before printing, mail a final copy to Bruce Ravenel. He will Sincerely, ascertain that editing instructions were understood correctly. / . ~--Jrr. 1-/ ~ Thank you again for your tremendous efforts. Weappreciate the Ruth M. Higgins ~ work you have done so far. Good Luck in this semester: The Editorial Board

...... c

----.-. .'.~~"'-.'.--

John Barr gave a presentation of his work on implementing NBSPascal on L. ,I 's running RT-". The compiler is completely selfsupporting now on such systems, and can ~" cOMpileitself on a 28Kwordmachine using the RT-ll SJ monitor. It takes approximately ~ 10 minutes to compile the compiler on an lSI-ll using floppy disks (about 700 lines/minute). To: The Workshop Participants The compiler is not yet a full implementation of Standard Pascal, but we (the Pascal SIG) ~ are working on it. From: The Editorial Board William Donner and James Forster of TMISystems gave interesting presentations on Subject: The Enclosed Proceedings the implementation of a financial message switch for EFT using a Pascal Multi-Process Subsystem (PMPS-ll), which they also implemented. They added concurrency facilities Date: January 11, 1979 (processes, monitors and semaphores) to OMSIPascal strictly by adding to the runtime, without extending the language. Fed up with MACRO,FORTRANand RATFOR,they considered using C, PL/I and Pascal as their implementation language. They chose Pascal for its reliability, efficiency and good structure. 99%of their system is written in Pascal. This is the final version of the Proceedings to the UCSDWorkshop Isaac Nassi of Digital Equipment gave two overview presentations on Ada, which on System Programming Extensions to the Pascal language. were very well attended. The audience seemed somewhat overwhelmed by the complexity of the language. In light of review responses received, the Editorial Board has decided that the quality of the contents of this document merits During the Pascal SIG Business Meeting a variety of topics was discussed. For distribution to the Workshop participants only. It does not warrant example, leslie Klein gave an update on DEC's VAXPascal compiler. The compiler has under- publication. However, as prescribed in the general resolutions (Sec- gone field testing since June 79 at 15 sites, and should be ready for shipment to customers tion B), copies will be sent to a few others and will be available very soon (approx. December 79). Although it is not a highly optimizing compiler, the at reproduction and mailing costs to any who request individual copies. test sites were largely enthusiastic about it. One of the test site users reported Recipients of this document are requested to restrain from distributing moving a large program from CDCPascal to the VAXwith only 3 changes to the program it further. required. DECshould start receiving some user feedback on the compOer by the next OECUS Sympos i um. The production of these Proceedings reflect the combined efforts of many people. In particular, G1ll1an Ackland has perfonned Reid Brown of Digital spoke about the positive influence the Pascal SIG has had an outstanding, Herculean effort of document preparation and distribution on Digital with respect to Pascal. under the guidance of Terry Miller and Ken Bowles. We wish to thank them on behalf of the Workshop participants. Roy Touzeau ( Pascal SIG Newsletter Editor) and John Barr also spoke on a number of subjects concerning the SIG. Due to OECUS'snew funding structure, each SIG may ..... soon have to charge a small annual subscription fee for its newsletter. lD 00 o I spoke briefly about the status of the DECUSPascal SIG library. The Fall 79 Pascal SIG library contains two versions of Seved Torstendahl's "Swedish" Pascal: A Report on Pascal Activities at the version 6, which contains some new symbolic debugging facilities, and the version San Diego 1979 Fall DECUSU.S. Symposium modified by Gerry Pelletier to enable it to compile itself on a PDPll. There are also versions of NBSPascal for RSX,RSTS and RT-ll systems, as well as a numberof other utilities. PN readers who are interested in the Pascal SIG library should consult Bill Heidebrecht recent editions of the DECUSPascal SIG Newsletter for more details. TRWDSSG One Space Park The next OECUSU.S. Symposiumwill be held in Chicago on April 22-25, 1980, and Redondo Beach, CA 90278 will again feature a number of interesting Pascal sessions.

The 1979 Fall Digital Equipment Computer Users Society (DECUS)U.S. Symposiumwas held in San Diego, California on December 10-13. Approximately 600 of the 2500 people who preregistered indicated an interest in Pascal. The DECUSPascal SIG, chaired by Or. John R. Barr of the UniverSity of Montana, has now grown to over 2000 members. In the Pascal Implementation Workshop, John Barr, Brian Nelson and I spoke briefly about the inplementation of NBSPascal under RSX, RT-ll, RSTSand VAX/VMSsystems. Gerry Pelletier of Transport Canada spoke about his work in implementing a self compiling ***************** version of Torstendahl 's "Swedish" Pascal (V5.3) under RSX-llM. In the Pascal Standards Report, leslie Klein (DEC) and Barry Smith (Oregon Software) reported on the current status of the ISO draft standard and progress within the X3J9- ..... IEEE Joint fascal Committee. Barry gave a detailed discussion on conformant array para- meters and answered a number of good questions from the audience. The quality of questions asked showed the increasing level of sophistication of Pascal users in the DECworld.

._~- /

ISO/TC 97/SC 5 N 553 2) For any that do no have this document, a microfiche is available this meeting. INTERNATlQNAL ORGANIZATION FOR STANDARDIZATION ISO ORGANISATION INTERNATIONALE DE NORMALISATION Ada is a modern powerful computer programming language. It has real-time features and has been under consideration by WG 1 UNIPREA for that reason. It is however targeted to a much wider audience. FrI'"" VIA MONTI:VICCHIO. 21 ISO/TC 97/SC 5 . TORINO 10'8 Ada promotes modularity for the production of large PROGRAMMING LANGUAGBS systems, strong data typing for reliable, even provable, programming, , etc. A rigorous definition will allow ~ontrol of the language ,."',. UNI80. TO_tHO to make possible wid.. portabil ity. It is our intpnt that there Becre.orl.. ANSI (U. S, A. ) be no subset or superset compilers and that a VA1 ida ti on raoi Ii ty be used to assure compliance. Our economic analyses ~how that even more benerit may be attributed to the commonality resulting from exactly compatible systems than that would be attributed to the technical improvements RBPORT ON ADA postulated from introduction of Ada. Even greater benefits may accrue from the wide availabi- Ada is a programming language being produced by the lity if tools a development environment, debugging systems, appli- U.S. Department of Defense in cooperation with several foreign cations specific packages, etc. We term this the "environment" and international organizations. The project has spanned five of Ada. It is expected that the availability of this environment years and is unique for its openness in all phases and the to those who have compliant compilers will be an incentive for resultant international contributions. such compliance.

The first phase was an evolution of requirements from A fundamental question is why does the 000 want to get the users by an itterative process which produced five versions, involved with national and international standarrtization. Ada increasingly refined. These documents were wldly circulated is being volved in a single place and does n0t have the normal and major input was received from individuals outside the U.S., standards problem of rationalization of divergent def:l.nitions and from the International Purdue Workshop such especially its LTPL-B implementations. Is not the DoD's control sufficient? committee, and from experts of SC 5/WG 1. Major support has been contributed by the CRC and by the goverments of the U.K, and It may well be that the 000 has sufficient control in- Germany. We believe that this requirements phase was very valuable ternally and with its contractor". This control may he sufficient in settling many of the questions that normally arise much later to carryover to much of U.S. industry. We are not confident that in the development process, when they are much more difficult to this will be sufficient to cover small business, academic, and deal with. It might be said that, in the best procedure for foreign industry. We do, however, feel very strongly about the major projects, we are proceeding thorough definitive requirements, benefits of commonality, specifically those benefits to the 000 followed by firm design, before coding. of universal commonality, the ability to pick up programs generated elsewhere, transfer of technology, availability of compilers After evaluation of several dozen existing languages generated elsewhere, and most significantly the increacend again$ these requirements, a new design was initiated. On the availability of other sources on which we can draw for hardware basis of an international request for proposal, four contractors and software contractors, increacing competition. were chosen to produce competive prototypes. All started from Pascal, a 1 though -there- is -no "intent that the resul t ing language For the advantages this will provide, the 000 is be closely relate~.~~"S'all .S!nc/J !heir requireJT\.",n!,,__~~E..e_~uch prepared to relinguish some control to the proper' authorities, different. The initial designs from these four contractors were the matter is certainly up for negotBtion. Ada Control Board will reviewed y several hundred experts worldwide and a decision was be established to maintain and interpret the standard. It seems made to continue refin ement of two of the de"igns. A year later, reasonable to have representatives on this group from any nation these two designs were reviewed, again with international partici- having a significant committment to the language. Consider that pation. The single design selected was that produced by Cii group as the sponsoring body, presently the U.S. OeD with repre- Honeywell-Bull. That design, and a document giving rationale for sentatives of U.K., France and Germany. design decisions, are contained in N-499 and have been distributed as the June 1979 issue of SIGPLAN Notices. A preface from the Secretary of Defense requests international public comment.

. ~ ~,.- ---~ .

It has certainly been true that the design of ADA, and A STUDY OF SYNTAX ERRORS ENCOUNTERED the entire project leading up to it, has been an inter- BY BEGINNING PASCAL PROGRAMMERS national effort, as I believe has been evidenced here today. It would be a shame if this opportunity to assu- Kirk Baird re,from the be~inrling, a worldwide Bingle definition David W. Embley was mIssed. Department of Computer Science In light of the resolution 6 intent, we consider that University of Nebraska - Lincoln we are now in a phase of s~multaneous comment from lo- Lincoln, NE 68588 cal, national, and international bodles. This was the purpose of the WG 1 Resolution and the SC 5 circula- 1. Introduction tion of the documents (N 499, N 504, N 505). Several hundred comments have already been received In the 1978-1979 school year, the Computer ScleLce Department at the University of and processed. The results of these comments and fur- Nebraska - Lincoln replaced FORTRAN with PASCAL as the introductory language for Compu- ther studies will result in a final desi~n document in ter Science majors. Since PASCAL was known to only a handful of upperclassmen and pro- May 1980 (with per-haps an early dmft in Januar-y 1980). fessors, it was anticipated that beginning students would encounter difficulty finding At that time we will have a Military Standard, and, one assistance with errors in their programs. The traditional sources of assistance, olher expects, a US Government Standard. I belive that at that than the teaching assistant or professor (e.g. the debug consultant, fraternity files, time, with your coopel'ation, we will have done the pro- or thedorm-floorCompoScL genius)would not be as ',elpfulas before. In thissitu- ation, increased dependenc~ on the compiler generated error messages was inevitable; cessing appr-0pl'iate in ol'der for SC 5 to recomnend Ada and even though PASCAL is designed for instructionaluse, its error diagnostics are for international standal'dization. unfortunatelynot composed so that the beginning student can readily understand them.

Anticipating this difficulty, we decided to observe all first semester student programs submitted for execution and nOte error message frequency, errOr persistence, and appar- ent student reaction and catalogue actual causes for each error. The results of these observations were to serve as a basis for i.mproving PASCAL error messages or at least to provide material for a reference document for beginning PASCAL programm~rs.

2. Data Collection ...... <.0 00 Department 01Computer Science The students observed were Computer Science majors taking CS lS5, Introduction to Com- C> Fergulon Hall puter Programming,using PASCAL. These students ran their PASCAL programs 0" an The University of Nebraska-Lincoln Telephone (402) 472.2402 IBM 37D/148(laterupgradedto a 158)usingthe September1977versionof a PASCAL Lincoln, Nebraska 68588 compiler developed at Stanford University.

A special JCL package waa developed for use in data 'collection. Each time a student Pascal User's Group, c/o Andy Mickel ran a program, the output, includi,ng in-line error messages, was routed to disk. If University Computer Center: 227 EX the program complIed without syntax errors, it was allowed to execute, and the output 208 SE Union Street was also sent to disk. A copy of all of the temporary disk output including program University of Minnesota listing and program output was placed in a permanent file and finally routed to the Minnespolis, MN 55455 printer and given to the student as if it were undisturbed. The permanent file was o~casionally reblocked and copied to tape. Dear Andy. The data collected in thismannereventuallycameto almostsix millionbytesof stor- Enclosed is an article for the Pascal News that st~uld be of interest age. Elementary pattern DLatchingtechniques were used to locate and tabulate the to your readers. It describes sOme observations on error message fre- occurrences of syntax errors in this data. The results of this tabulation appear in quency, persistence. and apparent student reaction in an introductory Appendix 1. Pascal class for Computer Science majors and advocates the davelopment of better error diagnostics particularly for novice progranuners. On occasion, listings of random portion» of the data were printed, and the syntax errors, their cause, and their persistence were analyzed by hand and cataloged. Later Sincerely, in the semester, printouts of unsuccessful runs were collected by the professor and turned over for analysis and cataloging. The results of this tabulation are reported in Appendix II. D2~.~~~ ...... Assistant Professor V'

The University of Nebraska-Lincoln The University of Nebraska at Omaha The University of Nebraska Medical Center

.. /

One of the most often committed blundera exemplifies the novices reaction to these (/)":J> 3. Observations ambiguous messages. Students would precede an ELSE with a semicolon; the resulting n error message. "ILLEGAL SYMBOL". pointed at the blank following the ELSE. Students ,.....:J> Three general observationscan be made from the data: 1) beginning students interpret replaced this blank with almost anything. including another THEN. another semicolon. a :r BEGIN, or a new line. r"T1 errOr me.sages too literally. 2) differences between standard PASCAL as described in :oc the text (Kieburtz.78) and the version implemented confuse students, and 3) certain (/) error me88ageB seem to be particularlyambiguous or misleading. The reason ambiguous error mess.ges hold such a majority of the total ia twofold: ,... 1) thevery fact that theerrormessageis unclearCAusesthe studentto repeatit, ...... 3.1 Literal Interpretation aometimes with cbanges. and at times with the innocent hope that it will go away. and 2) many error messages have more than one cause and Are unclear because the message " Given little else. the beginning student is likely to depend unwittingly o~ the com- has to be genersl enough to cover all caaes. piler generated error messages. at first taking them too literally. In the Stanford compiler 8S implementedat UNL, an error arrow points to a particular column of a 4. What can be done? line of code and is followed immediately by a list of error message numbers. The premise 18 made that the arrow points to the exact position of the error described by Ideally. the compiler should be modified. with the beginning student in mind. to give the error messages associated with the error numbers. In fact, the error arrow never more appropriate error messages. This modification should involve more than mere cos- points to the exact position of the e~ror. Most often. it is positioned just past the metic changes to the error messages. Most likely, additional messages are needed. and error. u.ually pointing st the following keyword or identifier. a finer distinction among possible causes should be incorporated particularly for ambiguoua and high frequency error messages. More than once a student forgot to put a semicolon at the end of the PROG~~ line and found the error arrow pointing to the character following the succeeding keyword. VAR, Not having developed the compiler ourselves. we were not in a position to make these giving the message "SEMICOLON EXPECTED". The student would run the program a second intricate alterations. We were, however, 1n a position to alter the error message time with a aemicolon after the keyword (i.e. VAR;), and the compiler would respond table so that an error message would include a listing of the most prevalent potential with an error arrow pointing to the semicolon and the message "SEMICOLON EXPECTED". sources of the error. Although this option was at our disposal. we rejected it for a among otbers. numberof reasons. No beginning studentcould remaincalmat seeinga hard-worked-on, twenty-linePASCALprogram intermingled with two hundredlinesof errormessages. Other students inadvertently put a semicolon where a comma belongs in a WRITELN param- Moreover, there are certain to be sources of errors that have not ~een cataloged; a eter list. The resulting error was ") ExPECTED" with the error arrow positioned near given student assignment might generate a particular error message a thousand times the semicolon. Subsequent runs showed students putting right parentheses before, after, even though it neverappearedduringthe semesterobserved. In addition,because and In place of the semicolon. Stanford is regularly updating its compiler. such alterations would soon be made obso- lete. Forexample,whena literal characterstringspannedtwo sourcelineson the 3.2 A Non-Standard Version September1977version.tbe errOrmessagegeneratedwas "IMPLEMENTATIONRESTRICTION"...... In subaequent veroions, the error is "STRING CONSTANT CANNOT EXCEED SOURCE LINE". 00 The aecond problem ia the difference between the standard version of PASCAL and the one o'" implemented at UNL. Since sOme characters were not available, the compiler expected In view of these difficulties. it was thought beat to provide a supplementary handout standard substitutionssuch as left-parentheses-vertical-barfor left-square-bracket that could be updated from time to time. This handout (Baird. 79) provides a list of .nd the at-sign for up-arrow. Theae obvious distinctiona caused relatively few prob- the moat frequently encountered errors and their typical causes. Another advantAge lems. of a handout over a coametic alteration of the ayntax error tsble is that additionsl documentation and helpful auggeations can also be included. In addition to syntax Some other differences,however, were more detrimental. For example, in the September errora,thishandout documentsdifferenceRbetweentheUNL Stanfordcomp{l~rAnd 1977 version of tbe Stanford compiler. the standard identifier MAXINT waa not imple- standardPASCAL,describesruntimeerrorsand what to do about them, lists compiler mented, nor was PAGE. and WRITELN and its counterparts had to be followed by paren- options, and shows and explains 8 sample program listing. theses in contrast to the syntax diagrams. Several students faithfully adhered to the syntax diagrams and appropriatelyomitted the parentheses only to find their code blem- We encourage PASCAL implementors to make the effort to provide better error messages ished with unwarranted syntax errors. The subsequent July 1978 version resolved the particularly for novice programmers. We would be interested to hear of such project. problems with PAGE and WRITELN but disallowed SET OF CHAR. Hence students copying seg- in progress and would eventually like to obtain a compiler with error messages that ..ent.of programs from their text with such syntacticallylegalexpressions as are more palatable to the beginner. CH IN (I .A Z. I) or N >- SQRT(MAXINT)would get ayntax errors. References 3.3 AmbiRuity

The third problem is the ambiguity of the error message itself. There are a handful of 1. Kieburtz, R. B., Structured Programming and Problem Solv1na with PAl~ often occurring ambiguous error messages including "ILLEGAL SYMBOL" and "ERROR IN VARI- Prentice Hall, 1978. ABLE" and less often occurringmessages such as "SEMICOLON EXPECTED" and "TYPE CONFLICT OF OPERANDS". In fact, "ILLEGAL SYMBOL" snd ERROR IN VARIABLE" accounted for almost 2. Baird. K.. "Stanford PASCAL at UNL", Departm.nt of Computer Sei8Dce, forty percent of all error messages observed. University of Nehraska - Lincoln, 1979. Appendix II APPENDIX I The following error messages were found in the programs of beginning PASCAL students and were catalogued as to what caused them. Only the more recurrent causes are listed; Thes. errors were tabulated from students running PASCAL .s .n introductory programming the obvious causes are not listed (a.g. error 14, EXPECTED. does not list missing l.nguage. using the Stanford PASCAL compiler. The .ctual error message is listed in ";" 8em1colon order of decreasing occurrence. Errors of insignificantoccurrence sre omitted. .. a cause).

EIIIIOR PERC!!'NT OCCUPREN':E 2: IDENTIPIER EXPECTED 6 ILLEGAL SYIIBOL 21.0 1011 ~DENTIPIER IS NOT DECLARED 18.2 a) extra co..a in list 59 ERROR IN VARIABLE 11.11 b) used TYPE as a variable na.e 13 "END" EXPECTED OIl.S c) missing quote in character literal S8 ERROR IN FACTOR 011.3 d) preyi~us error in declaration ..... END or PILE ENCOUNTERED 011.1 e) used zero instead of 0 in identifier 398 IIIPLEMENTATION RESTRI<::TIO'N 03.6 1311 ILLEGAL TYPE CP OPERAND(S) 02.7 II: 51 ": =" EXPECTED 02.5 ")" EXPECTED II ")" EXPECTED 02.11 101 IDENTIPIER DECLARED TI!CE 02.1 a) K) used instead of )= 5 ":" EXPECT!D 01.6 129 TYPE CONPLICT OP OPERANDS 01.6 1C ERROR IN TYPE 01.5 5: ":" EXPECTED 103 IDENTIPIER !S NOT OP APPROPIATE CLASS(sic) 01.S 18 BRROR IN DECLARATION PART 01.11 (note: in stanford PASCAL, the colon is a viable 111 ";" EXPECTED 01.3 substitute for ..) 12S ERROR IN TYPE OP STANDARD PUNCTION PARAIIETER 01.0 2 IDENTIPIER EXPECTED 00.8 a) tried to use PILE as a variable na.. 11111 ILL!G At TYPE OP EX PRESSION O{l.7 b) CASE without END 21 "." EX PECTED 00.6 c) TO used instead of .. 52 "THEN" EXPECTED 00.6 ...... I.D 116 ERROR IN TYPE OP STANDARD PROCEDURE PARAIIETER 00.5 00 11 "BEGIN" EXPECTED 00.11 6: ILLEGAL SYIIBOL <:> S3 "UNTIL" EXPECTED 00.11 511 00.11 a) preyi~us statement .issing ~ semicolon "DO" EXPECTED 1211 F-PORIIAT IS POR REAL TYPE ONLY OC.II b) semic~lon precedes ElSE 9 "(" EXPECTED 00.3 c) misspelled keyword 1110 TyrE OP VARIABLE IS NOT A RECORD 00.3 d) =) instead of )K 50 ERROR IN CONSTANT OC.2 e) .issing quote in character literal ( 126 NUIIBER OP PARAIIETERS DOES NOT AGRE! 11TH DECLARATION 00.2 f) missing in com.ent g) 111S TYPE ':ONI'LICT 00.2 - used instead of ZK 8 "OP" EXPECTED 00.1 h) extra END 16 EX PECT£D 00. i) DO used instead of BEGIN "-" 20 EXPECTED 00.1 j) TO used instead of .. "." k) 5S "TO" OR "DOWNTO" EXPECTED 00.1 - used instead of : for RECORD within RECORD 102 LOW BOUND EXCEEDS HIGHBOUND 00.1 1) END aissing on CASE stateaent 106 IIUIIBER EXPECTED 00.1 ~ .) co..a missing in list 101 INCO~PATIBLE SUBRANGE TYPES 00.1 n) spaces within an identifier 139 INDEX TYPE IS NOT COIIPATIBLE 11TH DECLARATION 00.1 0) co.aa or colon used instead ot 8. seaieolon 1112 ILLEGAL PARAIIETER SUBSTITUTION 00.1 1113 ILLEGAL TYPE OF LOOP CONTROL VARIABLE 00.1 8; 150 A~SIGNIIENT TO STANDARD PUNCTION IS NOT ALLOWED 00.1 "OF" EXPECTED 161 UNDECLARED LABEL 00.\ 201 ERROE IN REAL CONSTANT : DIGIT EXPECTED 00.1 a) tried to use FILE as a variable naae 25S TOO ~ANY ERRORS IN THIS SOURCE LINE 00.1 b) identifier d~clared twic~ ..... V'

j 10: ERROR IN TYPE

a) tried to use TYPE as a variable name b) colon used instead of equal sign 59: ERROR IN VARIABLE

a) sissing quote 13: "END" EXPECTED b) missing semicolon c) sissing co..a in list a) forgot END for RECORD d) sisspelled procedure identifier bl used TYPE as a variable nase within record e) :- u..d instead of - in expression f) sisepelled AND g) illegal cbaractrer in identifier 14: "I" EXPECTED (note: this error only occurs within the declaration part 101: IDENTIFIER DECLARED TWICE semicolons missing within the block are flaqqed with error 6: ILLEGAL SYMBOL) a) identifier used once as an element in a user defined datatype and once as a simple variable a) illegal characters within PROGRAM identifier b) forgot P.ND for PECORD c) tried to redefine TYPE within a RECOPD 102: LOWBOUND EXCEEDS HIGHBOUND a) TO used instead of .. 16: "-" EXPECTED a) colon used to instead Of equal sign 103: IDENTIFIER IS NOT or APPROPRIATE CLJSS b) tried to use TYPE as a variable within a RECCRD a) sesico10n missinq before WRITE b) previous error in declaration 18: ERROR IN DECLARATION PART c) no END for CASE statement d) missing quote for literal string a) VARIABLES used instead of VAR

~ 104: IDENTIFIER IS NOT DECLARED lD 00 19: ERROR IN FIELD LIST C' a) misspelled identifier a) forgot END for RECORD b) sisspelled keyword c) sissing quote in character literal d) isbedded blanks within an indentifier 50: ERROR IN CONSTANT

a) ... used instead of .. 116: ERROR IN TYPE OF STANDARD PROCEDURE PARAMETER b) TO used instead of c) variable list used as an array index a) tried to read a user defined datatyp~ qualified r..cord identifier broken between source 11n~s

51: ":=" EXPECTED 125: ERROR IN TYPE OF STANDARD FUNCTION PARAMETFR a) - used instead of :_ b) sisspelled Rase of procedure identifier a) passed integer to TRUNC

58: ERROR IN FACTOR 129: TIPE COMPLICT OF OPERANDS

a) -> used instead of >_ a) inteqer assigned a real result b) literal character used without quotes b) sisspelled identifier C) real fraction constant used without leading zero c) I used instead of DIY d) lit~ral character strinq not the .... APRAY OP CRAR it is a88i9D.4 ~o

- . -- 134: ~LLEG1L TYPE OF OPERANPISI 255: TOO KANY ERRORS IN THIS SOORCE LINE'

al ~> used instead of >~ (note: the coapiler only lists the first nine syntax b) previous error in declaration errors of a source line)

136: SET ELE"EN! KOST BE SCALAR OR SOBRANGE 398: IKPLEKENTATION RESTRICT~ON

a) set written inside square brackets a) WRITELN (a record) e.g. X : SET OF BOOLEAN; (I 1. I) b) literal character string> 64 characters c) SETs OF CHAR are disallowed on the compiler

138: TYPE OF 'ARIABLE IS NOT AN lRRAY

a) ~ used instead of := when assigning an array 139: INDEr. TYPE IS NOT COKPATIBLE ~ITH DECLARA~ION DDDDDDDD a) previous error in declaration

140: TYPE OF 'lRIABLE IS NOT A RECORD

al previous error in declaration

143: ILLEGAL TYPE OF LOOP CONTROL VARIABLE

a) previous error in declaration Applications 144: ILLEGAL TYPE OF EXPBESSION

a) :- used instead of

AYLI - As You Like It 145: TYPE CONFLICT Production progranming in Pascal requires a number of source code manipulation tools. \~ith them appropriate application specific syntactic sugar and common multi-program pro- a) previous error in declaration cedure and data structure definitions can be managed. Doug Comer's MAP is such a pro- gram. Tram's complex arithmetic routines and Judy Bishop's/Arthur Sale's string routines 147: LiBEL TYPE INCOKPATIBLE WITH SELECTING EXPRESSION are examples of typical library source utilities. Barry Smith also sent in a small string package. Take your pick. After all, with Pascal you can have it AYLI. a) no END for CASE statement

152: NO SOCH FIELD IN THIS RECORD CORRECTIONS a) misspelled field b) previous error in declaration

A Class of Easily... - Pascal News #15 15ti: KOLTIPLY DEFINED C1SE LABEL in example #3 change "Y = 0" to "Y = 9" a) no END for CASE statement b) aissinq quote within CASE statement c) ELSE preceded by semicolon in CASE statement

j I

Applications

S-5 "102m" (See PN 15, September 1979, page 31.) ------USER MANUAL - REFERENCER Jim Miner spotted two typos in the published version of 10210. He slso provided code to Version 5_0201. lQ7q DRcember 17 improve error processingby handling unclosed strings correctly 88 well as an unexpected EOF inside comments. - Andy Mickel

Correct typographical errors:

ReplAce line 172 by: 1. INTRODUCTION ~ P2-.8al - HigherRight ~~n PI-.Bal :- HigherLeft The f1eferttncer vro~ram 1~ a 80ft-wAre tool intend.,d to R881et vro~ramm~re 1n Replace lina 314 by: finding thMir way around Pa.cal program lIating. of non-triviAL ahe. In . ); ImportantChau :- Let tersAndDig1 ta + ('(', {', kttpp1ng; with.. b,./lt10 ph11o~"phy thAt ~()rtw,.rtt tool,.. :"Ihould hJ.tVM d1~t1not and cleAr purpO~H3 (All' ind~pd moet crAft.:.men df'~1re), the fun~t1on of Rererenc..r hAa h n d..rtned Aa provtdtn.. A c.QIIWAJ:.I.. ~...Y. ,gf Improve error processing: vroc..d ur e-.tlI!iuI.1.n&A .1Il .II. ~, JIru1 .II. .I.ILb.lA .oJ. .!:II.lli JDaWt.tu:. JWUl vroc..dure. It thu. provid..a tnrormAtion on the firat-order procedural Replace line 3 by: int..rrAce. . . James F. Miner 79/06/01, 79/09/30. The product. of R..r..r..ncer mAYserv.. also A. an adjunct to a rull croaa- Insert after line 275: reference, because in present 1.n~ less informaL ton Referencer produces a mor.. convenient .ummary. Additionally, ror thoae people who wlah to chan~e labtl the syntax of Pascel to require r..p..Ution or a procedur..-headin~ at the I { TO ESCAPE EOF INSIDE OF A COMMENT }; occurrence of lhe block of a forward-declared procedure, it will serVe AS a reminder thal lan~uA~e changes are not the only answer to every problem. Replace line. 338 snd 339 by: '1n source program.') ~ ~aa1n Write(Target, Source-); Get(Source) end 2. USE OF REFERENCER Insert after line 345: Wr1te(Tsrget, Source-); Get(Source); Ver~10n S-02.01 of Referencer, the d1!!!tribution version, has no optione to be set. It r..Ada rrom I.h.. .1ruIW.. rile, expectin~ to find a complete Pascol Delete line 347. prof1iram on thia textfl Ie. Alth"u~h the reaulta wlth ayntacticslly Incorr..ct programs are not ~uaranteed, Referencer t!'!l not senet t1 Ve to most flaw!!!. It Replace lines 350, 351, and 352 by: cares about. procedure, function, and proA:rem head in~l!'I, and About (Jroper it EOLn(Source) 1!w! matchina; of begins and caseR with ends i.n the etalement-pFl.rts. bea1n Wr1teLn(Target); ReadLn(Source); { 11.EOF(Source)1hm aoto I EXIT SCAN The two tsble. ar..produc..don th..rile~. Ref..rencerdoea not try to .!!l!!. rormat the headlnga to rit them Into a devlc..-llnewidth; it.l..aveathem a18e beain Write(Tsrget, Source-); Get(Source) end pretty much as they were enter..dinto the pro'!;ram,except ror IndentaUon alignment. The first table thu. b..nefitsrrom . wide print-Jlne. The Replace lines 362, 363, and 364 by: aecond table haa a con.tAnt In the program which controla Hs width, and if EOLn(Source) then the dlatrlbuted v..r.lonrequir...132 ~haractera or print poaitiona. --beain WriteLn(Target); ReadLn(Source); EXIT SCAN it EOF(Source) then i!!!.2.1 { Thus, use of Referencer involves simply eXecuttn~ it, wi.th the att.achment end or th.. input file to som.. pro~ram t..xt. and the direction or th.. output ~ beain Wr1te(Target,Source-); Get(S?urce) end fil.. to some .uHabl.. prlntJ ng d..vlce. Replace line 372 by: and' I:TcOME PROM EOF INSIDE OF COMMENT} 3. LEXICAL STRUCTURE TARlE The rlrst tAhle (aee Appendix) diaplaya the lexical atructure And the pro- c..dureheading.. (The term pro~..duremeans proc..dur..,runotion, or pro~ram ...... in this documentation I1nl...a otherwlSf! .tated,) A. the pro~r.m is read, 00 each hesdln'!;is printed out with th..line-numbsr.or the linea In whiohit ***************** occurs. The t..xt i. Indented on the rlrat line .0 a. to display the

------. ,,-~ will cause it to fail. The most critical features,and therefore those lexical nesting. Subsequent lines ore adjusted left or right so as to likely to Cause failure if not correct are the general structure of the maintain their relative ~osiLion with res~ect to this 'mother' line. On ~rocedure heading (reserved word followed by name with o~tional ~rameter- rare occasions it may not be ~ossible to achieve this adjustment if there list with balanced ~rentheses followed by semicolon and either reserved are insufficient lea01.ngs~aces to delete on the de~endent lines, and then word or directive), and the correct matching of ~ with each ~ or ~ the dis~lay will suffer. in each statement-~art(since this information is used to detect the end of a ~rocedure). In this context, the '~rocedureheading' is taken to mean all the text between and including the o~eninll;reserved word of the headin~, and th.,. If an error is ex~licitly detected, and Referencerhas very few ex~licit semicolon that separates it from the text that follows. What will be ~rror checks and minimal error-recovery, a messag-= 1s printed out that printed is everything contained on the lines that contain this headinQ. looks like thia: While this definitionof ~rocedure heading is not the one in the draft Pa;- AT FOLLOWING LINE cal Standard, it is a ~ragmatic convenience to consider it thus rather than FATAL ERROR No identifierafter prog/~roc/func- ( ); as the syntactic construct. procedure t : TransactionType

The prime USe of this table 1s in undtwstanding programsj it documents the The line of t.ext. prinled 18 Whtlrd the J.lro~ram was whtHl it ~ot into trouble; int.erfaces to each procedure, Lhttir lexical ndBt.ln~, aud where th~ headin~B like all diagnoses this does not. guarant.ee that the cor~ect parentage IS ascribed to the error. Processing may continue despite the fatal error for are loca ted. a while, but the second table will not be produced.

Referencer ia believed to accept the full Pascal language,aa described in the draft proposal submitted to ISO, and to process it correctly. THE CALL-STRUCTURE TAB~,

The second table is ~roduced after the program has been acanned completely, and -is the result of examining the internal data. For tt8ch procedure 6. PORTABILITY listed in alphabetical order, the table holds: It 1s believed that. Referencer uses only St.andard Pascal features according to the draft proposal submitted to ISO. Unless it was external or formal (and had no corresponding block), the llne-numb~r of the ~ that starts the statement-part(the It should be relatively easy to transfer it to other Pascal processors. lt body) . do~s not us~ packing, ~xc~Vtforvseudo-stringsof charact~rs.N~ith~r does it USe dispose, though a possible usage is marked in the program. The small amount of data stored do~s not warrant their use if it might imperil In t.he Nottls column, the characters 'ext' art; J)r1nted if the !)ro- cedure has an external body (declared with a directive other than portability. It requires the use of amall sets of at least aet of 0..15, ~). and the characters 'fml' are printed if it is a formal pro- and a set of char. Those who have not a set of char available can fairly cedural or functional~rameter. If a number appears, the procedure easily program around it, and complain to their Pascal suppliers. The has been declared ~ and this 15 the line-number of the line names are stored internallyin a canonic letter-case (lower-casein Version where the block of the procedurebegins; the second part of the two- S-02.01), with a set indicating those to be transformed on output. This part declaration. strategy should enable users to modify it to run eVen on CDC's 6+6 bit lower-cas~ system, and on on~-case systems. Th~ program implem~nts the A list of all user-declaredprocedures immediatelY called by this Pascal Standard'sattitude towards letter-case. procedure. In other words, their call is contained in the statemellt-~rt. The list is in order of occurrence in the text; a ~roc~dur~1s not listedmore than onc~if it is call~dmor~often. 7. SYSTEM NOTES AND MODIFICATIONS This tabltt may be ust!ful in findin~ thtj compon~nts of a procedure 8e t.hev ar~ squashed into different places in the listin~ by the flattening effects of syntax. It may also be useful In seeing the Inter-dependencies of the procedures of the ~rogram. 1.1 PARAMET£RIZEDCONSTAN~S The heading of the program contains information on altering:

The sigllificancelimit of Identifiers (currently 16 characters). 5. LIMITATIONS This should not be reduced below 10 as it will be difficult to dis- tinguish Identifiersand reserved words. As mt!ntlon~dpefore, the b~haviour of Rtlr~rtlnctlrwhen presented with incorreot. Pascal programs is not. guar8nte~d. How~vtlr,it has btl~nthe intention Lhat it be fairly robust, and there are not too many flaws that

.--..--.--- -- /

The difference between upper-c..e ond lower-c..e letter.. EBCDIC u.ere will probobly need.to chonRe only thie .in~le con.tont. Proottdure ------NeXtCh 30800 30800 The line width for table 2, which automatically affect. the number of NextToken 2600 8700 columne of coIled procedure name.. The dietribut.ed ver.ion has this Readldent 1600 91)00 eel. at. 132, which allow. 5 column. of 16-character name. acro.. the FindNode 3800 4500 pa~e. Set.tin~ it to 54, which allow. .in~le column, I. an ueeful I ~noreCommen t 102 13500 variation. "

The number of indentation space. per level. The .pace u.a~e of Referencer Is very .mall, except perhaps for the pro~ram

it.elf.

On Berkeley Pascal runnln~ under UNIX on . PDP-11/34, proce..ln~ R..fer..ncer by it.elf requiree obout 96 second" of proc..""or tl'lle. Thi. Is about 10.6 7.2 INTERNAL STRUCTURES line. per .econd. The code occupies about 9,000 byte. of .toro~e. Berke- ley Pa.cal i. an interpretive system intended for student u.er., and i. Procedure information is held in an 'Entry' record, each of which 1s linked therefore rather elow In compari.on with compiler. with notlve code ~enera- into two binary tree. by alphabeticol order of name (i~norin~ letter-co.e). Each 'Entry' record contoin. a linked li.t of 'U.ageCell'. Which point to tion. procedure3 celled from that vro~edure. There 1s also a lexical stack display, composed of 'StackCell'.. Similarly, the.e point to the currently ne.ted procedures durin~ the fir.t phase of proce..in~. Each .tach cell 8. ERROR REPORTING aleo contains a root pointer which holds a "scope-tree" which contains all the namee declared at this level. A .In~le ".uper-tree" contain. all the procedure nAme!. The ~cope-trees are traversed durln~ eearchin~ for names, If any errors in proce~sin~Standard Pa.cal program. are detected, plea.e Ind the .upertree i. u.ed to produce the flnol tOble. write to the outhor ot the followin~ addre.s with the exoct detail.. Prob- lems with proce..in~ tncorrect or non-Stondordpro~roms ore not intereot- ing. The final tables are capable of further interpretotionwhich ha. not been done here in the intere.tsof simplicityof the r...uUing sonware tool. For exampl..,recursivitymoy be deduced from the data, and small modifica- Prof A.H.J.Sale tion. would allow the keepln~ of call-frequencycounts. Deportment of Information Science I1niversity of Ta.mania As mentioned earlier, each name is separated into a case-independent com- ".)x 252C, G.P.O. Hobart ponent and a solely-casecomponent for stora~e. The identifiersare recon- Ta.monia 7001 .tructed at th..time of di~play. In the cas~ where not oIl occurr..nce.of Any experience. with the portability of thi. tool are al.o welcomed. an identifierh3ve the samevisualrepresentation,Referencerwill thus .till recogntze them a. the same, and wl.llu.e the fir.t occurrence a. the Technical Report on its design and .tructure Is in preparotion. display form. Referencer could eosily check the identity of .uch forms,

but any error messages would spoil the table. ~nd it has not been done in q. line with th..philo.ophythat eacI tool has 0 particular purpose. HISTORY General-purpo~etool. are often such compromi.es that they are .uccessful It none of their ta.k.... This pro~ram grew out of the proper hounts of ~ood idea. (the coffee-room) and .everal di.cu.slons of what one would 11ke from .uch 0 tool. A.J.Currie, at the Univ~r.ity of Southampton,produced the ftr.t prototype progrom of 231 line.. Ba.ed on this experience ond the problems in accept- 7., EFFICIENCY ing the full Paecal languog.., A.H.J.Sole (on leave from the Unlver.ity of Ta.mania) wrot.. the current ver.ion of ju.t over 1000 line.. The resulting progrom i. now about 20J .lower to A. might be expected, Referenc..rspend. mo.t of its time in N..xtCh,NextTo- than th~ prototype, but it i. b~l1eved ken, ReadIdent, IgnoreComment and FindNode. As a guide, the fOllowing be a more medifioble and 0 correct tool. informotianwas collected while Referencer processed its own text. The The current program wa. written in 4 days. It doe. not fit count. under the "Statements" column or.. the moximum .tatement count. for into any ony.tatement within the procedure body. All count.have been rounded and integrated .yst..m of .oftware tool. but has been de.igned with the bosic depend to oome extent on the use of opace. and isb. in the .ource file. view thot .oftware tools .hould be plentiful, correct, portable, fledble, and .ingle-purpose.Allattribute.are equallyimportant. ~~ N C>

18 / 0001 program Referencer(input,output); { 1 0066 SetLimH 15; 0002 = 0003 I, ., 0067 0068 { This constant is used to 0004 : j PASCAL PROCEDURAL CROSS-REFERENCER : conv~rt upp~r-ca5e letters to lower-ca5~ , 0069 and vice-versa. It Sfould } 0005 . be equal to ord('a') - ord('A'). (c)Copyright1979 A.H.J.Sale, Southampton,England. ' : UCLCdisplacement 32; 0006 I ' 0070 = ., ., 0071 0007 ( 0008 i DE VELOPMENT : 0072 This constant determines the size of the input line buffer. 0073 The maximum acceptable input line is one smaller because a sentinel 0009 I ThIs program is a software tool developed from a prototype by : 0074 space is appended to every line. ) 0010 i A.J.Currieat the UniversHy of Southampton,England. The proto- : 0011 I type of 231 lines of .ource text was used firstly as a basis for i 0075 LineLimit = 200; e;,x t 0076 0012 I t~n91on9 and t..h~n r~wri tt~n to aS9ur~ corr~ctn~s.9 by : { This constant determines the 0013 I A.H.J.Sale, on ieave from the University of Tasmania and then i 0077 maximum width of the printing of the . 0078 second cross-reference t.able. The program deduces how many names 0014 also at the Universityof Southampton. The current version was : } 0015 stabilized at 1979 December 4; the development time being es- i 0079 will fit on a line. .q 0080 LineWidth 132; 0016 timatttd at man-days from IJrototy~~ to ~roduction. I = 0017 : 0081 , ( ) 0018 PURPOSE , 0082 This determines the indentation of the lex-levels. I, Indentation 4; 0019 Th~ program reads Pascal 80UrCtt programs and productt~ two tabltts , 0083 = 0020 as output. Thttstt tabl~s are IJroc~dural documentationand cross- , 0084 { 0021 references. One doouments all procedure or function headings in 0085 These constants are used for the sketchy syntax analysis. 0086 They are collected here so that their lengths may be altered if 0022 a format that illustrates lexical nesting. The other tables } gives the locations of heading, block, and body for each pro- 0087 SigCharLimit is altered. 0023 I. 0024 cedure and function. and what procedures and functions it immedi- 0088 Sprogram 'program . 0025 ,I ately calls. 0089 Sprocedure 'vrocedure ,.'; 0026 , 0090 Sfunction 'function I.. 0027 ., There is a User Manual for this program; if it has not been pro- 0091 Slabel 'label , I ,. , vided with your inatallation write to: 0092 Sconst canst.. I 0028 I, Stype 'type ,., 0029 . Department of Information Science 0093 , I 0030 I University of Tasmania 0094 SVar Val" .., ., Hobart 0095 Sbegin 'begin I., 0031 P.O. Box 252C. G.P.O. I., 0032 ., Tasmania 7001 0096 SeaSe 'case .. 0033 I and ask for the Technical Report on Referencer, if it is still 0097 Send 'end , , t 0034 , available. The program is written to be portable and is believed 0098 Sforward forward I.I , Spaces 0035 . to be in Standard Pascal. 0099 '; I, 0100 0036 type 0037 i PermissionIs grantedto copythisprogram.storeIt in a comput- 0101 0102 Natural 0038 i er system, and distribute H. provided that this header comment O..maxint; 0103 Positive 1..maxintj 0039 ,: 1s rt;tainttd in all cavies. I 0040 , 0104 }' SixChars packed array[1.. 6] of char;. 0041 1 ' 0105 0042 0106 0043 { : 0107 SigCharRange 1..SigCharLimit; 0044 i i 0108 SetRange O. .SetLimit; I 0045 :, PROGRAMASSERTIONS 0109 0046 I 0110 PseudoString packed array [SigCharRange] of char; 0047 ,I Pre-Assertion Pl: 0111 StringCases set of SetRange; 0048 I "The file input contains a revresentation of a correct 0112 0049 ,I Standard Pascal program. in the ISO Reference form." 0113 LineSize 1. .LineLimit; 0050 , 0114 :LineIndex O. .L1neLimit; 0051 ,. Post-as.ertlon P2: 0115 0052 I P 1 and "the file output contains a representation of the 0116 SetOfChar set of char; 0053 : two tables described above, which corre<:tlydescribe facts 0117 I about.. t he ~rogram. It 0118 ProcKind (FwdHalf,AllFwd,Shortform,Formal,Outside,NotProc); 0054 I, 0055 , } 0119 0056 : 0120 PtrToEntry Entry; 0057 0121 canst 0122 ListOfUsages UsageCell ; 0058 { 0059 This constant is the number of significantcharacters kept in 0123 is not 0124 ptrToStackCell StackCell ; 0060 the identifierentries. It can readily be changed. It } 0061 advisedthatit be reducedbelow10 (reservedwordsget to 9). 0125 16; 0126 TokenType (OtherSy,NameSy,LParenSy,RParenSy,ColonSy, 0062 SigCharLimit = 0063 0127 SemiColSy,PeriodSy,AssignSy,SubRangeSy); 0064 ( This must always be (SigCharLimit 1). It is used simply to 0128 - } ( 0065 r.,duce the set range to have a lower bound of 0, not 1. 0129 This type representsa procedure or function identifier found /

0194 0195 token TokanTyPe; 0130 during proc..ssl ng or . program. The rields are used as follows: 0196 0131 procnsme & caseset representation of name 0191 PseudoString; 0132 11nenumber where heading starts .symbol . 0198 symbolcasa StringCasas: 0133' startofbody where begin or statement-part stsrts 0134 forwardblock where forward-declared block starts 0199 savesymbol PseudoString; 0135 status kind or status of name 0200 subtrees of the scope-level tree 0201 0136 left ,right array[LineSizeJ of char; 0131 before, aft..r sub trees of the supertree 0202 line 0138 calls a list of the procedures this calls 0203 superroot PtrToEntry; 0139 10001 tre.. the scope tree for the interior 0204 0140 0205 J PtrToStackCell ; 0141 Entry 0206 stack 0201 0142 record ( 0143 procname : PseudoString; 0208 The remaining variable~ are ps..udo-constants. 0144 case set StringCases; 0209 al phabet SetOrChar; 0210 alphanums SetOfChar; linenumber o. Natural; 0145 uppercase SetOfChar; 0146 startofbody Natural; 0211 0141 left ,right PtrToEntry; 0212 digits SetOfChar: 0148 before ,after PtrToEntry; 0213 userulchars SetOfChar: 0149 calls : ListOfUsages; 0214 0150 localtree : PtrToEntry; 0215 namesperline Positive; 0151 case status: ProcKind or 0216 0152 FWdHalf,Shortform,Formal,Outside,NotProc: 0211 procedure PrlntLlne; 0153 0; 0218 var 0154 A11Fwd: 0219 I : LineSlze; ( ) 0155 forwardblock: Natural 0220 begin wr1te(output, lineno:5,' ,); 0156 end; 0221 0151 0222 i :. 1; { Is this the first time In a run or not? J 0158 I This type records sn instance of an activation of a proc..dure or 0223 0159 function. Th.. next pointers maintain an alphabetically ordered 0224 If adjustment( . First then begin 0225 Ignore any lesding spaces there happen to be. 0160 list; the what pointer points to the name or the activated code. J ( while (I total) end (llne[ I J . ') do 0161 UsageCell . 0226 ' 0162 record 0221 i :. succ(1); 0228 ( Compute the adjustment needed for oth..r lines. 0163 what: PtrToEntry; Indentation) (i 1); next: ListOfUsages 0229 movement:. (level · - - 0164 adjustment :. Other; 0165 end; 0230 ( ) 0231 Insert any necessary indentation ..... 0166 1.0 0232 if level > 0 then . 00 0161 IThis type is used to construct a stack which holds th.. currant wr1te(output, (level.Ind..ntatlon»; o 0168 lexical level Information. J 0233 ' ': 0234 end else begin 0169 StackCell . ( 0110 record 0235 It wasn't the first tima, so try to adjust this 0111 current: PtrToEntry; 0236 line to align with its mother. I 0112 scopetree: PtrToEntry; 0231 if movement > 0 then begin substack: PtrToStackCell 0238 write(output, ' ':movam..nt) 0113 ( 0 then begin 0114 end; 0239 and else if movament 0175 0240 while (I ( total) and (llne[iJ ") and 0176 var 0241 (i (. -movement)do begin 0111 11neno Natural; 0242 i :. succ(i) 0178 ohno LineIndax; 0243 and 0179 total LlnaIndex; 0244 end 0180 dept h Natural; 0245 end; ) 0246 ( Write out the lina. 0181 level -1. .maxlnt; ( 0182 pretty Natural : 0241 while i total do begin 0183 0248 write(output, line[iJ): 0184 IThese sre us ad to align the lines of a heading. J 0249 i :. aucc(1) adjustment (Flrst,Other); 0250 end; 0185 writeln(output) 0186 movament : integer; 0251 0181 0252 and: I PrintLina J p188 (These are true, respectively, if line-burfers need to be 0253 0254 procedure Error(e: Positive); [-!'9 printed before disposal, and If any errors have occurred. ( ) : printflag Boolesn: 0255 This procedure ia the error message repository. -" 0256 begin N : 091 errorrIag Boolean; N 0251 error flag :. true; ,); 0192 write(output, 'FATAL ERROR 0193 ch char; 0256 - . -, . --, .-- ... - - . ~ ' ." --

0259 C8Sti ~ of 0323 follow := thisnod~j 0260 1: wrll.,(output, 'No "program" word')j 0324 if savesymbol < thianodeT.procname th~n 0261 2: writ~(output, 'No identifi~r aft~r prog/proc/func'); 0325 thianode := thisnod~1 .l~ft 0262 3: writ~(output, 'Token aft~r h~ading un~xp~ct~d'); 0326 els~ if sav~symbol > thisnod~T .procnam~ then thisnod~ := thisnodeT .right 0263 4: wrll~(output, 'Lost ".", ch~ck b~gin/cas~/~nds'); 0327 0264 5: writ~(output, 'Same nam~, but not forward-d~clared') 0326 ~lse 0265 ~nd; 0329 match .- tru~ ( 0330 ~nd 0266 We shall print th~ off~nding lin~ too. j { } writeln(output, AT FOLLOWING LINE'); 0331 ~nd Fi ndNode 0267 ' - 0266 adjustm~nt := First; 0332 0269 PrintLin~ 0333 function Hak~Entry (mainprog: Bool~anj j ( ] 0334 proc : Boolean): PtrToEntrYi 0270 end Error { 0271 0335 The first param~t~r is true if the nam~ in symbol is the 0272 procedur~ N~xtCh; 0336 program id~ntifi~r, which has no scop~. Th~ s~cond param~ter 0273 b~g in 0337 is tru~ if th~ nam~ in symbol is that of a proc~dur~ or function. 0274 if chno = total then begin 0336 Th~ r~sult r~turn~d is th~ id~ntification of th~ r~l~vant r~cord. 0275 if printflag then 0339 var 0276 PrintLinej 0340 n~wentry. nod~: PtrToEntryj 0277 total := OJ 0341 locat~d: Bool~anj 0276 while not eoln(input) do begin 0342 suoc(total)j 0343 proc~dur~ PutToSup~rTr~~(n~wnod~: PtrToEntry)j 0279 total := ( 0260 r~ad(input, line(total) 0344 This proc~dur~ tak~s th~ ~ntry that has been creat~d by . Hak~Entry and ins~rt~d into th~ local tr~~, and also links 0261 end" 0345 ] 0262 totai := aucc(total)j 0346 it into th~ sup~rtr~~. var 0263 l1n~(total) := '; 0347 ' 0264 r~adln( input) j 0346 place : PtrToEntryj 0265 lin~no := lin~no + 1; 0349 1j 0350 proc~dur~ FindLeaf; 0266 chno := ( ch : l1n~( 1] 0351 FindL~af s~arches th~ supertr~e to find wher~ this 0267 = ;3: 0266 ~nd elae begin 0352 node should be plac~d. It will be append~d to a l~af XI> 0269 chno := succ(chno); 0353 of course, and placed after entries with the same n ) :r 0290 ch := line(chno) 0354 nam~. , var 0291 ~nd } 0355 0292 end; { N~xtCh 0356 subroot : PtrToEntry; I-' 00 0293 0357 begin o'" 0294 procedur~ Push(n~wscop~: PtrToEntry)j 0356 subroot := superrootj 0295 var 0359 while .ubroot <> nil do begin 0296 newl~vel: PtrToStackCellj 0360 place := subrootj 0297 begin 0361 if savesymbol < subrootT .prooname then 0296 newt newl~vel); 0362 8ubroot :8 8ubrootT.before 0299 n~wl~v~lT .curr~nt ;a newscopei 0363 else:! 0300 ntiwltivelT .scov~trtiti :. nili 0364 subroot :. subrootT.aft~r 0301 nvwltivtilT .eubstack :. ataokj 0365 end end; ( ) 0302 stack .- newlev~lj 0366 FindLeaf 0303 l~vel .- 1~ve1 + \ 0367 { { } 0304 ~ndi Push} 0366 begin PutToSuperTree 0369 if superroot nil then begin 0305 ( = ) 0306 procedure Pop j 0370 Nothing in the supertree yet. 0307 var 0371 8uperroot := newnode oldcell: PtrToStackCe11j 0372 end else begin 0306 { 0309 begin 0373 Seek the right place 03\0 stack! .currtintr.localtr~e .- etackT .acovetreei 0374 FindLeaf i 0311 oldcell := stackj 0375 with placeT do begin stack := 01dcel11.substackj 0376 if savesymbol < procname then 0312 dispose(01dce11)j 0313 ( ...... 0377 before := newnode 03\4 level := level 1 0376 else ( Pop) - 0315 endj 0379 after :s newnode 03\6 0360 end prooedure FindNode(varmatoh : Boolean; end 03\7 0361 { 0316 var follow PtrToEntrYi 0362 end; PutToSuperTree thisnode: PtrToEntry)j 0363 03\9 { } 0320 b..gin 0364 begin MakeEntry match : false; 0365 located :. falsej 032\ = 0322 while (thisnode <> nil) and not matoh do begin 0366 save symbol :. symbolj ) 0387 if mainprog th~n b~gin 0451 I Writ.. ..ither the substitute string or a numb..r. 0 then 0388 n~w( newentry) ; 0452 if n = write(output, substitut~) 0389 ~nd ~lse if stsckf .scopetree = nil then begin 0453 0390 { Nothing here yet. } 0454 els~ writ..(output, n:6) n..w( new~ntry) ; 0455 0391 ( 0392 stackT .sCopetrtiti:; nti~ntry 0456 endj Conditional Writ.. I 0393 and els~ begin 0457 0394 ( Se~k the identifier in the tree. ) 0458 procedure NameWrite(p PtrToEntry); 0395 FindNode(located, node, stackf .scopetree); 0459 var 0396 if not located th..n begin 0460 s : SetRangej 0_61 begin 0397 I Normal cas.., make an ..ntry. I 0398 new( newentry); 0462 for s := 0 to SetLimit do begin 0399 with nodef do 0463 if s in pT.eaa..a..tth..n 0400 if symbol < procname then 0_64 write(output, 0401 left := newentry 0_65 chr(ord(pT .proenam..[s+I])-UCLCdisplae~ent» 0402 else 0466 else 0403 right := newentry 0467 write(output,pT.proenam..[s+I]) 0404 end 0_68 end 0405 end; 0_69 ..nd; (Nam..Writ~ 0406 if not located th..n b~gin 0410 0_71 bagin I PrintTr ) M07 I Her.. we initialize all the fi..lds I 0408 with newentryf do begin 0_72 if root <> nil th..n 0409 ~rocnamt:!:= ttymbol; 0473 with rootf do b..gin 0410 cast:!8t:!t..:= symbolcast:!j 0_74 PrintTr (b..for..)j 0411 linenumber ::: lirltmoj 0_75 0412 slarlofbody := 0; 0476 writ,,'n(output)j 0413 if vroc th..n 0_17 writ..(output, lin..numb~r:5); ,); 0414 status := Short form 0_18 ConditionalWrite(startofbody, 0415 t:!lst:! 0-19 Cas.. status of FwdHalf,NotProe: 0416 at-slue := Notproc; 0480 0417 left ._ nl1; 0481 write(output, ..h?'); 0418 right ._ nil; 0_82 Formal: , ); 0419 before ._ nil; 0483 write(output, fin1 ._ 0484 Outsid..: 0420 sfter nil; ); 0421 calls ._ nil; 0485 wr1te(output, ext' 0422 local tree : nil 0488 Shor t form: ..... = ); nil do b..gin 0_97 if «oount mod nam..sp~rlin..) 0) and (count <> 0) 0433 if nod..T .status FwdHalf then begin = 0498 th..n b..gin 0434 stackT .sco~trt:!t:! := oodeT .locallrt:!t:!, writ,,'n(output); 0435 nodef ,status := AIIFwd; 0499 writ..(output, 35, :') 0436 noder .forwardblock := lin..no 0500 ': ' ' 0437 end ..Is.. begin 0501 tind; 0438 Error(5) 0502 write(outpul, ')j 0439 end 0503 Nam..Write(thisc..,lf.what);' 0440 end 0504 thiacell :. thiso,,"f.nexl; 0441 ..nd;I HakeEntry ) 0505 count := count + 1 0442 0506 tindi 0443 vrocedure PrinlTr..e(root: PtrToEntry); 0507 writeln(output)j 0444 var 0508 0445 thisc..ll: Llsl0fUsag..s; 0509 PrintTree(after) 0510 ..nd 0446 couot: Natural; ) 0447 0511 ..nd; I Print Tre.. 0448 procedur~ ConditionalWrite(o: Nalural; 0512 0449 substitute: SixChars); 0513 prooedure NextToken; 0450 b..gin 0514 I This prooedure produoes the n..xt "loken" in a small set of 0515 recognized tokens. Host of th..s~ serv.. an incid..ntal purpoae; 0516 ~he prime purpose is to reoognize names (res'd words or identifiers). 0517 It serves also to skip dangerous oharaoters in oomments, strings, 0580 end; { 0518 and numbers. } 0581 In oase there is a tail, skip it. I 0519 0582 while oh in alphanums do 0520 prooedure IgnoreComment; 0583 NextCh { ( 0521 This prooedure skips over oomments aooording to the definition 0584 end; RaadIdent I 0522 in the Draft Pasoal Standard. } 0585 0523 begin 0586 begin 0524 NextChj 0587 token :. OtherSy; 0525 repeat 0588 repeat ,.,) 0526 while (oh (> and (oh (> 'I') do 0589 if oh in usefuloharsthen begin 0527 NextChi 0590 OUe oh of 0528 if oh . 'I' th~n 0591 ; begin 0529 Nex tCh , 0592 ')': ) )j ; 0530 until (oh . ')') Or (oh 0593 Nex tCh ; ' 0531 Nex tCh 0594 token :. RParenSy 0532 end; { IgnoreComment 0595 end: 0533 0596 0534 prooedure IgnoreNumbers; begin ( 0597 '( ': 0535 This prooedure skips numbers beoause the exponent part 0598 NextCh; 0536 just might get reoognized as a name I Csre must be taken 0599 if oh . '.' then begin 0537 not to oonsume half of a".." ocourring in a oonstruot like 0600 IgnoreComment 0538 "1..Name", or Wor3~ to consume it and treat thd name a~ an 0601 end else begin ) 0539 possible exponent as in "1. .E02". Ugh. 0602 token :. LParenSy 0540 bag in 0603 end 0541 whila oh in digits do 0604 end; 0542 NaxtCh; 0605 ,( ( begin 0543 Tha oonstruotion of NaxtCh, ohno & lina anaura that 0606 ': 0544 the following tests are always definad. It is to get 0607 IgnoreComment 0545 rid of tokanswhiohbeginwitha periodlike .. & .) 0608 end; 0546 if (oh . '.') then begin 0609 0547 if (lina[ohno+1] in digitsl then begin 0610 It t 1: bt!lgin ; 0548 Nex tCh ; 0611 Nex tCh ,.,. 0549 whila oh in digits do 0612 while oh (> do 0550 NaxtCh 0613 NextCh; 0551 end; 0614 NextCh 0552 end: 0615 end: 0553 if (oh . 'E') or (oh . 'e') then begin 0616 ,I"~ 0554 NextCh; 0617 '0' ,'2' ,'3' ,'ii' ,'5' ,'6' ,'7' ,'8' ,'9': begin 0555 if (oh . '+') or (oh . '-') then 0618 0556 NextCh; 0619 IgnoreNumbers 0557 while oh in di~its do 0620 end; 0558 NaxtCh 0621 , 0559 end : I: begin ( 0622 0560 end; IgnoreNumbers 0623 NextCh; 0561 0624 if oh . '.' thenbegin 0562 prooedure ReadIdent; token :. AssignSy; ( ) 0625 0563 This prooedure reads in an idantifier 0626 NextCh 0564 var 0627 end else begin 0565 j : Positive; 0628 token :. ColonSy 0566 begin 0629 end 0567 token :. NameSYi 0630 end; 0568 symbol :. Spaoes; 0631 0569 symboloase :. I]; 0632 begin j '.': 0570 :. 1; 0633 N..x tCh ; 0571 while (j (. SigCharLimit) and (oh in alphanums) do begin 0634 if oh <> then '.' PeriodSy 0572 if oh in upperoase then begin 0635 token : 11: 0573 symbol[j] :. ohr(ord(oh) + UCLCdisplaoement); 0636 else begin 0574 symboloasa :. symboloase + [j-1] 0637 token :. SubRangeSy; 0575 end alaa begin 0638 NextCh 0576 symbol[j] :. oh 0639 end 0577 end; 0640 end; j 0578 :. j+ 1 ; 0641 0579 NextCh 0642 Ii': be!;!n

/ j ListOfUsag..sj 06q3 N..xtCh 0707 "ewc..ll 06qq tok..n ._ SemiColSy 0708 ptr LhtOfUsag..s; 06q5 ..ndj 0709 hom.. PtrToEntry; j 06q6 0710 sl..vel PtrToStackCell 06q7 ,IF' 0711 found Bool..anj 'A' .'B' .IC' ,'D' ,'E' ,'G' ,'H','!','JI ,IK' ,'l.' ,'H', 06q8 0712 'N' ,'0' ,'P' ,'Q' ,'R' ,'5' ,'T','U' ,'V','W' ,'X' ,'I','Z', 06Q9 0713 procedur.. FindC..ll; 'a' ,'b' ,'c' ,'d','e' ,'f' ,'g' ,'hi ,'1',' j' ,'k' ,'1' ,'m', 07,q { 0650 'n' ,'0' .'~' ,'q' ,'r' ,'s' ,It' ,'U' ,'v' ,'Wi ,'x' ,'y' I'Z': FindC..ll is us..d to scan a List Of Usages to d..termine 0651 b..gin 0715 whether the name alr..ady app..ars ther..~ .If not, it R..adId.mt leaves ptr pointing to th.. tail of th.. list so that an 0652 0716 } 0653 end 0717 addition oan be made. 065Q 0718 var 0655 ..nd 0719 n..xtptr: ListOfUsag..s; 0720 b..gin 0656 ..nd ..ls..( b..gin ) j 0657 Unint..resting oharacter 0721 found :. fal ae nextptr := stackT .curr..ntT.calls; 0658 N..x tCh 0722 0659 end 0723 if nextptr <> nil th..n 0660 until tok..n <> Oth..rSy 072Q r..peat } 0661 ..nd j {N..xtTok..n 0725 ptr :. n..xtptrj 0662 0726 found:. (ptrT .whatT.procname sav..symbol)j 0663 proctidur.. Proc..ssUnit(programid: Bool..an)j 0727 nextptr :. ptrT .n..xt ( 066Q Th~s proc..dure process..s a program unit. It is called on until or (n..xtptr nil) 0728 found = program/proc..dure/function. 0665 recognition of its leading tok..n = 0729 ..ls.. 0666 The param..t..r r..cords wh..th..r we curr..ntly hav.. th.. main program ptr : =nil ) 0730 ) 0667 id..ntifi..r in th.. tok..n, or not. It do..sn't have scope. 0731 end j ( FindC..ll var 0668 0732 { 0669 st : PtrToEntryj 0733 b..gin CrossRef..r..no..r 0670 073Q slllv..1 : =stack; 0671 function NameIsInScop..: Booleanj 0735 found :. fals..; ( 0672 This function is call..d during th.. d..clarstion phas.. 0736 whil.. (sl..v..l<> nil) and not found do b..gin FindNod..(found, hom.., slllv..lT.scopetr )j 0673 of a block, and has to find any) proc..dure which g..ts 0737 =-:> 067Q r..named by th.. scop.. rul..s. 0738 if not found th..n n 0675 var 0739 sl..v..l :. slev..lT.substaok ::z:'" 0676 llev..l PtrToStackC..llj 07QO tmdj 0677 disoov..r..d Boolean; 07Q1 if found then b..gin ...... NotProo th..n b..gin CO 0679 b..gin 07Q3 FindC..llj o stackj 0680 llev..l ._ 07QQ if not found then b..gin j new( newe..ll) j 0681 discov..red : = falStl 07Q5 0682 sav..symbol := symbol; 07Q6 if ptr <> nil then 0683 whil.. (ll..v..l<> nil) and not discover..d do b..gin 07Q7 ptrT.n..xt :. newe..ll )j 07Q8 else 068Q FindNod..(disoov..r..d,wher.., llev..lT.soopetr ._ 0685 if not discov..r..dth..n 07Q9 stackT .curr..ntT .oalls n..we..ll; 0686 ll..v..l:= 11..v..lT.substack 0750 n..we..llT .what := hom..; 0687 end; 0751 n..wcellT .n..xt := nil 0688 if discov..r..dth..n 0752 ..nd 0689 Nam..IslnScope :. (wh..reT.status <> NotProc) 0753 ..nd else 075Q end 0690 { 0691 NameIsInScop.. :. fals.. 0755 ..nd; CrossRef..r..no..r } 0692 endj { Nam..IslnScope 0756 0693 0757 proc..dure SoanForNemej 069Q procedur.. Proc..ssBlock; { This prooedure is r..quiredto go forward until the { 0758 0695 This proc..dur.. is oall..dby ProcessUnitwhen it .hasrecogniz..d 0759 currllnt token is a name (res..rv..dword or identifier). 0696 the start of a block. It handl..s the processing of the block. ~ 0760 begin j 0697 var 0761 Nex t Token 0698 address: PtrToEntryj 0762 while token<> NameSy do 0699 N..xt Token 0763 { 0700 procedure CrossR..fer..nc..rj 076Q end; ScanForName 0701 { CrossR..f..r..ncer is oall..d wh..nev..r w.. have a name whioh 0765 { } 0702 might b.. a call to a proc..dure or function. Th..only way 0766 begin ProoessBlock 0703 we t..llis by looking in the tabl..to s If it is, then 0767 while (symbol <> Sb..gin) do begin 070Q th.. list of usages of th.. procedur.. w..ar.. in is scanned and while (aymbol Sbegin) and (symbol <> Sprocedure) and ) 0768 <> 0705 possibly ext..nded. 0769 (symbol <> Sfunotion) do b..gin 0706 var 0770 ScanForNamej

" { 0835 A tormal proc..dural/functional paramet..r. 0771 if Nam~IsInScopti th~n b~gln 0836 N..xtTok..nj addr~ss :. Hak~Entry(fal~, false); if tok..n . Nam..Sy then begin 0772 { 0837 0773 HakeEntry made its atatus NotProc 0838 which :. HakeEntry(falae, true); 0774 end 0839 which: .status :. Formal; 0775 Idnd; 0840 POPj 0776 if symbol <> Sbegin then begin 0841 NextTok.onj ProcessUnit (fal~) ; if token. LParenSy then begin 0777 0842 { 0778 ScanForName 0843 Skip interior lists. I 0779 end 0844 ScanT1l1Cloae 0780 end; ..nd { ) 0845 0781 We hav~ now arrived at the body 0846 end ..lse b..gin ) ; 0782 dept h :. 1; 0847 Error< 2 0783 atsck: .currentT .startofbody :. lineno; 0848 N..xtTok..n j '0784 Next Token 0849 ..nd 0785 while depth <> 0 do begin , 0850 ..nd ..ls.. b..gin 0786 if token <> NameSy then b~gin 0851 if Na...lslnScope th..n 0787 NeXt'lOken 0852 which :. Hak..Entry(false, false); 0788 end el~ begin 0853 N..xtToken 0789 it (symbol. Sbegin) or (symbol. Soase) then begin ..nd depth :. depth + 1; 0854 0790 end ..la.. begin NextToken 0855 0791 0856 N..xtToken 0792 end else if (symbol . Send) then begin ~nd depth :. depth Ij 0857 0793 - 0858 tmdi NextToken 0794 NextToken end ehe begin 0859 0795 end; { ScanParam..ters { This name is a candidate call. But tirst we 0860 0796 0861 must eli.inate assignments to function values. { 0797 b..gin Proc..saUnit I aavesymbol :. symbol; 0862 0798 0863 printflag :. truej Nex tToken; 0799 0864 adjustm~nt :. Firstj if token <> AssignSy then begin 0800 0865 N..xtTok..n; CrossReferencer 0801 0866 if tok..n<> NameSy then 0802 end ..he b..gin 0867 Error(2) NextToken 0803 ehe begin ..... end 0868 { 0804 0869 We now have the nam.. to stor.. away. I end 0806 0871 whil~ not (tok..n in (LParenSy,SemiColSy,ColonSy]) do end 0807 0872 NextToken; end; { ProcessBlock 0808 0873 if token . LParenSy then 0809 0874 ScanParametersj 0810 procedure ScanPara.et~raj 0875 while token <> SemiColSy do ( This procedure acans the param~t..r list b..caua..at the outer 0811 0876 Nex tToken; 0812 l..v..lthere may be a tormal procedure We ought to know about. I 0877 PrintLin..j { 0813 var 0878 We have now print..d th.. proc..dur.. heading. I which : PtrToEntryj 0814 0879 print flag :. fala..; 0815 0880 writ..ln(output)j procedur.. ScanTillClosej { 0816 0881 Our next task is to a..e if th..re is an attach..d block. I ,0817 ( This procedure ia called when a l~tt parenthesis is 0882 NextTokenj 0818 detected, and its task is to tind the matching right 0883 if tok..n <> Na.eSy then 0819 parenthesis. It do~s this recursiv~ly. I 0884 Error< 3) 0820 begin 0885 ..lse b..gin 0821 NextTok~n; 0886 if (symbol <> Slabel) and (symbol <> Soonst) and 0822 whil~ tok~n <> RParenSy do begin 0887 (symbol <> Styp..) and (symbol <> Sprocedure) and it token . LPar~nSy then Svar) and 0823 0888 (symbol <> Sfunction) and (symbol <> ScanT1l1Close j 0824 0889 (symbol <> Sbegin) then begin NextTok..n { 0825 Bloody directive, mate. I "'0 0890 > 0826 end if symbol. Sforward th..n C> endj ( ScanTillClose 0891 ,.., 0827 0892 atT.atatua :. FwdHalf 0828 { 0893 else N 0829 begin ScanParametera I 0894 atT.atatus :. Outaidej 0830 NextTokenj 0895 Pop " 0831 while token <> RParenSy do begin 0896 end else begin 0832 it (token. N Sy) th..n begin 0897 ProcessBlockj 0833 it (symbol. Sprocedure) or 0898 Pop 0834 (symbo~ . Sfunction) then b..gin

/ 0963 (LineWidth (SigCharLimit + 21}) div 0899 ..nd 096~ nam..s~erlin.. := - 0900 0965 (SigCharLimit + 1); 0901 ..nd 0966 ( ... If you want to introduce aome o~tions. this is the ~lac.. 0902 ..nd; ( Proc..ssUnit 0967 -c > 0903 0968 to inaert the call to your OptionAnalyser. Non.. is ~rovided en ... 1 n 090~ 0969 with the standard tool bacause the requirem"nts vary widely > 0905 I 0970 across uaer environments. The ~robable o~tions that might be r- (a) 0906 This ~roc..dur.. outlin"s whatis n d..d to insert th.. I 0971 ~rovided are wh"ther ~re-declared namee should a~~ar in z: (b) 0907 ~rtid"fin..d names into R..f..r..ncer's tables. D..-box it I 0972 the call liats, how many columns ar.. to be ~rinted in them ,." (c) whath..r underscor.. is ~armitted in identifiers, -= 0908 and ..xt"nd it as ne..ded. 0973 (names~rlin"). en 0909 097~ and ~rha~s whether out~ut should be ccm~let..ly in u~~er-case (a) r..quires a call to BuildPreD..fined ..... 0910 ~rocedure BulldPreo..fined; 0975 lett"rs. The first o~tion } ....."" 0911 consl 0976 just below this ~oint, after analysing options... 0912 NoOfNames =2; 0977 0913 ty~.. 0978 total : =0; Nameslnd"x 1..NoOfNam..s; 0979 chno := 0; 091~ 0; 0915 var 0960 Unano := l..vel : -1; 0916 kk Nam~slndfjXi 0981 = tt array[Nam..slndex] of Ps..udoString: 0982 errorflag := falsej 0917 ...... 0918 hohum: PtrToEntryj 0983 \ BuildPreDefined; 0919 begin 098~ ... ~age(output); ... U[Ol] '; 0985 \ 0920 := 'new ,., 0921 tt[02] := 'writeln. 0986 PrintHeadinl!i; 0922 caseset := []: 0987 writeln(out~ut, 'Line Program/~rocedure/funclion h..ading'); 0923 for kk := 1 to NoOfNames do begin 0988 for ~retty := I to ~3 do tt[kk); 092~ symbol:= 0989 write(out~ut, '-'I; 0925 hohum := HakeEntry(false,false); 0990 writeln(out~ut); hohumT.status :: Outsid~; writeln(out~ut); 0926 0991 } 0927 end; 0992 \ Now We nead to get the first token, which should be ~rogram. 0928 end; 0993 NextTokeni 0929 099~ if token <> NameSy then ... Error(1) 0930 1------0995 =- 0931 0996 "ls.. if symbol <> S~rogram then > n:::c 0932 ~rocedur.. PrintHeading; 0997 Error(1) :x 0933 begin 0998 else begin Version S-02.01')j ProcessUnit(true)j 093~ writeln(out~ut, 'Proc..dural Cross-R..f..rencer - 0999 ( } ..... 1000 Having returned, ther.. ought to be a ~eriod h..re. l.O 0935 writ..ln(out~ut, '======'): 00 0936 writeln(out~ut) 1001 if not ..rrorflal!ith..n begin o ( } ( 0937 end; PrintHead ing 1002 W.. check all tokens that be~in with a ~iod because 0938 what occurs after the Closing ~eriod is nn...hin~to do } 1003 } 0939 begin \ R..ferencer 100~ with us. 09~0 9uv~rroot := nil; 1005 if (tok..n <> P..riodSy) and (token <> SubRange~v) then 09~1 { H~r~ we construct an outer-soave stack ent.ry. This is needed 1006 Error(4) 09~2 to hold any ~re-defin..d nam..s. The distribut..d version do..s not 1007 ..lse begin include any of these, but they are easily ~rovided. See th.. 1008 adjustm..nt ._ First: 09~3 } 09~~ outlin..sin the code mark..dwith ... if you want this feature. 1009 PrintLine 09~5 new( stack): 1010 09~6 with stack! do begin lOll 0947 current : =nil j 1012 and; 09~8 sco~etr..e := nil; 1013 '( Com~leted Phase One - now for the next. I 09~9 substack := nil 101~ if not errorfla~ th..n begin 0950 tmd; 1015 ~age(out~ut): 0951 1016 PrintH..ading: 0952 ~rintflag :. false: 1017 writ..ln(out~ut, 0953 1018 ,'Head Body Notee'. 095~ ,IE' I SigCharLimit, u~vercase ._ ('A' ,'B' ,'C' ,'D' ,'F' ,'G' ,'H' ,'I ,'J' ,'KI ,'lo' ,'H', 1019 , ': IN t , t , , t , , I, , , , , 'y t Z']; 0955 '0 'p 'Q' R' IS' 'T 'U' 'V' 'W' 'X' t' 1020 Calls mad" to')i u{JperC8f!1e " 0956 al ~habet ,- + , 1021 for ~retty := I to (SigCharLimit+37) do [ I , I t , , I t , t , I , . ,t t I , j t , , , 0957 b d 'tt g' h I l' I' t write(out~ut, 'a 'e' f' 'k' 'm' 1022 '-'I; ,'Wi' ,Iy' ,'z'l; 0958 'n' ,'0' ,'p' ,'Q' ,'r' ,'s' ,'t' ,'u' ,'v' ,'x' 1023 writ..ln(out~ut)i digits 0959 .- ['0' ", '2' '3' '4'{ ~..'5'; '6' '7' '8' '9'1. 102~ PrintTr..e(su~..rroot)j N 0960 al ~hanums .- a1vh~b~t'+digit~ ['~11 ~.. i ' 1025 writeln(out~ut) 00 0961 us..fulchars := al~habet + digits + 1026 0962 ['(I, I)', '{', '.', ':', I;', "tI]j 1027

/ PASCAL NEWS #17 MRCH, 1980 PAGE 29 All OV£IVIEIt Of !lAP

!lAP provides f_ b..i. Idclitions to '...Il: .onstom: .opr...ion e.aluation; lOurc. fill inclusion; par._t.rhed "CI"O .Ititution; 8nd conditional c8Pilltion. This slction contains 8 discussion of each f the.. h.H iti.a. MP Iv.LAt.. canlt8ftt ,_pr.ssions <..pression. IIIh," ope, .r. .onst...U or previoualy defintd sy8boli. const...U> on t... ,;..t-llond sid. of COIISTde ..Itions. hpro..fons .IY conuin tho foll ing _rltors

funct ion: na88 (ar..ent I) noglt i ng: lOT - ..ltiplying: AU. I DIY_ ~I~ !lA1 odding: 01. - relating: < <- 0 >8 > concatenating: (one or. Hr. blanks>

All standard operator. hWI the _.. ...ning .1 in 'Iscal, 8nd strong typing is ..baer.od. The _rotors ~IH ond !lA1 r.quire operonds of type INT£IEI or lEAL ond return the _"ller ond l..g.r of th.ir operondl, ro_.ti..ly. Con.lttn.t ion requi r.. operonda of type PACK£DAIIIATOf CIIAII, ond returns I 'ACKED AllAYOf CHAI.hi.h is th.ir con,"ttnation (the type CIIAIIia .._od to be . packed.r,.y of one ,"'racttr for concatenation). MAPrecognize. st8nd8rd '..,al fl.W\ctionl A8S, SII, CIII, 011, 1018, T_C, IS YlU ISt'"t... nonst_rd fun.t ions, ~E.TH ond STllIIIiOf. LEHITH roqui rll ... .rguo..t of type PAWD AlIATOf CHAI or CIIAII, ond returns _r of .h.r..Urs in it. STlIH10froquir.. ... int.r ..pont, ondroturnst'" I 'ACKED AllAY Of CIIAII.onaisting of ita d..i..l rtpr totion. o,or_a in COIIST..prollions ..y 110.onat...to or previoully defintd COIIST n_IS. Of cour.l, P..cal Icope rul.. -oply to defined n ., IllG provide. sevtfll prtdtfintd sy8boll. .onot..ts i.h ... 110ustd In COIIST,op...lionl. T... ..pe.i.lly uI.ful prtdtfintd , TIllEondDATE,gi.. tilt onddate on .hi.h tho ._illtion _ perfol'lltd. Th... prtdtfintd 'onltantlt'" "'lp ...... riti productionprogran th.t _t 110ti.. _ date staoptd. far .._l., in I product ion progr. I hoadi", is ulually printod .honovor t... progr. runs: 'P__ XU C_ILED 011./dd/yy AThh:.:II' Su.hI hooding..y providethoonlyU,* btt .. obje.t ..rsian .f . _r. ond its sour... IInfortunat.ly, I progr_r ..y f.il to update ...ading ...... liking ch__s to tb. progr.. Uli", the prtdtfintd conltantl int'"!lAPto .r.at. tho h.oding r.l i_ tho progr_or of tho upd.ting tlSk ond _rant..a heading will .lw.ys :e Kcur.te: t'"

COIIST I£ADI. . ,,._AIII In C_IL£D OIl' DATE'AT' TIllE;

In addition to constent e.pr.ssion ev.lu.tion, ., s,,"li.. . ..cro sub.tHution facility. A IUCro, which ..y hIVe zero or 8Or. fO,..ll par_ter., lIy 110defintd anyvIIor. in sour.. progr. using synta: t'" t'" IHfIH£(n_(fo...la> ,..lue> where 'n_' is . Yllid '.Ie.l identifier, 'fonl.h' is I li.t of identifier. sep.r.t...d by c , and 'yalue' i. I .equence of '..c.l tot_ wltie" 1. well b.lMced with r ct to P8rtnt One. I ..ero ha. been defined, it can be ..Uod by coding

where'ftM81is the nae.of ..ero, and 'actU8ls' i. . lilt of Ktual Jhlr.eters separ.ted by et'" (Ich actual p.r.eter 8USt be I s..-nee of l tokens i.h is yOll btl od .ith ro_.t to p.ront...... ' In Mdi t ion to tM u.er-def'ined ..eros, MP r.cognizes several ,y.t. Hcros. Definition of a new .actO, shown above, requir.. tlw use of the one such systHl .acro, Nfl.. Another .yst_ ..cro, INCLUDE,prowi.. for IOUrce file inclusion. WltenMP encounter. ." c.ll:

.IHCLUD£

it open. the n_ed file, and continues processing, reading inout frC8 the new file. Upon encounte, ing 1ft end-of-fHe condition, MP closes the included fHe, and r.s s proce..ing the original fHe. Include. .ay be nuted, but they .,y not be recursiye (even though there i. I wlY to preyent 8ft infinite recur.ion). One ..y think of 'include' IS I 81cro who.. body i. an entire file. This ~,;ew, however, does not reflect the flct that the user also .apects included t..t to be l istod lik. It_rd input rothor th.. like body of I ...ro. While 8acro expansions Ire ..ot usually displayed in the t'"source listing, included files Ire. Th.refore, lICLUD£has a special status .0"1 ..cro.. One other syst" .acro, COD£1F, is provided to IUJ)IM)rt the conditional cQ8Pilation of code. Th. syntaE of CODElF is:

$(OHlf(.onst..t Boolean ..prnaion,.ode>

.,here the constant Boolean e.p. .ssion follows the rule. for CCIIST ions outUned above, and code represents a seq&»nce of 'ascal tokens whiclte." il ..ell bal_1eI with ro_.t to parenth..t'. If tho Booltan lI"rH,ion wtluatt. to 'true', the code i. coapiled; if the Ixpres.ion evlluate. to 'fal..', the code is Ikipped.

1. t. C.er, I. P..cal IIKro Preproc.ssor for Large pr._ hvelCllfllHftt., ~~.!!!!! £_rione. lvol. 9, 203-Z09 <1979>. PASCAL NEWS 117 "ARCH. 1980 PAGE 30

.rroutype :8 type .rror, .; 1 progr.. error ; 172 u.t 63 .rrlen 40; { lenIJth of error _sage 113 64 174 crng a O. ..a.cons; conatant ~_iDn at8Ck 65 175 . O cltr; constant~. atrilli! ana 66 drngell''' a O....xdefs; 176 -=ro definitJan at8Ck 67 .r8batype . 'w.l" -type error, ".-ber needed '; 177 dung . O defstr; 1I8CtO clef. atring ana 68 e..rith 'srith - bid type '; 178 flrng a O fi lei; included file at8Ck 69 .retntype 'ev.l.tn type error, nuaber needed ; 179 fnrng . O fn.; bull tin f1aIcthx18 . - ' 10 erbodyeof . 'getbody -end of file in .acro body '; '80 krng a O. keyl; k8ywrdll 71 ercbrtype . '"alchr - t1P8 error, integer needed '; 181 lnrng a O line; irwut line n .rck lper 'cD.ro - left P8ren expected '; 182 .rng a O...axc.lll; 88CtO call atack 13 .rekrP8r . 'Cka8Cro - rigllt peren .xpected '; 183 pgrng . o. .P8Iesize; listing page 74 ercodcOll . 'docodeif - syntax ..ror, .illing c_'; 184 75 ercodeof . 'docodeif - xpected end of fH. '; 185 .Ig . 1!!2!!!. .!!!!l.C1..40] !!. cher; 76 ..codtype ..docodeif- type .rror, bool.an needed '; 186 77 Irconvert . 'convert - integer tn8lCatad '; 187 fptr ..forwal; 18 .rcolt,pe . 'ev.lcoa - type .rror, nu8ber..oed '; 111 79 erdefc08 . 'doclefine - .illing c_ '; 189 fo....l . record 80 .rdefn.e . 'dodefine - Iyntax .rror, nM. needed '; 190 --rn8oe .lfa; { _ of fomal par_tIK } 81 .reapt,... '..pr.llion - inv.l id _rend type '; 191 fne.t fptr . type 82 etext}'PI . ',valesp - '1'1'01', N.8ber needed ; 192 .!!!!!; 83 erf8crpar . .factor - right paren expected ';' 193 84 .rfactyPi . 'factor - type conflict '; 194 85 er;ncn.e . 'doinclude - file n.e needed I; 195 fnl ; fo rd; 214 d.rgs fptr 1ist of fo...ls 314 r. nevpg; forw.rd; 215 and" 315 ~r.ed op.n(n_e: alfa); {file DI8e to open} forward; 216 == 316 r. over(i: integ.r; "roc } { _ 211 dtop drno; 311 I c:ucrent val.. ..xv.l: intag.r); value fO rd; 211 311 proce6ure p (top: crno; { { } } 219 d.fstr : .rr.yCds"'1ll] ~ ch.r; ...,ro definitiDn bodies 319 ctop upon entry tok: l.X>; toIr.en ea8U1g recursiDn 210 } 390 fo rd; 211 dltop dsrng; top of definitiDn string area 391 r. p con; fo rd; 282 392 DrocadAJr. ",ars.con; forward; 213 .top acttal argi8erlts uved in top of defatr 393 procadAJr. pushb.ck; fo rd; 214 394 procadAJr. puttok; fo rd; 285 funct ~CfnrntJ ~ list of builtin flmCtJ0n8 395 procadAJr. rel.t.; fo rd; 286 record 396 r. IC8'\h,"'r i forward; 281 -rn;w. .If.; fwlcticn.-} 391 ~ ecIu t ; forward; 288 fntyp fns 391 proc r. t iMt.; forward; 289 !!!!!; 399 ,rOCadAJre tisecl8t.; fo rd; 290 400 ...ction type..tch: bool...; fo rd; 291 inline It rng; ~ line 401 fon typeis(c: cset>: bool...; fO...8rd; 292 last, 402 adAJr. v.riabl.; fo rd; 293 next !.at <:bar ana ...t char in inline 403 lnr",; } 294 Ch char; ...t <:bar8Ct.el:frea getcb 404 295 line integer; !.at line IUIber } 405 296 pline intag.r; ...t pucal outplt line IUIbet: 406 291 401 } {---I{ 298 t.., tJ8e of 48y frea 8Y8t8 401 ar1th - recagn1ae ar1t18etjc 0(18 in eapc_iDn 299 dte .lfa; date £rea 8Y8t8 } 409 {---I 300 ti..in ;nteger; clock value at start of r... 410 procadAJr. .rith; 301 tott.. intag.r; total ti8e WIed in _ } 411 302 412 303 Unectr intqer; 1ines so far on this.-Je 413 01': lex; 304 nerrors integer; r of errors fOWld ) 414 305 415 begin 306 psource, 416 te,..; 301 d..." dI88y WIed for real IIIIIIb« conversion 411 ~le.tYP.i!!. Clexor, le'add, l ]) !!!!! (!!!!!.typeis(Cterr]» 301 411 309 rcopt, 419 --rT (Ue.typ . l..or) .nd typeis(Ctbl]» or «l.xtyp in Cl.X8dd, ( 310 prcopt lnrno; ri9ht col on ~outp.tt } 420 - l ]) .nd typeiTIrtin, tr.]» - - 311 li stopt booLean; [ list on or off } 421 th.n - 312 exprC)pt boolean; ( rec:a)nize expussicna on or off 422 """""begin 313 423 overCctop, ..xcons); ) 314 last le. [ last token type put by puttok 424 while lextyp in Cl..or, l...cId, l ]!!2 315 outpos { last coll8lft pos u-.:I by puttok } 425 begin - 316 426 ctop :- ctop + 1; 00:- lextyp; gett'Yi t ; ) (op l..or) and typeis([tbl]) 311 lexstr : st rngi ( laical str ing 421 if . 311 l..len lnrno; { IUIbet: of chars in last< 421 tii.n with ctabCctOP - 1] do cb :. clt or ctabCctop].clt 319 l.xtyp lex; [ type of token in lastr } 429 ers;- -- 320 430 --n"(op in Cl..add, l.xs ]) and typeis([tin, tren 321 index integer; for $index -=ro } 431 tiien - - 322 432 -;i'th ctabCctop - 13 do 323 confl : set of le.; 433 -r7 (ctyp.tin> ...;r(ctab[ctop].ctyp . tin> 324 - - {set of tokens needing blank bebieen 434 then - 325 435 ---cis. 011of 326 fon8rd d8claratiOll8 for all pl'ocedures and flmCti0n8 } 436 ~xadd:ci :. ci + ctabCctop].ci; 321 431 l : ci :. ci - ctabCctop].ci 321 Drocedur. .rith; forward; 431 !!!! ( c:a8 329 procedure ckforuUn.e: .If.; ( foaoal _ ) !!!. found: bool.an>; 439 .lse 330 forward; 440 !ii!!l PASCAL NEWS #17 MARCH, 1980 PAGE 32 ~1 forcer.al; 551 ell' It," :- f8t..; ~2 e.l. op of 552 lOT.n :- 0; ~3 --ri.addT"er .. er eUbCetop].er; 553 ..hil. 1 > 0 do 444 l...ub: cr :s cr etabCetop].er 554 --,;;a'n - ~5 and I calle 555 ..len :- l..len + 1; 446 .ner 556 l...trCl..l.n] .. ehrtarr ~ "perror(er.rith); 558 ~ - ~9 etop:. etop - 1 559 if 11gn th... 450 and 560 DOT'n l:UT.n :. l.llan + 1; l...trCl.llanJ ,. a1nus ~ 451 and- 561 for :. 1 to; t..typ:- t..8lph8; 462 ,n 572 while lentrCl.Il.n] z blank do l.llen .. l..l... - 1 463 fOUnd -8false; 573 ~ - 464 if atop > 0 574 teh: 465 iIi... 575 in 466 ~ 576 extyp :- lexlt; le.ten:- 1; le.ltrC1J:- quote; 467 . :*..tackC8top],.; 577 for i :. 0 ~ el... - 1 ~ 468 ..hil. (. <>nil) and ; lall...:. 5 and 483 593 ~ .. 484 1~und ~ gattol< 594 tre: 485 ..wr 595 ~ 416 .!!!!!Ickfomal }; 596 r...r1te(duaay); ..r1ta bl do 489 if ...ro called, push onto stack 599 in I cl88cro -} - 490 I **_11 600 allan :. l.d... + 1; la..trCl.denJ:. cll8ay0; 491 procedura elea.ero I _:alt.al Vat found:bool ); 601 get(duaay) 492 602 ~ 493 603 lOltyp :. l l ); 494 d: drng I inISa to defined IIIICr08 604 .nd 495 605 .nd I calle } 496 ~ 606 .!!!!!.ICCXIYrt I; 497 :. dtop; deflCO].dn_:. n...; 607 { } 491 wIIil. daflCd]odn...<>_ do d .. d - 1; 608 499 1T"T> 0 - 609 ( CCXlYrU ccnvert integer token to binary fom 1 ( -} 500 iIi... 610 * 501 Iii,'n 611 procedure eonvrt;; 502 O'-'d:- true; 612 503 if d <. nly...e ~ doly..e(d) 613 504 "irl. 614 1: 1nteg.r; 505 Iiig1n 615 l: lnrng; 506 over(8top,...calll>; 616 507 ..ith altackCatop + 13, deflCd] ~ 617 ~ 501 ~ 618 ..,th etabCetop] do 509 ..rgs :- n; l; xt:- dfi rst; atlst:- dll.t; 619 ~1n - 510 88top :- 8tOp; !!i!!. ch . blInk!!!!. getch; 620 ctyp :- tin; ci:- 0; 511 1f eh . lpar... 621 for l :. 1 to l.llan do 512 iIi... 622 .1 :. 10*e1 + ordTI...trClJ> - ord(..ro) 513 Iiig1n 623 .nd 514 geteh; geuetuall(d.rgl, ..rgl); 624 .!!!!!.I CCXlYru I; 515 if ch 0 rplren then .rror and }; - 528 procMure clos.; 638 endT"" COIIYrtr 529 639 118g1nftop :. ftop ( close ); { } 530 - 1 end 640 { 531 641 ********COIIYrts convert quoted str ~ to const str ~ ( ) { -} 532 642 **--**.. 533 I ********c:a1Yrt convert constant to pascal input format procedure convrts; { -} 643 534 644 535 procedure*****.** convrt; 645 536 646 l: lnrng; 537 647 538 ;: integer; 648 539 c: char; 649 ..ith etabCetop] do 540 sign: boolean; 650 gin - 541 651 etyp ;z teh; el.n;z 0; ef,rtt.z estop. 1; 542 eg,n 652 l :. 2 ( skip lead~ quote ); 543 ..,th etabCetop] do 653 ..hile l <.

661 771 pushbaclr.; { } 662 772 with ctebCctop] do { dcIcOdeif pe0ce88 $codeif( ape., codel 773 -;T not (ctyp inCt.rr, tin]) .rror(erindxtyp) 663 { }- l!!!!!. 664 774 er.. - 665 procedure docodeif; 775 ~ ctyp . tin 666 776 th.n 777 667 { 8II\Ie area for at:cp upon entry I; 778 ..:- index + 1; ci:- ci + index; convrt; 661 0: dsrng ( 669 ctr, int",er left paren count !; 779 overhrtap,' .axcllls>; atop:- atop + 1; 670 710 .ith ..uckCetop] do 671 belli n 781 --.;;-ginbegin - 672 -gitkey; over(ctoo, ..xcons>; ctop:- ctop + 1; ..pression. 712 aargl :z.!!i!i en..t:- atop; alalt.- atop - 1; 673 ctop :- etop - 1; I:a atop. 713 a.top :- .top; 674 if l..typ <> l.xe th.n up.rror(.roodc..) 714 for; ,. lexlen downto 1 do 675 715 -iII9in -- 'il.. - 1; 676 --;rth cUIICctop + 1) !!! 716 anext :- anext - 677 -;T ctyp . till 717 defstrCene.t] ,. l.utrCn 671 tIi.n 711 end" 679 -;T cll 719 g.m 610 tIi.n 790 .nd 611 b",in 791 612 over(lItop, .,.calls); 792 !!!!; 613 with ..UckC.top + 1) do 793 ctop ,s ctop - 1 { ; 614 -oigin - 794 !!!! doi.ndu I 615 ..rgs :-!!i!i .l,st:- atop 1; getcdpar8; 795 616 .next :- atOP. ..top.=.; - 796 { } 617 797 { ********dooptions peoce.. $opt.ion8 ( !!!!!.; } - ...) 611 .top :- .top + 1; getch 791 { 619 end 799 procedure******** dooption.; 690 .lH 100 691 ~gin 101 692 ctr :- 1; 102 ;: integer; 693 while ctr > 0 do 103 694 be,:n - 104 695 1 ch::lt newl ine 105 gettot; 696 tIi.n 806 while not t.rr then .rror(.rcodtype) 811 b?in?in i:. 10 i + ord*end (i <. .exeoU t..... 710 { } 120 -case leutrCn Of" - *.. 121 --.p,: prcopt :'--1; 711 ( 712 dodefine peocetlll $define(lII8I!(fomal pems) ,strinJl 122 rcopt :- i { }- '.': 713 823 end (C888 I 714 procedure** dodefine; 124 .nd.- 715 125 'NiT' 716 ~ 126 if le.len >. 3 th.n 717 g.ttok; 127 -if l.utrO] 8"'TL' th.n l htopt ,. fel.e 711 if l..typ <> l..alpha .!!!.!!l .rror(.rd.fn..) 128 'il.. if l.utrC3] 'r- .!!!.!!l..propt ,. fal.e; 719 'il.. 129 'LI:-rTStoP't :- true; 720 --.;;-ginbegin 830 lEI: expropt :- true 721 ov.r(dtop, .a.defs); dtop ,. dtop + 1; 831 .nd 722 with d.fsCdtop] do 832 elH.rror(.ropttype) 723 133 .lli"'Tf l..typ <> l..c .!!!.!!l.rror(.ropttype); 724 e..trCO] ,. dollar; pack lexc_ 140 { } ******** ( ); 731 tlien beIIin .rror(erdafc..); dtop ,. dtop - 1 !!!! 141 procedure do.y.ac d:dnl) 732 it'ii getllodylIodyody 142 733 ~ 143 begin 734 !!!! ldodefine I; 844 gettck; 735 .rror(er.yslper) 145 *.;e.typ <> lexlparen .!!!.!!l 736 { I 146 737 ( ..******doinclude - peace.. $1nclude(file) 147 ---ci.e d of { --;Y.in.. doinclude; 731 ******** I 141 739 procedure doinclude; 149 .y.codeif, docodeif; 740 850 .y.ind.., doinde.; 741 851 Iysd.fine: dodefine; 742 "...: It fa; 152 .ysoption, dooption. 743 153 .nd 744 854 .!!!!!. \ diosyIIIac I ; 745 get SUi 855 746 . U lextyp .rror(er;ncn.e} 856 { } <> lexalpha !!!.!!!. { ******** 747 erse 857 erroc'" write out e«oc ..ssage 741 gin 158 { *e***_e_ } 749 p.ck lexrparen then error(erincrpar>; 160 751 open(n.e)- - 161 752 end 862 i: lnrng; 753 163 754 864 b.gin { } ( 755 865 n.ed(2) JUke sure ..ssage fits on page ); ( 756 ********doi.ndu peacess $i.ndu(apeession) 166 if li .topt { -} 757 167 tIi.n 751 procedure******** doindex; 161 --,;egi n 759 169 Wr1t.(.pa.., errflag); ~ i ,. 1 12 ne.t - 1 do write(blank); 760 870 writ.ln(arrow) 761 i: lnrng; 871 .nd , 762 872 .(;;"'writeln(' AT LINE,', line, 2, (pascal line,', pUna: 2, ')1); 763 begin 173 w;:;r.ln(spece, errpr.fh, err}; nerrors:a n.rrors + 1 { 764 ov.r(ctop, .a.cons>; ctop:- ctop + 1; gett.y; 874 .!!!:!! erroc I; 765 if l..typ le.rper.n 175 . { } 766 tlien with ctebCctop] do ~ ctyp,. tin; d ,. 0 .nd 176 **e.*... { 767 itii 177 evalfna evaluate . bull tin f.mction iij)'r.slion; - { - 761 lTTe.typ <>le.rparen ~ .rror(erindrpar) 171 ******** I 769 er.. 179 procedure .valfn. { f:w Ii 770 ~ 110 PAGE 34 PASCAL NEWS #17 MARCH, 1980

181 1!i!!! 991 ~ 8IZ e... f of 992 ---;;lthw th etoll[etop] do 183 -r.b.: l ; 993 ""iT etyp . tell - 814 fatn: Ivalatn; 994 iIi... 185 fchr: .valchr; 995 ~in 886 1coI: Iv.leos; 996 .. clen; estop:- cf1rst -1; etyp:- tin; c1~. flxp: IV8texp; 997 end 187 { ... fl..., ov.ll... leRJth of a stru., }; 998 .lHtsperror(.r lontype) 189 fln: oV.lln; 999 fodd: ov.lode!; 1000 890 { 191 ford: .v.lord; 1001 } { } { ** } 192 frou: ov.lrou cOIn! ; 1002 evalln waluate the ln bull tin fomction { -} 193 fsin: Ivallin; 1003 194 hQr: ovolsQr; 1004 proeedur.**** ov.lln; { 195 htr: ov.lstr atr u., of - IIaIce inteqec a str u., J; 1005 196 ftru: ov.ltru { trtn:ate J 1006 bell;n 197 end { ca8e } 1007 wHh etoll[etop] do 191 .rJ1' evalfna }; 1008 ""iT type;s([tr.;-tinJ) 199 { } 1009 tlien 900 *.. 1010 ---cise etyp of { evalabe evalua te the abe buil tin fomction 901 { -} 1011 tin: beQ;n cr :a In(e;); etyp:a tr. ~ 902 1012 tr.:{ cr :a} In(cr) 903 procedure Ival8bl; 1013 .nd cue 904 1014 el..uporror(er lntype) } 905 begin 1015 !!!!!.("'i'valln ; 906 w t eub[etop] do 1016 { } 907 -;r typeis([tr.;-tinJ) 1017 .*..*... { } 908 iIi... e... etyp of 101. evalodd evaluate the odd bull tin flmctian { -} 909 -trn:ei :. 1Ii.(ei); 1019 910 tr.: er :. oII.(er) 1020 procedure*******. evalodd; 911 ond 1021 912 .lH..perror (.roll.type) 1022 }; 913 .!!!!!.\"iYalabe 1023 i: int...r; 914 1024 915 { ..* } begin { 1025 916 eval.tn eval..te the arcun bulltin flmCtion w,th etoll[etop] do ( -) 1026 917 1027 -;r etyp tin . ; - 911 procedure Ivalatn; 1028 iIi... .!!!Ii!!. :. ei; etyp:. tbl; eb:. ode!(i) !!!!! 919 1029 ilii ..perror(.roddtype)} 920 begin 1030 .!!!!("'i'vavodd ; 921 --;;m etoll[etop] do 1031 { ) 922 -;r typeis([tr.;-tinJ) 1032 ******... 923 iIi.n 1033 { evaloed evaluate the oed bull tin fomction { -} 924 etyp of 1034 .' 925 """'iTn: bollU; er :. .reton(ei>; etyp:. tr. end; 1035 procedure ev.lord; 926 .rctM(cr) tr.:{ cr :- 1036 927 end cue } 1037 92. OlH o.perror (.r.t ntype) 1031 c: char; 929 .!!!! \"iYalatn }; 1039 930 1040 ( ) 931 1041 ~ w,th etoll[etop] do { 932 evaldlr 1042 etyp teh { -} 8'Ialuate the dIr bulltin fomction -rT . - 933 1043 t1ien 934 procedure walchr; 1044 -rT el.n . 1 935 1045 iIi... 1!i!!! e :. estr[eHrstJ; etyp:. tin; el:. ord(C) !!!!! 936 1046 ilii tsperror(.rordorg) 937 i: integer; 1047 .l perror (.roMltype) } 931 1041 .!!!! \"iYalcxd ; 939 1049 boll~n { } 940 w th etoll[etop] do 1050 -;r etyp tin { evalrou evaluate the cOIn! bull tin fWlC:tian 941 . - 1051 { -} 942 iIi.n 1052 ******.* 943 ~in 1053 procedure evalrou; 944 :- c1. ctyp:- tch. ow,rCc.top, atop); 1054 945 estop :- estop ehr(i>; +'. clen:- 1; cstr[cstop]-. 1055 946 efi rst :. estop 1056 r: real; 947 end 1057 941 olH..perror (orehrtype) 1058 I!girI ~aldlr }; 949 .!!!!!. 1059 ---;;lth etoll[etop] do 950 { } 1060 -rT etyp . tr. - 951 { 1061 t1ien1!i!!! r :. er; etyp:. tin; ei:. round(r) !!!!! 952 8'Ial... - evaluate the C08ine bull tin flmCtion 1062 ilii ..perror(erroutype) { } }; 953 1063 !!!!!.("'i'valrou 954 procedure walco.; 1064 { } 955 1065 { 956 boll:n 1066 evalsin - waluate the sin bull tin fImctian 957 w t h etoll[etop] do 1067 I } 951 -;r typei.([tro;""tlnJ) 1068 Drocldur. Iv.lain; 959 iIi... 1069 960 ---cis. etyp of 1070 I!girI 961 """'iTn: bollTii er :. eos(ei>; etyp:. tro !!!!!; 1071 ---;;lth etoll[etop] do 962 tr.: cr :- cOICcr) 10n -;r typeis([tr.;-tinJ) 963 ond {~} 1073 Uen 964 ol H ..perror (oreo.type) 1074 ---cis. etyp of }; 965 .!!!!!.\"iYal... 1075 """'iTn: begU; er :. sin(ei); etyp:. tr. !!!!!i 966 1076 tre: cr ::1:sin(cr) { } 967 ..e 1077 end { cue } { 961 evalup evaluate the up builtin fomction 1078 . (Hexperrot (.rsintype) { -} 969 1079 .!!!!!.T""evalsin }; 970 procedure Ival,.p; 1080 971 1081 { } . { 972 bellin 1082 ..******eval~ evaluate the q bull tin flmctian } { -} 973 with etoll[etop] do 1083 **.***.* 974 --;t type;s([tre;-t;n]) 1084 procedure ev.lsQr; 975 then 1085 976 ctyp ~ . 1086 b.lI;n 977 t1n: beg1n~ er :a exp(c1); etyp~. tre ~ 1087 w1th etoll[etop] do -;r typeh([tre;-tinJ) 97' tre:( cr :a .xp(cr) 1088 979 end c:a8e I 1089 then 910 elii- experror

1101 1211 if l...typ . lex lO.ten tlien 1102 ; 1212 1103 integer; 1213 begin 1104 c char; 1214 get key; ..pression; 1105 sgn boole..,; 1215 if not typeis([tarrJ> than 1106 1216 -iTT..typ <> lnrpare;;- then ..perror(erf.c r) 1107 1211 irse getk.y - 1108 be~:~h~:~h ctlll[ctop) do 1218 .nd- 1109 -;r ctyp <> tin- than ..perror(erstrtype) 1219 ,("variable 1110 irsa - 1220 .!!!!!T"tac:tor I; 1111 Dig ginin 1221 1112 i :a C;i 1222 { } ; { -****-** 1113 if < 0 then begin sSln ::11true; i:a abl(;) .!!!! 1223 findc:a1 - find pcwioualy definod COIIIItant 1224 { } 1114 Irs. Ign :-arse; ~******* 1115 over(cstop, atop); estop.. (stoo . 1; ctyp:a tch; 1225 procedure findcon ( n81!:alfa, va< f~:boole8l I; 1116 ,first estop; 1226 ; :8 0:* then 1117 if ~ clen .. 1; cstr[cstop]:= zero !!!! 1227 1118 Ilsa - 1228 c: erng; 1119 Dig~n 1229 i: integer; 1120 c en :- 0; 1230 1121 while i > 0 do 1231 begin 1122 ~ 1232 e := cv.l id; ct8bCOJ.en.e:a n..e; 1123 cstr[cstop)- :. chr(ord(zero) . (i 80d 10»; 1233 while ctlll[c).cn..a <> n_ do c'. - 1; 1124 i :- i div 10; over(cstop, atop); 1234 iTC> 0 - 1125 estop £'8""Cstop+ 1; clen:8 clen + 1 1235 tlien 1126 end. 1236 -,;;g in 1127 ;f"ii;. then cstr[cstop] :a .;nu$ 1231 ctob[ctop] :. ctlll[c); 1128 Ilsa cst0jj'"":8 cstop 1; 1238 with ct8b[ctop) do - 1) ctyp tch 1129 rori :. 0 to(clen - div 2 do 1239 -;r . - 1130 "begin - - - 1240 then 1131 c :- cstrC; + ,first]; 1241 begin tltr[; ,first] 11; over(cstop + clen, ..xcstr); e1irst.- estOP + 1; 1132 + :- cstr[cfirst; + ,Len - - 1242 1133 cstr[cfirst + clen - 1] :a c 1243 for i :. 0 to cl.n - 1 do 1134 end - 1244 -"'Iiagln - - 1135 .nd- 1245 estop :- estop + 1; 1136 .nd- 1246 cstr[cstop) .. cstr[ctlll[c).cfirst . 1] 1137 ~ {walstr I; 1241 and 1138 1248 ( ) !!!!Y- 1249 1139 { **** fOW"ld:- true 1140 evaluate tn8>C builtin flmCtian 1250 end { ""altru -} 1141 1251 ~ ifindc:a1 I; 1142 procedure******** eVlltru; 1252 { } 1143 1253 e.* 1144 1254 { flook", - look", f c:tian_ ani retlEn typecode I 1145 r: r..l; 1255 { .*.eee.e } 1146 1256 procedure flookup { :.1£., va< f : £nil, var f~:bool_ I; 1141 1251 1148 w,th ctlll[ctop) do 1258 1149 -;r ctyp . tra - 1259 f: fnrng; 1150 tlien !!!ii!!. r :. cr; ctyp:= tin; ci'= trunc(r) !!!!!. 1260 1151 'ilii experror(.rtrutype) 1261 1152 !!!!!. tevaltru I; 1262 unct[OJ.f,... :a nMe; 1:- ...1ns; 1153 1263 while f cHfJ.f e <> n_ do f :. f - 1; 1154 { } 1264 iTT. 0 then found :. fal.. 1155 { ********experror pc int error for expo:essian ani flush I 1265 Ils. be!Ii!1TciUn'd:. true; fun:. funct[fJ. fntyp { }- !!!!!. 1156 1266 flookup I ; 1151 procedure******** ..perror { err :errmsg }; 1261 1158 1268 { ...*e**.e } 1159 ~ errorCerr); ctlb[ctop).ctyp .. t.rr; fl ush 1269 { flush - flush to _ic:oIon 1160 !i!!T experror I; 1210 { *...**-* } 1161 1211 procedura flush; 1162 { } 1212 1163 ( expo:essian - parse expo:ession: put value in "tab[etop) 1213 ~ whila not (lextyp in ne..of, l i) ~, :key 1164 { ...**... } 1274 !!!!T fii.ii'/; - 1165 procedure exoression; 1215 1166 1216 { *.e**e.. } 1161 begin 1271 { forcereal - force tap bID CCII8tants on stackto real 1168 -rer.te;re .te; 1218 { _**ee.ee } 1169 if typeis([tch) 1219 procedure foreereal; 1110 tlien 1280 1111 Digingin 1281 1172 over(ctop, ..acons); etop:a ctop + 1; 1282 i: integer; 1173 [lexst, lexalpha) 1283 :..tYP ..i!!. !!!!. 1114 ~i n 1284 1175 r. ate; 1285 ~wth ctlll[ctop) do 1176 if typeis([tch) 1286 -;r ctyp . tin -then !!!ii!!. i :. ei; ctyp :- tr.; cr :. t .!5 1171 tlien with ctlll[ctop . 1] do clen :. clen . ctlb[ctop].clen 1281 withctlll[ctop - 1J'dO 1118 'ilii ~not typeis([terr» th.n experror(araxptype) 12aa ""iT ctyp . tin then !!!ii!!. i :. c;; ctyp :- tr.; cr .. I!!!!!. 1119 ~-- - 1289 !!!!!.I forcereal 1;- 1180 ctop :. ctop - 1; 1290 1181 end 1291 { _.e* } { 1182 !!!!!.{expo:esaian I; 1292 getactuals - get actual par_tars for 811Cro c:all 1183 1293 { **e_e... } 1184 { ...**.ee } 1294 procedure g.Uctuals ( f:fptq va< act:apt< I; 1185 { factor - recognize factor part of expression I 1295 1186 { .ee..*.. } 1296 ~ 1181 procedure factor; 1291 if f nil ={ 11aa 1298 tlian il no formals, then no actuals I 1189 1299 i!Se 1190 op: lex; 1300 begin 1191 1301 "ew(act); 1192 begin 1302 with act-, f- do 1193 H Lextyp in CtelROt, lexsub] 1303 beg~n - 1194 tIi.n - 1304 a 01"1I:= fn_l'; alast:= atop - 1; getpal"ll; 1195 begin 1305 afirst := atop; if ch :: coeu then getch; 1196 op := lextyp; get key; factor; 1306 getactuals(fnext, ine.t) 1197 with cUb[ctop) do 1307 .nd (op l.xnot) then cb :. 1198 ""iT typeis([tblD .nd . .!!!!! cb 1308 end;- 1199 fls. - 1309 !!!!!.i getactuals I; 1200 -;r typeis([tin, tr.J> .nd (op lexsub) 1310 = } IZ01 TIifn 1311 { *..* 1202 1312 { getbody - get the body of a 811Cro !!!.!. ct~ !!!. c;; { ._eee.._ } 1203 tln: e1 :111:- 1313 1204 tr.: cr := - er 1314 procedure getbody; 1205 ~ ( c:aee I 1315 1206 elsa 1316 1201 -;r ctyp <> terr 1317 ctr: integer left parenthesis c:

1321 then 1431 1322 -oiTth dehCdtop] do 1432 1323 getch; al.st :. dstop; dfirst:= dstop. 1 ~ 1433 ~ { 1324 also 1434 } { ******** 1325 ~ 1435 getJcey get token end classify l8ll}uage keywords 1326 ctr :- 1; 1436 {, -} 1321 with dafsCdtop] do 1431 procedura******** gatkey; 1328 - 1438 1329 ~ wh,la ctr > 0 do 1439 NIle of ccnatant I ; 1330 begin - 1440 n.e: aU. } 1331 over(dstop, .top); dltop:a dstop + 1; 1441 k: krng pointer to keywords ; 1332 defstrCdstop] := ch; dl.st:= dstop; 1442 1333 if eh . rp.ren then ctr :a ctr - 1 1443 begin 1334 orsa - 1444 getbsu; 1335 --rT ell . lp.ren ~ ctr :- ctr + 1 1445 if lextyp :I lexalpha 1336 orsa 1446 ITen 1331 --;r (ch . nawline) .nd (ftop . 0) and eoHfstackCO]. 1441 -r.-gin 1338 - ffila) - 1448 pack n_e do k :. k - 1; 1340 gatcn- 1450 ~> 0 than leltyp :. keywdCk].klel ',341 end; 1451 end { }; - 1342 daTitrCdlast] :. blank replace trailing "j" 1452 ~ r 8u - ,"""ro 1349 ( ) 1459 1350 procedure******** getbsu; 1460 incol: lnrng; 1351 1461 ;: integer; 1352 1462 1353 1463 "...: .1fl; 0) 1354 found: boolean; 1464 01 ,le eoHfstackCftopJ.ffile) end (ftop > do closa; '. 1355 1465 1"f'OOf(fstackCftopJ. ffi le) - - 1356 1466 1351 gattok; 1461 else 1358 while laxtyp . lelNc do 1468 --.rth fstackCftop] do 1359 ~ 1469 n - 1360 paekH,xstr, 1, n_e);- ckfol"8.l(n.e, found); 1410 f:nne :. line. 1; fline:. fline . 1; incol:. 1; 1361 if not found then 1411 If listopt 1362 -iiii1i - 1412 ITen (n_e, found); ... . 1363 ~ac ro 1413 big:n 'n 1364 if not found then b_in error(ar.acdefn); gettok and 1414 i linectr >= pagesize 1365 eriT: - -.=&= 1415 ITen ~ linectr :.0; naWIIII.!!!!!; 1366 1416 TTiiictr :& tineetr + 1; writ.(apaca, line: 4, I I); and= }; 1361 .!!!! r-gett>8u 1411 for i :. 1 to 1 do writa(fn_eCi]); 1368 1418 1369 { } 1419 while (not eoln(ffila» and (incol <. rcopt> (fflla- } !!!! 1310 I ...*****getcdpam get "c:aleif" c:aIe am save it 1480 blliik") do - { } - 1311 1481 ~ get 0) or (ch <> rparen) _do 1490 la~s ;ncol - 1; 1381 !!ii!l ( - 1491 if not eoln(ffile) then 1382 over , atop); d:- d + 1; defstr[d]:- chi 1492 Degtntin - 1383 if eh 18 lparen then ctr :s ctr + 1 1493 wriU(braakJ ; 1; 1384 ern if eh = rp.r~ then ctr .. ctr - 1494 while not eoln(ffile) and (incol < ..ICOl> do 1385 gern,- - 1495 1386 end' 1496 1381 if~ dstop than 1491 wr~n 1388 -.!!!i1!! - 1498 end 1389 ower(d,atop); d:. d . 1; dafstrCd]:=blank; 1499 a(i. 1390 while d > dstop do 1500 gi~ 1391 1501 wh le (not eoln(ffile» and (incol <. rcopt) end (ffila" 1392 atop :. atop - 1; defstrCatop]:. dafstrCd]; d:. d - 1 1502 blri) do - - 1393 end 1503 gin get mile); Incol:. incol + 1 .!!!!!; 1394 end- 1504 next :- incol; r-getcdpam } ; }; 1395 .!!!! 1505 inlineCnelt] :. newline I in c:aa of 8IPtYline 1396 } 1506 while (not eoln(ffile» .nd (incol <. rcopt) do 1391 { **.**.*. 1501 ~- - - 1398 I getch - get t character and place in cb } 1508 ;nlineClncol] ..ffila"; Incol:. incol. 1; 1399 { } 1509 get (ffile) 1400 procedure**** getch; 1510 ~ 1401 1511 last :- ;ncol 1402 b.~~n 1512 end; 1403 1 atop > 0 then 1513 readlnCffile); 1404 -while (.staill.topJ..next > .steck(.topJ..last) and (.top 0) 1514 if last >= next > ~ ; 1405 begin atop := 8stackCatop).aatop; atop:= atOj)- 1; end; 1515 tnen beginegin last := lastlast. + 1; nl inenast] .S newline .!!!!. 1406 ; f .top > 0 1516 ena-- 1401 then 1511 1408 -;;th 8stackC.top] do 1518 1409 ---sigin ch := defstrC8next); anext:% .next + 1 end 1519 { j 1410 else 1520 ( ********getparm last .!!!!!!.getl ine; ch:= inl ine(next); 1522 procedure** *. get para; 1413 ;;ext := next + 1523 1414 end 1524 1415 ~ { .5!!~ Cchi!l (c08.a, rparen]) ~ 1421 1531 begin 1422 1532 overed, atop); d:= d . 1; defstr(d]:= ch; 1423 1 leltyp <> l..alpha .!!!!!!f :s ~ 1533 if ch ::I:lparen then ctr :a ctr +, 1 1424 orsa 1534 erse if ch ::I:rpare;;-- then ctr .2 ctr - 1; 1425 gin 1535 getch- - 1426 new(f); lexstrCOJ:2 dollar; pack

dltop do 1651 ~ 1541 "hil. d >( _pim to riqbt I ---gitCh; texten:- t.xlen + 1; 1542 ~ 1652 1543 Itop I. Itop - 1; defltrCltop]:. dehtrCd]; d I. d - 1 1653 l...trU.xlen] ,. ch 1544 end 1654 until ch . star; 1545 end- 1655 g.tch; l..len I. l.xl.n + 1; l...trU..len] I. ch 1546 .!!!!!r getp8D1 I; 1656 1547 1657 until ch . r08,en; 1541 { } 1658 g.tch 1549 { gettok get a token: aet leutr. leden. lextyp I 1659 .nd { -} 1550 H****.* 1660 elM 1551 procedure g.ttot; 1661 begin 1552 1662 texten :- 0; 1553 1663 ~ ~ ch <> star ~ getch; getc~ ;: integer; a rparen; 1554 ( 1664 ~ch 1555 n", intlQ.r value ofoctal III8bK I; 1665 g.tcii 1556 1666 .nd 1557 1667 .nd- 1558 ..len :- 0; 1668 end.- 1559 "hil. l..l.n . 0 do 1669 ')Segin l..typ .. l..rplr.n; getch!!!!y 1560 be9,~~ - 1670 'S': 1561 l. ch. bra.. do g.tch; lexlen :a 1; lextyp .a: lexother; 1671 begin 1562 "..ltrC!] I. ch; - 16n g.tch; 1563 case ch of 1673 if not (ch in ['A' ._ 'ZI]) 1564 niwlini': 1674 then begin ..ror( cn..); l..l.n I. o.!!!!!. 1565 if (ttop . 0) and .0f(hhckCftop].ffil.) 1675 itii 1566 tlien l..typ I.-r..eof 1676 ~gin 1567 erii begin getch; l..l.n:. 0 end; 1677 le.typ : a le...c; 1568 'A'"';"""'8~',i'";""!', 'D', 'E', 'f',If', '&',""'"'\i','6',~', 'I', 'J', 'It','k', 'L',IL', 1678 "hile ch in ['A' .. 'I', '0' .. '9'].!!!. 1569 , '.', '0', 'pi, I", '.', 'S', 'T', 'U', 'V', 'V', 'X', 1679 begin - 1570 'Y', 'I': 1680 l..l.n :. l..l.n + 1; l.,"trCl..len] I. c~; 1571 gin 1681 g.tch 1572 getch; l..typ:- lexalpha; 1682 1573 while ch ;n CIA' .. 'Z', '0' .. '9'] ~ 1683 if~len > 10 then l..len :. 10; 1574 -,;eain- 1684 10r ; :. l..l.n +1tO 10do l...trC;] I. blri 1575 !!fiilen :- lex Len + 1; lexstr[lexten] ::8 chi get ch 1685 .na- - - 1576 .nd' 1686 .nd'- 1577 irTixlen > 10 th.n l..len 1= 10; 1687 ,'.S.g~n l..typ .. le.eq; getch~ 1578 10r i :. l..l.n +1to 10 do l...trC;] :. bl..... 1688 ,': beg n l..typ .. l ; getch ~ 1579 .rid; - - 1689 '.': 1580 'crr;-',', '2', '3', '4', '5', '6', '7', 'S', '9': 1690 begin 1581 gin 1691 getch; 1582 getch; l..typ:- lex;nt; 1692 if ch . period th.n 1583 "hil. ch in C'O' .. '9'] do 1693 b.gin l...trarT. p.riod; l..len I. 2; getch end 1584 begin - - 1694 1585 texle" :a texle" +'; lexstrClexlen]:= chi getch 1695 "~ 1586 end; 1696 b.yin { extrect strill) inclUlSiII) all CflDtM I 1587 i fCIi = lett.rb 1697 ex len :. 0; repelt 1588 Bi.n { 1698 1589 "Dilli~ n octal I 1699 over(lexlen, ..xline); text.n:. l..len + 1; 1590 g. chi nU8:- 0; 1700 texstr[lexlenJ :- chi ; 1591 for :- 1 to lex len do 1701 !!I!!!!. --If l...trID in 1702 get chi 1592 ['D""""".. '7'] ; 1593 Bi.n n.- := 8*" n.. + ord quote; 1603 ~gin gin 1713 l..typ 0= le..t 1604 getch; 1714 1605 if ch =period .!.!!!!!. pushblck 1715 "~ 1606 TIs. 1716 begin 1607 ~gin 1717 geteh; 1608 lextyp :a lexreal; lexlen.1I lexlen + 1; 1718 if ch = equat 1609 lexstrClexlen] := period; 1719 tIi.n ~ lexl.n :. 2; l...trC2] I. _Il; getc~end 1610 "hil. ch in C'O' .. '9'] do 1720 1611 -,;ea - - 1721 "~ 1612 1722 beyin 1613 l...trCle.l.n] := chi getch 1723 extyp.. lexne; unp.ek('O', lexltr, 1}, texlen:- 2; 1614 end 1724 g.tch 1615 end- 1725 1616 end.- 1726 '!~ 1611 i~ 11 lettere 1727 ~ 1618 then 1728 lextyp .. lexor; unpaek('OR', le.,tr, 1>; l..len:- 2; 1619 "Diyinyin 1729 getch 1620 extyp :11 lex real; lexlen:= lexlen + 1; 1730 1621 lexstrClexlenJ :* chi getch; 1731 '&~ 1622 if ch in [plus, .inus] then 1732 b.gin ( 1623 b.gin - 1733 lextyp := lexand: unpack 'AND', Lexstr, 1); 1624 lexlen := lexlen .. 1; lexstrClexlen].- chi 1734 LexLen .: 3; getch 1625 g.tch 1735 1626 end; 1736 ,<~ 1627 1737 begin 1628 begin 1738 getch; 1629 exle" .= lexten + 1; lustrClexlenJ .- chi 1739 if ch :: equal 1630 g.tch 1740 then 1631 .nd 1741 begin 1632 end- 1742 lex ten .: 2: lexstr(2J:= eQUal; lestyp.. text.; 1633 .nd- 1743 g.tch 1634 end;- 1744 end 1635 '+~:eginbegin lextyp ": lexadd; getch end; 1745 else lextyp -:: --rt ch :: greater 1636 '-': ~ lexsub; getch end; 1746 1637 '.1: "6ij1n Lextyp := lexaul t; get cheiict; 1747 then lextyp :: Lexdvd; getch end; b.gin 1638 "': beg'" 1748 1639 '(': 1749 lexlen ..-2; lexstrC2J:8 greater; 1640 1750 lextyp := lexne; getch 1641 get chi 1751 end 164Z if ,h 0 stir ~ lextyp lex lparen 1752 .lsel..typ := lult 1643 TI.. 1753 end'- 1644 gin 1754 ,>~ 1645 getch; 1755 b.gin 1646 if ch = dollir 1756 g.tch; 1647 Bien 1757 if ch :: equal 1648 -snin 1758 Bi.n 1649 exlen :83; unpack('(*S', lexstr, 1); 1759 ---S;in 1650 epeat 1760 exlen := 2; textyp.. te.ge; le..'trW:- l; PASCA l NEWS 117 MARCH. 1980 PAGE 38

1161 gateh 1171 vith f...etC11J do ~ f :. 'SII fntyp :. 181n!!!!!; 1762 end 1172 Wfi1if...etC12]ii !!I§ f :. '_ fntyp :. 18" 1163 .lKl..typ :. l..1It 1173 ;;m f...etC13] dO n fOO8. :. 'STRllI&Of fntyp :. fstr .' fntyp :. ftru!!!!J 1764 arJ; 1174 ifi1i f...etC14] ii n f :. 'TItIIC ); ; 1165 'I~ 1175 TIM :. 0 I 1ai£ r..ber for listing 1166 bayin 1176 pl ins :. 1 ( I8Kt.~not lUt. puc&l line Ia8Iber ); 1767 ..typ :- l.xte; \81I)8CIt('«8',L.lstr, 1); le.len .. 2; 1177 r...rit.(paoure.); reopt:. dafre; preopt:. dafpre; 1761 gateh 1171 listopt :. daflist; 1169 1179 e.propt:. daf..pr ( par_ COII8t~_iaw ); ) ; 1770 '\~ 1110 outpos :. 0 I lUt output poaition.-l 1771 bayin 1111 last Ie. :. lU80f I 1881: token type output ); n.rrors:. 0; 1772 ..typ :- lei",; unp8CIt('>-', lelstr, 1>; le.len 2; 1112 inde. ,. 0; 1m gateh '. 1113 confl :a nl.alpha, l..r..l,. l..int, l..., LI.or, l..not, l..in, 1774 1114 ll."., l..div, llX80d, l..bet, lexe.., l...nd, te.rle, t..f..., 1775 ,~ 1115 l.xproc, lelcon, l..tpe, lilY...]; 1776 ~ 1186 Unaetr :. pag.si.. I force l1eIIP8!Ieon listing ); 1m t.xty" :a le.not; 1M'J)8ck('NOT',lelstr, 1); 1117 ftop :. - 1 ( no open filetS ); _ pagesiz. ~ ~ linsetr '. .!!!! 1118 I ) 1198 ir.. linsetr :. linsetr . l 1119 procedure init ial iz.; 1199 1790 1900 1791 { } 1901 *** ** 1792 1902 I skip to a page and pcint tile heading i: integer; { """PI - 1793 1903 *-} """ 1794 1904 procedure nevpg; 1795 t ..in :- clock; 1905 1796 vith etlbC1J do 1906 ~ 1797 ~ , 1907 vr1t.ln(nevpage, title1, title1a, dte: 9, titl.'b, t..: 9); 1798 CR88e:- -'_ ; etyp .. tch; 1901 vrit.ln(_le, title2); vriteln(spac., titla3); 1799 efirst :. 1 1909 vrite(spaee, titl..); vrit.ln(title5, titla6) 1100 1910 end I I1I!IIPJI; 1101 v~tIbC2] do 1911 (iiiiipg ) 110Z 1912 ~ - ) 1103 en._ :- 'DO '; ctyp := tch; clen :- 2; 1913 I 1104 I, open - open an includ811 file efirst :. 4 1914 ) 1805 end; 1915 I 1106 vithctebC3] do 1916 procedure open ~:alfa); 1107 ~ - , 1917 1101 en._ :- 'YY ; etyp := tch; clen :- 2; 1911 1109 efirst :. 7 1919 f: flrng; 1110 end; 1920 1111 vithetlbC4] do 1921 ~ 1112 ~ , 1922 over n_ do f .. f + 1; 1114 efi rst :. 9 1924 1'fT<. ftop then error(eropen) 1115 1925 ir.. - 1116 v~tIbC5] do 1926 ~ 1117 ~ - 1927 ftop -. ftop. 1; 1111 CnM8 :- 'UTE .; ctyp :- tch; cLen :- 8; 1921 vith fstaekCftop] do 1119 efi rst :. 1 1929 begin - 1120 end; 1930 ) 1121 vit1letlbC6] do , 1931 I f2me:;.:r~ open811wit:J\_ fn8e 1122 -,;;gin en._:- 'flUE ; etyp :a tbl; cb :- true end; 1932 r...Hffile); fUns:. 0; last:. 0; n..t:. 1; 1123 vit etlbC7] do 1933 inl ineme.t] :. n...l ina; stop:. 0; ,.teh 1124 etyp .. tbl; ~gi~ en..:. 'FALSE '; eb :. fals. .!.!!!!; 1934 end 1125 v et IbCI] do 1935 end , (open- ); 1126 -,;;gin en8.:. 'MIINT ; ctyp :- tre; cr :- ulint !!!!; 1936 .!!!! 1127 1937 vi etlbC9] do ) 1121 ~gin en..:. 'II1NIIT '; etyp:. tr.; er:.. .a.int .!!!!!; 1931 I .*****.. 1129 etop :. nd.feonst I IUIber of pcldafined CCNltants ); 1939 abort on overflow I ovv - ) 1130 enlid :. nd.feonst; 1940 I 1131 1941 proeedur. ov.r I i:inl:8lJer, MX98llinl:8lJK J; tiMdat. I put _15IVYYbb-:" into catr[l. .16) J; ) 1132 I keyooord8 are in order of decr_ing frequency of 8CCe88 1942 1133 vith k.yIldC16] do n kn.. :. 'AID '; H..:' l..end .!!!!!; 1943 ~ if i >. .1.vIl ~~ .rror(.rOY.r>; .E!! 1 .!!!! 1834 WTi1ik.ylldC20]dO n. kn.. :. 'BE&IN '; H..:. l..bat .!!!!!; 1944 !!!!T -over ); 1135 WTi1ik.ylldC14]dO n kn8. :. 'CASE '; H.. -. l..els end: 1945 ) 1136 WTi1ik.yIldC10]dO n kn8. :. 'COIIST '; H..:. l..eon 1946 I ~ par_ 1137 WTi1ik.ylldC11JdO n kn.. :. 'DIV '; H..:. l..div !!!!!; 1947 I - par_ tile ~ pcogr8 1131 ) WTi1i k.yIldC21J dO kn81 :. 'PO '; kle. -. le..nd end: 1941 I ** 1139 WTi1i k.ylldC I] dO In kn8e '. 'EXTERN '; kle.:. luflld ~ 1949 procedure parse I top.emg, tok .1_ ); 1140 WTi1ik.ylldC2] dO n kn8e :. 'FORTRAI '; He. '. l..fwd.!.!!!!; 1950 1141 WTi1ik.yIldC15] dO ~in kn.. 'FORWARD '; kl..:. l.dwd .!!!!!; 1951 '. ~ 1142 WTi1ikeylldC9] dO n kn.e :. 'FUliCTlOll'; kle.:' l.d...!!!!!; 1952 gitk.y; 1143 WTi1ik.ylldC 4] dO ,n kn8e -. '!lAX '; kl.. ,. l .!.!!!!; 1953 vhile not 1154 kn_. I; 1964 'VTi1\keyvdC1SJ iO 1" := 'YAI kle.:= lexvar ~ ~ 1155 iiii :- 0; dS~::8;~ defs[sys;nc].dn_e:= 'SINCLUDE '; 1965 lexc.s: 1156 dafsCsysdefine].dn.e :. 'SDEFINE '; 1966 begin 1157 dafsCsysind..J.dn.e :. 'SINDEX '; 1967 puttok; 1153 defs[sysoption].dnMe :8 '$OPTIONS '; 1961 if tok s le.ree ~ getkey !!!.!. parse(etop, le.els) 1859 defsCsyscodtifJ.dn.., :: 'SCOOEIF '; dtop:= nsysuc; 1969 ~ 1160 atop :. .a.dafstr ( actuals in rhs of dstr ); 1970 tlxCon: 1161 vith f...etC 1] fOO8e .S fntyp fabs end; 1971 begin puttok; e.propt parseeon getkey ~!!!ii!! .n fM8e -. 'ARCTAN'US '; ": .i!. ~ !i.!! 1162 WrtIi f...etC 2] do fntyp := fatn .!!!!!; 1972 end. fntyp 1163 WrtIi f...etC 3] dO ,n fM8e :s 'CHR '; ":I: fchr .!!!!; 1973 le~: begin puttok; se_ead.r; parse(etop, ledun) .!!!!!; 1164 WTi1i f...etC 4J dO ,n fM8e .. 'cos '; fntyp ":;r:1eol ~ 1974 le..con: pars.con; 1165 WrtIi f...etC 5] dO ~:18in fM" := 'UP:I EXP: I;'; fntyp 1975 ~in fnNIlt := :. fe.p.!!!!!; lexproc: 1166 WTi1if...etC 6] dO !!!JI.l!l fOO8e := 'LEN&TH '; fntyp :- f Len!!!!!; 1976 begin puttok; seanhead.r; pars.(etop, le.proc) .!!!!!; 1167 WTi1if...etC 7] ~!!!a.i!! fM8e 's 'LN '; fntyp -a ft" end; 1977 le.ree: b~gin puttok; plrse(etop, le.typ) end 1161 WrtIi f...etC 8] do bagin fnn8e '. 'ODD '; fntyp :. fodd""'iiid' 1971 end I case - 1169 WrtIi f...etC 9] dO~ 's 'ORO '; fntyp 1979 elle"""bagin puttok; getkey.!!!!!; fnn8e yp := ford ~ 1170 WTt11 funct(10J dO b~g;n tn08e .- 'ROUND '; fnt frau tlnd; 1980 Duttok; PASCAL NEWS fIl7 MARCH, 1980 PAGE 39

1911 if u..typ . l...of) .nd (tot <> l...of) Z091 1982 t'Ii'.n ~ .rror(.rpe 1>; 1!!!!!.' ~ Z09Z 1m itii Z093 l..end) and not (tot in Cl g, lueas, l e]) :n 1 1984 ""'"'11 u..typ . 2094 :. an..t - 1915 t'li'en.rror(.rperSend)- - - Z095 1986 itii Z096 1987 ""'"'11 U..typ . l..fwd) and not (tot in Cle.proc, lufun]) Z097 1918 Z098 { } t'Ii'.n.rror(.rpersfwd); - - { 1989 if L'iXiYp <> le.Nf then getkeYi ctop:a top; cvalid:- top Z099 puttok put out a token for pucal uaing cola l~c I { -} 1990 end{ pane I; - Z100 1991 Z101 procedure puttot; 199Z { } Z10Z 1993 { panecon - pane a conatant declaration withexpression Z103 1994 { } Z104 ;: lnmg; 1995 procedure p.r.lcon; Z105 1996 Z106 1997 Z107 1 then '998 savtyp: lex; Z101 -b-:~~t.(Ps:re., { apece s be-=' toIr8n8 I; '999 I.Vstr: It mg; Z109 it.(ps:re., bl':: apece s be-=' toIr8n8 I; ZOOO savLen:- lnrn;; Z110 outpos :- outPOI + 1 ZOO1 .valid: bool.an; Z1'1 end. ZOOZ consn_ : alfa; Z11Z iiTi.typ . l..oof !!!!!!. ~ "rit.ln(psoure.); outpos:. O!!!!! z003 Z113 if.. ~ "'gin Z114 -seoin ZOO5 gethy; Z115 (outpos + l..len) > preopt ZOO6 "hil. l..typ . l...lpha ~ Z116 tlien Z117 z007 ~ p ZOO8 puttolr.; over(ctop, ...cons); ctop -a ctop + 1; Z118 n.:. pUne+ 1; "rihln(psource); outpo.:. 0; ZOO9 paCk(t,xltr, 1, consn_>; get key; Z119 if lul.n > pre opt lueq tlien lO10 if l..typ <> Z1Z0 :::a="-i n .rrort.rputtok) i l.llen:. preopt _-end Z01' t1i".n Z1Z1 .n;r;- lO1Z -,;egin Z1ZZ 1071" :. 1 to l.d.n do "rite(psoure., l.XltrCn); Z013 .rror(erparscon); ctabCctop] .ctyp :- terr; flush; Z1Z3 QUtpos:. oUtpos+ l.ar.n; lutl..:. lutyp lO14 g.t t.y Z1Z4 end lO15 end Z1Z5 !!!!!.{puttok I; Z016 .lh Z1Z6 lO17 Z1Z7 { } ~ { lO18 puttok; gett.y; "hil. eh blant do g.teh; Z1Z8 ********relate par_ SliJelpCeaion with r81. ope I ne.typ . { -} lO19 if (eh . sean .!!!!!. ~ Cle.int;-lureal, lnoth.r]) Z1Z9 **..**** ZOZO tlien Z130 proeedure r.late; lOZ1 "liigin Z131 lOZZ savstr :- l..ltr; savle".a l..len; Z13Z lOB Slvtyp :a lextyp; svaUd aa true Z133 op: lex; lOZ4 end Z134 ;: integer; lOZ5 elHlval id :- false; Z135 r: real; lOZ6 'i"ii)re.1 i on; Z136 e1, ZOZ7 if U..typ <> l n and (not typeis t.rr Z139 ~ Z030 t'li'en Z140 --.rTth; H.rtyp in nult l..n.]) typeis(Cterr]» lO31 ...,:n, Z141 "hil. .. ~ (.!!!!l ~ lO3Z .valid Z14Z ~ lOD t'Ii'.n Z143 over(ctop, -...cons); ctop:- ctop + 1; op:- lextyp; lO34 -seoin Z144 V-tkey; Irith; Z035 --riistr .. savstr: l..typ:- slvtYPi Z145 if type_ateh lO36 lex len .:8 ..v Len Z146 t1i"en 1] lO37 end Z147 --;Tth etabCetop - do Z038 elHconvrt; Z148 --C;S. etypof - lO39 p;;t'tok; l..typ:. l i; leutrC1]:. ..ai; Z149 -'tTn: - Z040 lexl.., ..'; puttolt; ctabCctop].cna8e:- consn_; Z150 be,in Z041 eval id .. etop Z151 :- ci; ctyp:- tbl; Z04Z end Z15Z cas. op of Z043 .lM Z153 -';.It:cb .. < ctabCetop].ei; Z044 ~ 2154 l.d.: eb .. <. etab[etop].ei; Z045 l..str[1] :- zero; l..str[2J:- sni; Z155 l..eq: eb :. . etabCetop].ei; Z046 lextyp :- lexst; texl.,.:- 2; puttok Z156 l..ge: eb :. >. etabCetop].ei; Z047 end Z157 l..gt: eb :. > etabCetop].ei; Z048 end;- Z158 lexM: cb -. { <> etabCetop].ei Z049 ifetabCetop] .etyp in Curr, tot] !!!!!!. etop :. etop - '; Z159 end C&8 I Z050 gett.y - Z160 ~ Z051 end Z161 tre: Z05Z Z16Z ~ r par8eCOllI; !!!Ii!!,. Z053 { Z163 :- cr; ctyp:- tbl; Z054 I Z164 eu. op of lO55 {par-. - par_ an internal c:onatant declaration with expreaion I Z165 -';.It:cb .. r < eubCetop].er; lO56 ( ..* } Z166 l.d.: eb:. r . etabCetop].er; lO59 Z169 l..gt: eb:. r > etabCetop].er; Z060 2170 r <> etabCctO(l].er l.XM:{ cb :- Z061 consn.: al fa; Z171 end C&8 Z06Z Z1n Z063 "'gin Z173 tb#l Z064 get t .1; Z174 eu. op of etab[etop].eb; Z065 "hil. l..typ l..alpha do Z175 ---redt:Cb :. eb < Z066 ~ . Z176 l..l.: eb .. eb <. etabCetop].eb; Z067 over(ctop" 8.IConS); - ctOP::I: ctop + 1; Z177 lueQ: eb .. eb . etabCetop].eb; Z068 paclt; getltey; Z178 luge: eb .. eb >. etabCetop].eb; Z069 if l..typ <> l.'.Q Z179 le.gt: eb :. eb > etabCetop].eb; ~070 t1i".n Z180 lune: eb :. eb <> etabCetop].eb .071 -oigin 2181 !!!!!.; zon error(.rparS8Con); ctabCctop].ctyp.: terr; flush; 218Z tot: begin e.p.rror tert then - Z190 case op of 2081 begin etab(etop].cn... :=consn..; eVil id := (top end 2191 --rillt;,b .. "trC,U < "trCeZ]; ZOIZ end; 21n lexle: cb .a estrCe1J 00 estrCeZ]; ZOI3 ifet8bCetop].etyp in Ct.rr, tot] th.n etop :. etop - 1; Z193 le.eq: eb :. cstrCe1J . estrCcZ]; Z084 g.tt.y - 2194 le.ge: eb .. csHCe1J >c estrCcZ]; Z0I5 end 2195 l..gt: eb .. estrCe1J > cstrCeZ]; Z086 !!!!!.{parlll8CQn I; Z196 leane: cb -. estrCe1J <> cstrCeZ] ZOI7 Z197 end { C&8 Z088 } 2198 end- ZOI9 puslmack }- push character back onto input 2199 .nd r case Z090 ZZOO else- PASCAL NEWS #17 "ARCH, 1980 PAGE 40

2201 H ctabCctOllJ.ctyp <> terr 2302 2202 Tlien.!!!li!!. e.perror(errelconf); cteb[ctOllJ.ctYP -. terr end; 2303 r.tlo: rell ( lines/1IeC ratio Ii 2203 ctOll:. ctOll- 1 2304 2204 end 2305 2205 ~ Irelate Ii 2306 i outpoS) 0 then ",.iteln(psource); 2206 2307 TT ner,.ors > a t'h"in' 2207 { } 2308 { D,,!,ln.,in - 2208 s:anheailer a:an ~ocedure or tinction heatlirq 2309 need(2); { } - ., n.rrors: 1, 2209 2310 writeln(double,, '-) there ".r. 2210 procedure scanheader; 2311 errors detect ed by .ap I); 2211 2312 ~ 2212 2313 tott.. :8 clock - ti.in; 2213 ctr: integer: 2314 if tort.e . 0 then r.tio :.0.0 / tott.,; 2214 2315 iTs. ratio :s 1CJr:RT7 l iM' 2215 begin 2316 need(2) ; { { 1_) , 2216 get key 'iJet Ii purtok get naoe Ii 2317 writeln(double,. end run: ',. line: 5, input lines,', pURe: 6 get key { 2217 'iJet paren if par_ters I; 2318 ,., . output lines,.I,. tott..: 7, . (',. r.tlo: 8: 4, 2218 if lextyp <> lexlplren then puttok 2319 lines/see) I); "S 2219 er.. - 2320 end { tenainate ); 2220 ---oigIn 2321 2221 ctr :a 1; puttok: 2322 { ) 2222 repe.t 2323 { ***.****tiMdate - get tille and dateand storein cstr 2223 getkeYi if lextyp =: lexlplren then ctr :::1:ctr + 1; 2324 { } 2224 if lextyp =-lexrparen then ctr : ctr - 1: puttok 2325 procedure***.***. ti.edate; 2225 unTIL ctr . 0 2326 2226 e..;;r-- 2327 b.gin { tille and datefrea { 'let syst8an!_ 2227 ~ 'acanbeader I; 2328 cstr[l. .16] ~,*,yyhh:88:ss I 2228 2329 { I 2229 { ..* } 2330 { global var iables tile and dte should be I 2230 { tena - ~oc:esa aU tiplication ops in expression 2331 { set to tille an! date for the listirq I 2231 { } 2332 ( 2232 procedure t.,..; 2333 ~~~~~/~IDI~~SS" cm, 1); ~..:. '*TlIIIE* 'i 2233 2334 dte := . *TODAY. . 2234 2335 .nd { tiMdate Ii 2235 op: lex; 2336 2236 { } 2337 type 2237 be,ln 2338 { .*******is - return true if type of top of stack is in set 2238 actor; 2339 { } 2239 if 2350 type.atch :- fllsl; 2250 Tlien cb :. cb .ndCtab[ctOllJ.cb 2351 with cub[ctop - 1] do 2251 eLSe - 2352 -rf ctyp . cteb[ctoii!.ctyp then 2252 ""11 (op in n..div ln80dJ> and (ctyp . tin) 2353 -if ctyp <> tch then typ;iii.tch :. true 2253 Tlien - 2354 erse If clen . ctibCCtopJ.clen then type..tch :. true { 2254 --case op of 2355 .!!!!! type_tx:h I; - 2255 li'xdiv:ci .. c; div ctlb[ctopJ.c;; 2356 2256 lex80d: c; ... c; iOG ctab[ctop].c; 2357 { } { 2257 end caee I 2358 ( ********variable - recogni... variable in expression I 2258 elSe.... 2359 ( ) 2259 ""11 (op In n lt .. l J) .nd type!s([tin, treJ> 2360 procedure******** variable; 2260 Tlien - - 2361 2261 'Di9:n, (ctyp. tin) and typeis(CtinJ> .nd (op 2362 2262 <> 2363 nne: alfa; 2263 - le.dyd) - - 2364 found: boolean; 2264 then 2365 fun: fns; 2265 -cise op of 2366 2266 -rt lt: ci := ci ctab[ctopJ.cii 2367 begin 2267 lex.in: * 2368 --;Tnot ([e.typ in n...lph., le.int, le..eal, l...U) 2268 if ctabCctopJ.cl < ci 2369 tiien1iegln e.perror(.ry.le,p)i ctabCctopJ.ctyp:. terr !!!!! 2269 then ci :. cteb[ctopJ.ci; 2370 else 2270 leXiiiX: 2371 -cise l..typ of 2271 if ctabCctopJ.cl > cl 2372 -r..lnt: beifn convrtli geneY!!!!!i 2272 tiien cl :. ctabCctopJ.ci 2373 l..r..l: begin convrtr; get key !!!!!i 2273 end r- caee I 2374 l.ut: beg,n conyrts; geney!!!y 2274 else 2375 le..lpha: 2275 begin 2376 ~ 2276 -roFcere.l; 2377 paa le.lperen 2278 lex8Ult: cr :- cr ct8b[ctop].cr; . 2379 th.n 2279 lexdvd: cr := cr / *ctab[ctop].cr; 2380 begin 2280 lex.in: ( 2381 findcon(n_e,. found); 2281 if ctabCctOQ].cr cr 2382 ; f not found then 2282 then cr := ctabCctop].cr; 2383 -will ctab[ctDPJ do 2283 lexux: 2384 begin ctyp := tOt; co:z n.e !M 2284 if ctab[ctopJ .cr > cr 2385 end 2285 then cr ) ctab[ctopJ.cr 2386 elH 2286 end r-case 2387 b.gln 2287 end 2388 Hookup(n..., fun, found) ( tinction call Ii 2288 end- 2389 if not found then e.perror(ervarfnct) 2289 else 2390 erse 2290 -rr cteb[ctopJ.ctyp <> terr 2391 b.gin 2291 tlien experror(e,.ter.typ); 2392 get key; expression;() 2292 ctop := C'i'OP- 1 2393 if lextyp lexrparen then experror(erv8rrpar) 2293 end 2394 or.e begin getkeYi .y.lfns(fun).nd 2294 else -;;=-,.0,. (ertenltyp) 2395 .nr- - 2295 end r-tena ); 2396 end- 2296 { } 2397 end- 2297 2398 .nd t case ( ) )I 2298 *terminate 2399 end ,var iable { } - ~ int statisticsandclosefiles { } i 2299 ...****. 2400 begin IIIaP 2300 procedure terlinate; 2401 1nltialize; parse(ctOl), lueofJ; 2301 2402 1: te..ln.te .!!:!!!.. ***************** PASCAL NEWS 117 MARCH, 1980 PAGE 41 ); y 1 progr..ogr.. Xreftient Msh _thod 114 wrk2wrk1); { ) 5 rev'-l by R.J.Ciche11i 16-Feb-79 115 ( include perfect hash f1.mction, r ilq data structures, ) 116 6 ) 7 { and clean up code. 117 charindx, ( ) 8 rev'-l by J.P.lt:Grath 2HIay-79 118 idlen, 9 { predefined identifier processilq ) 119 HshTbllndx: integer; 10 ( 8Ddif led ",ickaort al90ri tI8 ) 120 .apty: .U.; ( ) 11 ~ line ""ocesailq by M.Q. 'Iboq>son 121 identifier: alf.; 12 ( revi&.s by R.J.Cichelli 26-Nov-79 ) 122 CurrentL in~ber: integer {current 11M lUIber }; 13 ( strilq table ""ocessilq and work-files ) 123 LinesOnP.ge: integer (nlllber ); of linea on current poge); 14 ( Copy< iqht 1979 Pascal users Qoup ) 124 LineHosPerL ine: integer (lID. of lu..-lII8bers per line ) [ }; 15 { peraisaion to COf!f except for granted 125 HlShToble: orr.y CindexJ of word hash table { - ""ofit - (StgTblIndxJ of ch.. 16 126 StgTlble: pocked ~ ( ) 17 Purp:>lll!: 127 -- for stor ilq 10imtifiers ; 18 * 'Ibis prOlJra cross references Pa8cal ""OIJer and l~r case, identifiers and 129 FreeltellPtr: It"'tr; 20 ""OIJr_. 1""" 130 ItHent: integer; 21 1""" 131 ChrCttogory: orroy Cch..] of ChrType; y [char] integer; 22 * Authors: 132 ChrSortOrd: or'lY Cchn3 !!~ 23 N. Wirth, R.J.Cicbelli, M.Q.'lbo8peon, J.P.lt:Grath. 133 .e.ervRepresented8y, } ] integer; 24 134 PredefRepresentedlly: arroy Cchir 'A' ',' ~ 25 llethod: 135 LlStLudingCh.. , .. 26 * ()I8dratic cp>tient ha8h _thod with talJged, ~k-80rted strilq 136 ch, 27 table and perfect ba8h f1.mction r ned and predefined 137 ,..,ch, ""rd 28 identifier filte... OVerflow procesailq by 8I1lti-file _rge-sort. 138 fstch.r, 29 139 lltch.r: char; 30 De8cription of par_rs: 140 reserved: ..ray C1 _fRuervecD of .lfa; 31 * IB: PDP 11 RSX protocol. 141 predefined: or'lY C1 _fPredefndJ ~ alf.; 32 PXR - «options>] 142 Linelength: ,nteger; 33 ::. 143 call ine: LineBuffer; 34 C- capta1 iae identifiers, 1.. callen: intqer; 35 Dt- displ8)' prOlJra, 145 today, po. ch..; 36 cross reference predefined identifiers, 146 now: f~ck~ orro~1 .. 103 ~ 37 terainal output (80 001\11II8 and ids. only), 147 DutputSection: 1St,ng,' ts); \'- " 38 ..132 width of output. 148 '.geN ber: integer; 39 149 DisplayIsActi'Ye, 40 InpIt: 150 DoPredefined, 41 * P8acal PrOlJra source. 151 ter.inal, 42 152 AllCapiuls: Boole..; _ _ 43 Qltput: 153 sUte: FilStotes; .. * Listilq and references. 134 NextSUte: orroy CFi lSuus, Boolean] ~ Fi lStotes; 45 155 wrk2.ctive: Booleen; 46 Liaitati0n8: 156 wrk1, 47 * 157 wrk2: text; 48 Q8p1ter IIYBta: 158 49 * PrOlJra_ rim r Seved'lbrstemahl' s !I!C PDP 11 RSX Pascal. 159 50 'Ibis c:aopiler- (version 4.5) doesn't support prOlJr_ par_tars 160 51 in full general ity. In this ""OIJr- iDpl_tation specific 161 52 code bandIes control card crackilq and file vat lable am system 162 i: integer; 53 file .- associations. 163 IsN.rrov: 0 .. 1; 34 164 55 Installation r RSX: 165 ~ 56 166 IsNarrov :. 0; _ 57 1:1'1: I-PP /11>, TI :/SlMJPl: XRI!I' .CDL/IIP 167 if not ter.inal 58 'mSKa.. .PXR 168 tiien 59 LJ:BRo61!SRES:KJ 169 begin 60 ~1:40000 170 Pog'-ber :. Peg.-ber + 1; p_ len2 then EqlStg false = { } .. 93 Def.ultLpWidth . 132 line inter width ; 203 else { } 94 NaxLineNo :a .,x;nt 1MX,..."" 1ine rnDber ; 204 begin 95 205 d,sp :. 0; StopAt". len1 - 1; 96 206 while (disp < StopAt) and (Stghble[indx1 + dispJ -StgTableC 97 text :8 11 le of chari 207 --riidx2 + dispJ) do - 98 index =~ iiishTblSize; 208 disp := disp + 1; 99 StgTblIndx . 1 .. StgTblSize; 209 EqlStg ;' StgTII>leCindx1 + dispJ . StgTable[indx2 + dispJ 1110 .l f. .~"ked .rr.y ~1,. keylengthJ ~ ch.r; 210 end 101 ItHPtr = It..; 211 end T@qlstg ); 102 word =~ 212 103 keyincb, 213 ~ LssStg(;ndx1, len1, incb2, len2: integer): Boolean; 104 keylen: StgTblIndx; 214 105 lastptr: IteaPtr 215 106 end. 216 StopAt, 107 itell =Picked ~ 217 disp, 108 LineNu8ber: 0 .. lIIaxlineNo; 218 point: .integer; 109 next: It tr 219 110 end; 220 PASCAL NEWS 117 "ARCH, 1980 PAGE 42 221 if len1 < lonZ l!!!!!StapAt,. len1-1 .!!!! StapAt ,. lonZ- 1; 331 end. 2ZZ arll> :. 0; 332 ~COWIter :. rC_.. + 1; 223 ..IIile (StgT8ble[ind., + dispJ . StgTaI>l.[indx2 + dispJ> !!!! (dill> < 333 vrlte(out, LoopPtr. .Li'-ber: .igits, r); 224 -stapAt) do 334 LoopPtr :. LoopPtr" .nelt 225 dill> :. dTip + 1; 335 until LoopPtr . TailPtr; 226 point :- disPi 336 t.ree [irrJ } 227 ..IIile (IJIIperCase(StgTaI>le[ind.,+ dispJ) . IJIIperCau(StgTaI>le[indaZ 337 llOOrd.lastptr" .next :. frMUuPtr; frMUuPtr:. LoopPtr; 228 --rdispJ» and (dill> < StapAt) do 338 Encl..hM('. '); } 229 disp :. disj;'"+ 1; - 339 !!!!t I pdntn&8bera ; 230 if IJIIperCau(StgT8bleCind.1 + dispJ> . IJIIperCau(StgT8ble[ind.2 + 340 231 - dispJ) 341 procedure HaltRef; 232 tllen 342 233 --rrlenl . len2 343 beet'! 234 tnen 344 -rT"C8PR.fL.n > 0 235 --CSSStg :. CllrSortOrdCStgTabl.[ind., + point]] < CllrSortOrd[ 345 ilien Z36 StgT8ble[ind.2 + pointJ] 346 -,;egin 237 .1.. LuStg :. lenl < l.n2 347 C8plefle" :- 0; 238 etS;- 348 if not oof 242 352 until (infil. } . . 0) 243 I$Y+ 8fI!I88IIt 353 end- 244 354 !!!!t rnextref I; 245 procedure 'rintT8bles(!!!:. infil, out: te.t>; 355 246 356 procedure OutId(k.yptr, l,,*ey: integer; Setllpforilos: Ioole..); 247 357 248 trylnd., 358 249 trylen: integer I quick sortt81p>rarie8 }; 359 ZSO S"aoIIOrd: d { quicksort 1:IIIp>rary }; 360 251 .idpoint: integer; 361 begjl1 252 TblInd., 362 1 OUtputS.ction. idents 253 IIoveTolndl: index; 363 then 254 I: integer; 364 --,;eo in 255 Ilu8berCo...ter: integ.r; 365 (LinesOnPllle + 4) > LlnesPerPeg. 256 CllllllefPtr, 366 then ~ "1IIII.Id.r; LlnesOnPege :. 1 !!!!t 257 CllllllefLen: 367 0Tii ZS8 368 --rr LastLeldlngCller <> IJIIperC..e(StgTaI>leCkeyptrJ) 259 procedure .ulckSortlL rBoWld, IIpperBound: integer); 369 Z60 370 vritiTout,. . I>; 261 371 LlStLeldingCher :. IJIIperC..e(StgTlbleCkeyptrJ); 262 T_o..erlnd, 372 !!!!!; 263 TllpUpperlnd: integ.r; 373 for chlndl :. k.yptr tit. keyptr + lenkey - 1 J!! 2M 374 writ.(out, StgTtbletCllindlJ>; 265 375 if Setllpforllos 266 ¥.It 376 ilien 267 1IPLo...rInd :. LoverBoWld; T'plJllperlnd:. IJIIperBoWld; 377 gin 268 .idpolnt :. (TtpLOIOtrBnd+ T.plJllperlnd) div 2; 378 if lenk.y > k.yl_tll 269 tryindl :. HashT8bleC.idpointJ.k.yindl; - 379 iIi.n 270 trylen :. H..IIT8bl.C8idpointJ .k.yl.n; 380 liigi~ 271 r_at 1) «lenkey ( 381 lOr t.(out, 0 ': «'igitsP ber - - - 27Z "liliTt'e LuStg(HasllTtblICTtpLov.rBndJ.k.yindl, HlshTtbl.C 38Z keylengtll + 1» IIOd.igitsP ber»); 273 --r.:pLo...rIndJ.keyl.n, tryind., trylen) do 383 Nueb.rCounter) :. ( TllpUpper8nd; 397 lasH en: integer; 288 iTT8PlJpperlnd - Lov.rBoWld < lIpperBoW1d - TtpLoverBnd 398 289 tnen 399 290 Iii,~n 400 291 LoverBound < T8PlJpperBnd 401 292 tn.n Qui ckSort (Lov.rBoWld, T8PIJppe"-); 402 R.ftone: 8oole..; 293 LoWirBoWld :. TtpLoverlnd; 403 sivech: ch8r; 294 end 404 295 elh 405 Z96 --,;eo i n 406 ISH.n :. CtpR.fLen; Ref8oM:= false; 297 -rrT_overlnd1 T_overlnd < lIpperBound 407 pelt 298 then QuickSortlT.pLov.rBnd, UpperBoWld); 408 £!I!!!! Z99 ijjip;rBoWld :. TllpUpp.rBnd; 409 lOr t.(out, infil"); lastlen:. llstlen + 1; get l in,sPerP.g. 421 ~ 312 tit.n ~ 'ag.header; LinesOnP.ge := 1 end; 422 .nd 313 end 423 It(;-last len :- 0; 314 elsewriteln(out, .char); }; 424 WIiIT. not .olnlinfil) do g.t - 316 426 iIi.n ~ C.paefL.n :. 0; RefDon. .. true; .!!!!! 317 procedure Print"bers<.vord: word); 427 0Tii getITnfH); 318 428 1T"'i.vech <> ..then 319 429 -b.gin - 320 LOOpPtr, 430 EndLin.(savech); 321 TaHPtr: IttllPtr; 431 if not Rtfoont and ; 439 .!!!!! CO(7Jref ; 330 w,.it.Cout, . ': k'ylength + ord(OutputSection = idents»; 440 PASCAL NEWS #17 MARCH. 1980 PAGE 43 441 procedure syncron;ze<8vord: word); 551 if Displ.ylsActiv. 442 552 tlien 443 553 botin 444 done: 8oole...; 554 if LinesOnP_ >. Lln rP89. then ,."h.ader; , I); 445 555 vrite<' I, CurrentL ineflu8ber: D;,liSP.rttU8ber, 446 betin 556 LinesOnPage := linesOnPage + 1; false; 557 447 done .. end" ) 441 vith IVOrd do 558 .nd F open! ine ; 449 r,~.t - 559 450 Caple fLen 0 560 procedure Closet.. irw; 451 tnen !!Ii!!. done" :- true; OUtldCk'yindx, keylen, true); ~ 561 452 iIH 562 betin 453 -;T LssSttCC8PlefPtr, CaplefLen, keyind., keylen) 563 get ; done:~ true; end; 569 460 ...t il done: 570 h..hv.l, 461 .!!!! r-tIYI'Cl"cnia I; 571 Fst hV.l, 462 512 displa_ : 463 betin I }KintUblM I 513 N."It~r, 464 "LTiit1Onl''''L ...1OnI'... :. Li r'...; IIov.Tolnds:. 0 I Ifthen 576 i: Int.r; 461 ~in - 571 468 a: T...l.OIov.Tolnd.J :. H..hTabl.CTbUndsJ; 511 469 IIov'Tolnds :. _oTolnds + 1 579 410 end' 580 IMi!1 471 11 ~Olnds > 0 then ckSort; 581 Clt..Cnt > "-alt...) or CFrttStgPtr > StgTblLi.iU 412 IT rLi... :. CL1'Mr.ngth"'i - keyl.ngth - 1) div Digit rlluaber; S82 tlien DuapTabl..; - 413 CapI.fPtr :. FrttStgPtr + idlon; L.stL'adingcii8r":."; 583 TfFrttlt~r "nil thon CAnlttllPtr) 414 11 st.t. > invrk1 584 er.. - - 415 tlien ~ CaplofLon :. 1; N..tR.f firat reference I;!!!! 585 ~ 476 'i1"ii CapI.fLon :. 0; 586 Anlt~r :. Fr..lteaPtr; FrodttllPtr:. Anlt~r" st 471 1Tii..hTtbl.COJ.ktyinds <> 0 th.n 587 411 -for TbUnd. :. 0 to IIov.ToliiClil- 1 do 588 lt~t :. ltoaCnt + 1 419 ~ - - 589 !!!!!.I I; 480 .yncroniz.CHa.hTtbl.CTbllndsJ) ; 590 int_rs 481 'r C"'shTtb loCTbllnd.J); 591 ~ir1 I enter I 482 end' 592 ". tN."CNe"lteaPtr): h..hval:. 1; 483 IIIIHff..fL.n <> 0 do !!!ii!l CopyR.f(true); NutR.f;.!!!!!; 593 for I :. FroeStgPtr to Fr..StgPtr + Idlen -1 do 484 594 -';ashv.l :. Ch.sIIv.t'""* 17 + absCordCSttT.bl.(11) - ord('A'») !!!!! 485 595 HashTblSizo; 486 proctdur. DullpT...l..; 596 FstHtthV.l :. h..hv.l; found:. f.l.o; diapla_:. 1; 481 597 N."lteaPtr" .LI_ber :" CurrtntLI_ber; 488 598 ~ 489 599 --.rHtthTtbleCh..hv.lJ.k.yind., HtthTtbleCh..hv.lJ.k.yind.. . 0 490 600 tlien } 491 ~ 601 ~In I ... entry 492 stat. :. Nt.tStat.Cstat., COUtputStction. idents)J; 602 ound :. true; H..hTtbl.Ch..hv.lJ.k.ylndx:. FrttStgPtr; 493 ca.. .tat. of 603 HtthTtbl.th..hv.lJ.k.ylon :. Idlon; 494 -r_: 'rTri"tT...losCinputI d\a8y I, output); 604 FrttStgPtr :. FrttStgPtr + idlon; 495 i rk1: 605 HtthTtbleCh..hv.lJ.l..tptr :. N."lt~r; 496 ~ 606 Ne"ltoaPtr" .nest :. NtIIltoaPtr; 491 II r..,ritehlrk1, 'XIF1JNIC.TMP;1'" 'OPO:'); 607 end 498 'rintT...l..Cinput I d\a8y I, vrk1); 608 .lH 499 609 -,-r EqlStgCFrttStgPtr, Idlon, H..hT.bl.Ch..hvalJ.ktylndx, 500 "r~: 610 - H..hT...l.Cha.hvalJ. ktylen) 501 !!I!!l 611 then 502 0 612 tC"rk1, 'XRFUNIC.TII';1'" 'DPO:'); ~ I fOI8Id I 503 'rintT"'l..C"rk1, output); 613 found :. true; TailPtr:- hT.bl.Ch..hv.lJ.l.atptr; 504 614 IteaPtr. .ne.t :. TailPtr" .nest: 505 "r~k2: 615 T.i lPtr" .next :. Nt"ltoaPtr; 506 ~ 616 "'shTabl.Ch..hv.lJ.la.tptr :. Ne"lt~r; 501 II t<"rk1, 'XRF1JIIIC.TII';1'" 'DPO:'); 617 end 5010 rtllrit.C"rtZ, 'XRF2JIIIC.TII';1'"'DPO:'); 618 .lH 509 "rk2ativt :. true; 'rintTtbl..C"rk1, ",tZ); 619 "Digin { c:olliaiat I 510 620 .shv.l :. Ch.thv.l + diapl.c_) IIOdHathTblSiz.; 511 "r~: 621 dlapla_ :. diapla...nt + 2; - 512 ~ 622 if diSllloct8tllt> 2 . hTblSiz.then 513 0 reset(vrk2, 'XIF2J".TRP;1'" 'DPO:'); 623 ~ 514 'rintT...l.s C"rk2, output) 624 DuapTabl.s; ha.hval:. F.tH..hV.l;- 515 625 dlapla..ent :. 1; 516 "r~k1: 626 I startOftr I 517 ~ 627 end 518 0 r.set(wrk2, 'Xlf2J". TJIIP;1'" 'DPO:'); 628 end- 519 II r."rite 630 521 end 631 522 endr~ I; 632 I ac:an I 523 VOUtputS.ctlon <> Idtnts 633 / oofClnput) , 524 i1ion 634 tlien' "ritelnCtty, E8Pty Input fil..'); ~ 1;!!!!y 525 635 riVc'h~:. ,nput'; ch:. UpperC...Cinput"); 526 ~..cnt :a 0; 636 "hile not oof(input) do 527 for HShTbUndx :" 0 to H..hTblSiz. do 637 - 528 H..hT...l.tH.hTbUnCr.).k.yinds :.11; 638 ~n en&..;ne; 529 for chptr :" 1 to idl.n do 639 "hile not oolnCinput) do 530 StgTtbl.CChptrY :. StgTlbloCFroeStgPtr + chptr - 13; 640 In - 531 FrttStgPtr :. 1: 641 532 end" 642 533 !!!! F~ tabl.. I; 643 -,-r ChrCttl90ryCchJ In CucL.tter, lcLett.rJ 534 644 tlien - 535 procedure SC8n; 645 ~inbegin 536 646 ch.rinds :. 0; Idlen:. 0: Identlfl.r:" _ty; 531 l l 647 1stc"ar :- ch; 538 --rr eKit ac:an on eeL wbile pEoceaain) ~t I: 648 ~ 539 649 , charindx < k.yl~h thon S40 650 ~In -+ 1; 54' 651 , rindx;. Ghlrindx 542 652 l_iflorCch.rlnd.J :. chi 543 thon "rlt.Crtllch); getClnput); 653 end' 544 ch--:alIpperCa.. CInput'); 654 lfinCapltal. 545 655 tiion SttTtbl.CFrttSttiPtr + IdlenJ :. ell S46 6~ iIH SttTtbl.CFrttStgPtr + idlenJ :. r8IIClI; 547 procedure OponLI...; 651 men :. Idlen + 1; advance S48 658 until not (ChrCatagoryCch]in Cucl.tttr, dl,ltJ); 549 ~ 659 tiiClia;::. 1_lflerCchariiiil'xJ; 550 CurrontLi.-.a.or :. Currontlintllllaber + 1; 660 l! Idlen > ch.rindx ~ ontor PASCAL NEWS #17 "ARCH, 1980 PAGE 44 ( ) 661 -,.,.L.. 771 if ord('A') .193 .!!!!! aam:: ...lCh.rOrd :.255 662 idantifi.r <> r...r".d[e~.rind. + m erse ( . 663 - R...rvR8IIr..anu..y[f8te~.r] + m --rrord A') "65 then ( ASCII ) Ch.rOrd:. 127 664 R...rvR8IIr..entad8ynste~.r]] { perfect huh 714 or.. 1I..Ch.rOrd :. hfiUl t Ch.rOrd; 665 t~ 775 fo r-:= lIinCh.rOrdto 1I..Ch.rOrddo -,., 666 DoPradafinad .!.!!!!!. ant.r 716 b~in ChrC.tagory[Chr(U] :. otHr; ChrSortOrd[chr(U]:. 0; 667 .-r.. m 661 --rT identifi.r <> pr.dafinad[e~.rind. + m fO~ :. '0' to 19' do 669 - Pred.fRepr.sant"'y[fstehar] + 779 b4!g~n -- 670 Pred.fR.pr..ant l st e h.r]] 780 C rC.t_ry[eh] := digit; "'y[ ord( '0'); 671 .!!!!!!. enter; 781 ChrSortOrd[ehJ := 100 + ord(eh) - 672 end 782 673 .lH 783 {~d IIOrk for all PUcal ~le character .t8 -,., ChrC.tagory[eh] { 674 = digit 784 which are contjquous and for aam:: as _11. 675 tIi.n 785 In;tChrVaU'.', lit, Z); In;tChrV.U'j', Irl, 20); 676 786 InitChrVal< IS', IZ', 38); digit)-.;;d (eh { initletdjq }; 677 unt (ChrC.tagorYLCh] <> <> 'E') 787 .!!!!!. 678 II -oiid (eh <> '8') and (eh <> '.') 788 679 .ls. - - 789 g,rocedure InitP.rfect; 680 -,., eh= QUOt. 790 681 tIi.n 791 procedure InitR.served; 682 ""b;"gbeginin { strirIJBUin:) }) 792 683 793 684 unt1 (ch =quote) or eoln(;nput)i 794 ch: char; 685 f not eoln(;ftt)Ut) -then 8dv.nce 795 { } 686 aJ- - 796 ~ ~'s perfect bMh f1mctJan 687 797 ~for Pa8cal' B r_rved 1IOrd8ani 1W8ISefinBi Id8ntift.s .lH { } 688 --rT eh lCurl.yar. 798 table inIex identifier lenrJtb + = { . 689 tlien 799 r_rvr~~lidlntifier's first c:bK_J + { 690 ~in ~t 800 { r_rvr.-.tdlyUd..,tifiK'slMt c:bK_J 691 Me.; 801 for eh := '0' to '9' do R"'.rvI_..ant~[chJ :. 0; 692 whi l. eh <> rCurL.yar. do 1102 Re'S.rvRepr..ent"'y['iT] :. 11; 693 ~ - 803 Ru.rvR.pr.sentad8y['S'] :. 15; R._8IIr..antad8y['C'] 694 8dv..ce; 804 R.s.rvRepr...nt"'y['D'] :. 0; R...rvl8IIr.untad8y['E'] 695 while aoln(input) do 105 R...rvR.pr.sent"'y['F'] := 15; Re..rvl8IIr..antad8y[...] 696 - 806 Res.rvR.pr..ent...y[ ] :. 15; 697 easelt" ine; 807 Res.rvRepr.s.ntec8y['l'] :. 13; Re..rvl8IIr.unt~['J']'. O. 698 if .0Hinput) !!!!!!. ~ 1 1108 R.s.rvR.p...ant...y[.K.] := O. rvl8IIr.unt~[.L..];. 15; 699 or s. 0penL i ne 809 R.servRepr",antad8y['II'] := 1'; 700 ~ 810 Res.rvRepr.sentad8y['II'] :. t~; rvl8II..unt~[ '0'] 0; :* 0; 701 end'- 811 Ru.rvR.pr.s.ntad8y['P'] :. tJ; rvl8II t~[ '1']] :- 702 adV.,~. 812 R...rvR.pr..ant...y[...] :. '.; ...ervR8II t~[.S. :- 6; 703 end 813 R...rvR.pr..ant"'y['T']. 6; ".erv'8IIruent~[ 'U'] :- 14; :. :.6; 704 .lH 814 R...rvR.presant~["'] :. 1.; rv..pr.._~[ '.,']] 705 '-rT ch 8 1(' 815 R.s.rvR8IIr..ent"'y[ 'X'] :. 0; rv.8IIr..ant~[.'. :.13; 706 tIi.n 816 R...rvRepr.santedly['I'] :. 0; r...rved[1] :. _ty; 707 ~ 817 r...rvedt38] :. _ty; r...rvedt393:. _tYl 708 adv...ce; 818 reserved[4O] :- ..ty; {} . ( q }; 709 if ch . . 819 eh := A' prevent optiaizin) 'anI' to ISIPtY- CX1IIIIile 710 tIien *' 820 r...rved[14]:. .AIID '; r4!UrYedt29]:. 'UIA' '; 711 -,;eQin { ~t 821 r...rvedt33]:. '1E5111 .; rnerved[ 5] .. 'CASE '; 712 --.aYane.;anee; 822 reserved[1ZJ.. 'COIIST '; r...rved[1]] :. '11' '; 713 repe.t 823 reserved[2] :. 'DO .; r..erved[ 6] :.'DOIIITO .; 714 hil. eh <> 'a' ~ 824 r.serv.d[ 4] := 'ELSE '; r.served[ 3] .. 'PO '; 715 bagin 825 reservedC19J.. 'FILE '; r...rved[32] :- 'FOI ; 716 , eoln(input) 826 r...rvedt36] .. 'FIIICnOll'; ' 717 827 7] . { to uu gotoe _t to ISIPtY ); tiian r.s.rved[ :" 'SOTO 718 repa.tepa.t 828 reservedC30] .. 11f '; rnerved[28] .. '111 '; 719 Closet..iM; 829 reservedC35].. 'LABEl I; r...rved[18]:. ._ '., 720 if eof(input) th.n ~ 1 830 reservttdC31J.. 'IlL '; r...rved[22J:. '110' '; 721 il.. 0penLine - 831 reserved[17J :a 'OF '; 722 unTIrnot eoln(input) 832 { if otbenri. becc8e8re8n8d tbenflU8b luttile IWKt. 723 . else adviM. 833 r...rved[ 9] := OTHERlilSE' ) ; 724 ~ 834 { anticipatin:)tile r...i8d 8t8Idard 725 edv8r'lce 835 r...rvedt16] .. .; 1)1; 'OR '; r...rved[21J:.'PACXEI 726 til ch 2 836 r",.rved[24] :. 'PiOCEDUlE'; r...rvedt37J'. 'PiGUM .; 127 iidYiiice 837 r...rved[2Q] .. 'RECORD'; rnervedt26]:. 'Hl'£AT '; 128 end 838 r...rved[15] .. 'SET '; r...rvedt23]:. .THEIl , m enct- 839 r",.rvad[ 8] .. 'TO '; r...rved[1OJ:. 'TYPE ".; 730 840 r.serv.dt34] := '\llTIL '; ..s dt27J:. "A. .., 131 end; r...rved[25]:. .; 841 r",.rved[11J{ := 'IIIIILE) '; '''ITH 732 CLOsiLi... 842 .!!!!! initr_rved ; 733 843 { end' 134 1: scan on eat while processin:) ~t 844 proeedur. InitSUU.; ~{ ); 135 .!!!!!. 845 136 846 ~ 737 {$Y+ ... II8IJ8IIt 847 NextState[inout, t ] := inout; 138 848 N..tState[inout, f.lse] :. i rt1; 739 procedure initi.liz.; 849 lIe.tStat.[i rk1, tru.] :. wrk1out; 740 850 lIe.tStat.[;nwrk1, f.l..] :. wrt1..rkl; 741 procedure InitL.tDig; 851 N..tSt.te[wrt1out, t ] :. wrt1out; 742 852 1I..tState[wrk1out, f.lse] :. wrk1out; 743 canst 853 NextSt.u[wrk1wrk2, trU4!] :. wrklout; 744 0; ~h.rOrd{ = 854 N..tState[wrk1wrk2, fils.] :. writ2wrk1; 745 ordinal of 8in__ character 8~5 NextStateCwrk2out, true] := vrt2out; 746 D.faultll..Ch.rOrd 64; 856 NextSt.teCwrk2out, false] :s vrt2out; ( = 747 BCD =64 . ASCII . 127 . meDIC. 2~~ 857 NextStateCvrk2wrk1, true] := vrk1out; 748 858 NextStateCwrkZvrk1, false] :- vrk1vrk2; stlte.. inouti { 749 8~9 end ini tstates ); 750 i, 860 ) 751 ltaxCharOrd: integer; 861 ($Y+ new seg8!nt 752 ch: char; 862 753 863 procedure InitPr~efined; 754 procedure InitChrVIIlCStartChar, endchar: chari aval: integer); 864 755 865 756 866 ch: ch.r; 757 leChar, 867 758 ucChar: char; 868 b.gin 759 0; 869 for eh := '0' to '9' do Pr_fl4!Pr..antad8y[eh] :" 760 ~ 870 Pr.d.fR.presant"'y['AT) := 15; Pr_fR.pr",ant"'y['S'] :- 9; 7(11 lc[hlr ;= StenChlr 871 Pr_fR.pr..entec8yC'C'] := 11; ~ .!.!!. endcher ~ 762 bagin 8n Pr.d.fR.pr...nt"'y['O'] := 19; Pr_fR.pr..ant "'yC'E'] ] :- 5; 763 ---a;rC.tagoryneCh.r] := leL.tt.r; 813 Pr.d.fR4!pr.sent"'y['F'] := 3; Pr_fR.pr.sant"'y['" :. 0; 764 ChrSortOrdtleCh.r] := .v.l; ueC~.r:= Upp.rCas.HeCh.r); 874 Pr.d.fR.pr..ant...y[ ] := 0; Pr_fR.pr..ant .] :- 3; 765 "'y[' I ChrC.t_ry[ueCh.r] := ueL.tt.r; 87~ Pred.fRepr.sant"'y['J'] :. 0; Pr_fRep...ant ad8y[ 'K'] :- 16; 766 ChrSottOrdCucChar] .= .val - 1; .val:= .val + 2; 876 PradefR.pres.nt"'y['L'] := 13; Pr_fR.pr",ant"'y[ '11'] :. 1; 767 end 871 Pr_fR.pr..ant...y[.O. ] }; Pred.fR.pr.sant"'y['II'] :. 19; :- 0; 768 .!!!!t linitr:hrval 878 PradefRepr",antad8y['P'] :. 18; Pr_fR.pr.sant ...y["'] :- 0; 769 879 Pred.fR.pr..ant~[.R'] :. 0; ] ( jq ) Pr_fR.pr",antad8y['S' :- 15; 770 !!!I!!!. ini tletd 880 Pr.dafR.pr.sant"'y['T'] :- 0; Pr_fR.pr.sent~['U'] ;.17; PASCAL NEWS 117 MARCH, 1980 PAGE 45 {} 88t Predef.epr t-,.C J :. 0; Predef.epresent_yC 'II' J :- 10; 991 end- Predef..pr...nt-,.C' 'V'J :. 0; Predef.epres...t_yC'Y'J 992 = 882 X' :- 0; () ( 813 Prod.f..pr t-,.C' Z'J :. 0; predefinedCU:. _ty; 993 if i <. 32 th... c:cnUIin8 file_ part 884 predefinedC 2J :. _ty; predefinedC 3J :. ellllty; 994 (I {} 885 predefinedC42J :. _ty; pr.definedC43J :. _ty; 995 J :- 1; ) 886 predefinodC44J :. _ty; pr.definedC45J :. _ty; 996 II while ord(1IpecCi) ord(' ') !!!!. 881 pr.definedC46J :. _ty; predefinedC41J :. _ty; 991 (I bet,n predefinedC48J :. _ty; 998 (} n8CjJ :. 1IpecC;]; ... { j 889{} ch :. prevent optiaizing to ~ile bug }; 999 (I i :- i + 1; j:- + 1; 'A' 'ab8' ""Pty - (i ) (j 18) then 2; 890 pr.definedC33J :. 'AIlS '; 1000 II if 32) or > ~ 891 predefinedC40J :. 'A.CTAN '; 1001 {} ~ 892 predefinodC35J .. 'BOOlEAN'; 1002 112: - - 893 predefinedC15J .. 'CHAR '; 1003 (} 894 pr.definodC14J .. 'CHR '; 1004 (} 895 predefinedC29J .S 'COS '; 1005 896 pr.definedC3U .. 'DISPOSE '; 1006 891 pr.d.finedC1U := 'EOF '; 1001 898 pr.definedC28J.. 'EOlN '; 1008 II procedure reeset (.!!!. f: text; !!!:. fspec: Fi lell._,); 899 prod.finedC26J .s 'EXP '; 1009 900 pred.finedC13J .. 'FALSE '; prod.finedC3J :. '6ET 1010 {} var 901 pred.fined( 8J .. 'INPUT '; pr.d.finedC10J :. 'INTE6ER 1011 {I dev:devs; dir: dir.; 902 pr.definedC34J .= 'IN '; predefinedC1] := 'MXlNT 1012 {} 903 pr.definedC32J .S 'NEil '; , 1013 !!!i.!!!. 904 predefinedC22J.. 'ORD '; predefinedC6J :. OUTPUT ,-, 1014 {} SplitFil.Specification (1Ipec, cIav, dir, n_); 905 pr8definedC38J.. 'PACK '; 1015 {} reset (1, n_, dir, dev'); 906 pr8definedC21J.. 'PA&E '; 1016 II end. 901 pr8definedC4U-. 'PRO '; 1011 = 908 pr8definedC21J:. 'PUT '; 1018 909 pr8definedCZSJ:. '.UD '; 1019 910 pr8definedC25J:. 'READlN '; 1020 ,; {} 911 pr8definedCl1J:. '.EAl '; predefinedC5J :. 'RESET 1021 procedure r rit. (!.!!. f: text; !.!!. f_o: FH ); 912 pr8definedC12J .. 'REIIRITE '; 1022 913 pr8definedC24J :. 'ROUND '; 1023 II var 914 {} pr8definedC31J :. 'SIN 1024 ""d'ev:devl; dir: diro; , 915 pr8definedC18J :. >,: 1025 'SQR {} 916 pr8definedC19J .. 'SQRT '; , 1026 beliin 911 pr8definedC30J .. 'SUCC '; predefinodC4J :. 'TEXT ;, 1021 II -""'SjintFil.Specification (fspec, cIav, dir, naa); 918 pr8definedC 9J :. 'TRUE '; predefinedC16J :. 'TRUNC ; 1028 {} rewrite (1, n., dir, dew); 919 predefinedC39J .. 'UNPACK '; 1029 II !!!Y 920 pr8definedC2OJ.. 'illITE '; 1030 921 pr8definedC36J .. 'IIIITElN '; 1031 {} procedure 6C"'(var line: linelluff.r; var Len: int...r); { }; {} 922 !!!!!. 1n1t:p<"edefirBI 1032 e.tern { reGn ~ linein.r _ }; 923 1033 924 I$!+ ... seg8nt } 1034 {} 925 1035 { } 926 betin 1n1tporfect 1036 II , 921 -y;;;tn t.es od; InitSt.tes;InitStlte.; InitPredefined; 1031 {} ~ wr1t.ln(tty, Erroro in C~ line'); { }; 928 !!!!!. 1n1tporfect 1038 II for calptr :. 1 to call... do write(tty, call ine[c8lptrJ); 929 1039 II 'iirTt.ln(tty); , 'ilrit.ln(tt'YT; 930 (} procedure Comectfi les; 1040 II writeln(tty, . C] '); 931 1041 {} writ.ln(tty, : :-'); 932(} conat 1042 {} writeln(tty, C- capitaliz. Identifi.ro, '); 933 (} fJP'ecl_ =32; 1043 {} writeln(tty, D+ display progr8,'); 934 1044 {} writeln(tty, P- Croll r.f prod.fined in.,'); 935 {} 1045 II writeln(tty, T- t.nslnal output (ids. only),'); 936{} fll>.c. =~ C1 .. FSpecl.ngJ ~ char; 1046 II writeln(tty, 11=132width of output. '); writeln(tty); 931 {} Fil.Specs = array C1 .. 2J ~ topec.; 1041 {} writeln(tty); writ.ln(tty,' HAlT'); hIlt 938{} .xt.n.ion packed C1 4J char; 1048 II { CJI1t }; (} . ~ .. ~ !!!!!. 939 Fi leN..el .~ ~2J of ch.r; 1049 940(} {} deVi .~ C1 .. 5J orchar; 1050 di rl . array C1 9J Of char; 1051 ~J B n... .~ C1 1810f char; 1052 II be,~n 943 1053 II , t" calptr)8 c8ll... t~... quit; calptr :. calptr + 1; 944{} 1054 II calCh := c8llineCcalptrr- {} { }; 945 f_o: Fil.Specl; 1055 II !!!! na~ 946(} H...: 0 .. FSpecl.ng; 1056 941 (} eelptr: 1 .. 80; 1051 {} 948{} CalCh, 1058 {} 949 {} ClldCh: char; 1059 9SO(} DotFouncl: BoolI""; 1060 II 951 (} POI: integer; 1061 952 1062 II 953 1063 II rflen >a FSpecL_ thin quit; 954 1064 {} fl... :. H... + 1; 955 (} procedure $plitFi l.Specification (f_c: Filell_.; 1065 II 956(} ~ dew: devs;!!!. dir: dirs;!!!. n_: "_s); 1066 II 951 (} 2; 1061 (} { 958 1068 betin getfspec I , , 959 {} var 1069 (} f'ijiecClnputOUtputJspecClnputOUtputJ :. ; 960(} ,: 1 .. 33; j: 1 .. 19; 1010 II flen :- 1; DotFound :- fals,; 961 1011 II whiLe C.lCh in ['A' (} {} .. 'I', '0' ... '9', ':', '[', ']', '.', ',', 962 betin , 1012 ---r;'] do - 963{} y :a . ; , 1013 II .i! CIlCh. 'C' then rep.lt getn.xt; !!!ill CalCh . ']' 964 (} n_ :_ I ; 1014 {} .lse 965 1015 II {} be,~n, 966{} for i := 1 to 32 do 1016 not DotFound 1!!!!!. OotFoWld :a CalCh . '.'; ,etnext; 961 {} - i1 fsp.cri] >.'.' then 1011 {I end"""';"-) 968{} -fll>ecC;] :. CHR(GraThpecC;]) - 4011); 1018 {I if do "xtClaCh; w~iL. CalC~ ; ; . do tCllICb; 910{} :a + 1; - 1090 {I ' 981 {} end 1091 II if Hen 1 (} = 9IZ{) ilst i :. 1; 1m , 913 1093 II ..xtCllCh;llCh; wbH. CalCh. . . do.. N.xtClaCh; { } {} ..n. ' 984{} if topecCi) . 'C'~ cmtains a directory part 1094 geUspec(2,'~" ':m'"J; ~'" - "~"~" 985(} beti,:, 1095 {I if fl... . 1 , 986{} :& 1; 1096 (} {} J {} t1ien begin "rit.ln(tty, No Input Fil. Specifiod'); quit; ~ 981 .!!2!!!. 1091 t<,nput, f_cC2]); r rit.(output, f_CU); 988(} ---a;rcj] :a f_cCi); 1098 {} wltil. «eelptr callen) and (CalCh do tCllIClt; ; ; j {} < <> 'C'» 989{} :- + 1; j:- + 1; 1099 11'"&"lO (i 32) (j 9) . 'C' - - 990(} !!!ill > ~ > ~ (dirCj-1J . 'J'); 1100 II thin PASCA L NEWS #17 MARCH, 1980 PAGE 46 , at 1101 {I 1130 g ~ linel.ength :- hfllUltlO'l1dtlt; 1102 II "'IiiXtCllICh; I) 1131 1103 II ..hil. (CalCh :I:I 1132 {J {} ') or (CalCh . do "'xtCllICh; ~- 1104 1TC'ilCh in ('C', to""; " 1133 [) "', 'T', '''']- g 1105 n - 1134 { untir?ICh 8 'J'; ) 1106 !) 1135 J .!!2 r--ccmoctfil.. ; --oil~Ch :. CalCh; MedClaCh; 1101 {)!! ~Ch :- CatCh; NedCl.Ch; 1136 1108 cue C8dCh of 1131 ( ) {j ~ initial be 1109 --"TC': AllCiiitals :s CalCh z '.'; 1138 Currentl inelluM»er:* 0; P,getrlu8ber:8 0; 1110 \) '0': DisplayIsActive :a CalCh z '+'; 1139 Lines0nP8Ie :- LinesPerP,ge; ALlCapitals:* false; 1111 !} OoPredefined CalCh .. "': :" '+'; 11.0 DispllyIsActi..,e :* true; DoPr.oefined:- false; FreeStgPtr:- 1; 1112 I) fT' : 11.1 1113 [) begingin [) 11.2 :~~e~~=~ ~:ffi 80 do ,.llin.CIt..Cnt]:- '; c.llen:- 0; 111. ter.inal :a CalCh := '+'; 11.3 liiiICnt :- 0; tminar:- false; fllPty:-' 1115 !) if U,..;nal 11" for HshTbLIndx :- 0 to HashTblShe - 1 do 1116 II then L;n.length :z Oehul tTerilinaLVidth; 11.5 HashTabl.CHshTbllnCiiJ.keyindx :- 0; - 1117 !) iTSj)layIsActive := ~ teMlin.l; 11.6 InitLetDio; InitPerfect; LineLength:- DefaultLQ"idth; 1118 !) end; 1141 today :- 18Pty; now:- e8pty; {J 1119 !) 'V': 1148 Connect Files; date(today); tiH(now); 1120 iJ 11.9 vrkZactive :- false; 1121 [) b.y~n(C.lCh 8: I:') or (CalCh:ll: ',.') { () !!!..!!!. NutCl8Ch; 1150 end initiali... J; 1122 uneLength 0; - 1151 := ) 1123 iJ ..hile CalCh in u [$Y+ new [) ('0' 19') do 1152 t 112. Mg;n - - 1153 "'"I 1125 !} UneLength :z Line-length ( [) 10 + ordCCalCh) - ord 1134 begin nef J 1126 ('0'); * 1155 writeln(tty, CrossRet (80.2.1)'); initialize; '- 1121 I) MutClaCh; 1156 OutputSection :- listing; Ican; OutputS.ction:- ideml; , 1128 i) end; 1151 DI.8t)Tables; "riteln(Uy,'- End Crouaef'); IIIriteln

1 {8 Pur_, 84 if unrtQ then lurch := 0 .!!.!!. search :. i; 2 Library routines for str il1:J manip.1J.ation. 85 end=" - 3 86 ~ rsearch r; . . AutnoC': 81 5 Barry SIIith 88 procedu,.. rudstring(.!!!. f: text; !!!. 5: string); '- 6 s.len + 1 then Ipan :- s.len .. start + 1; 33 --str'ingal. - 100; 116 11 span <111a then deadt) - 34 117 irse - 35 !ZI!! 118 -sioin 36 string - record 119 ~ or ; , to SJ)8nsJ)8ndo t.chCiJ :- l.chCstart + i 1]; 31 ---r;;;: 0 u It r i ngux; :* - 120 1O'r i :- sPi" + 1 tostringHx do t.chC;] :111I '; 38 ch: packed array (1 .. stringu;d ~ char 121 ~en:- s~n; - - 39 end. 122 end. 40 ==- }; 123 !!!2 T'"sub8tr in.! .1 l s.len + 1 then li.it :- s.len+' 1; 52 135 Sian :- li.it .. start; - 53 ~ concatenat. 0 34 131 ihen 55 ... 138 56 j: integer; -,;;,~~ ; 139 :z 0 to I.len - Li.it do 51 '" 140 s.ch(start+ i] :11:s.chCl i8it + iJ; 58 begin ) 141 span + 1 to s.len do l.chC;] :- 59 str;... for" := s~len - ': -"-s.len j + t~len } 142 s:Ten := s.Len - span; - - ' 60 tien :~ str;ng8I" ... s.Len i overflow 143 end. 61 irii j :- t.len;j !!!!! n1ete I; 62 10ri :1111 to do s.ch(s.len + iJ := t .chen; s~Len + j,; '"145 63 ...err o:n:abNte 1; 146 64 141 65 search(l, t: string; sUrt: integer): integer; ~ 148 !.!!: 66 149 i, j: integer; 61 .a. 150 68 "1, j: 0 .. string..x; 151 gin 69 ~q: boolean; 152 if t.Len > 0 10 153 then (p 11 begin (D 0) 1) 15. --rr > and <= s.len + 12 ---n-start < 1 then start := 1; 155 then - 13 + t.lin">'" I.len + 1> 2.!.. '"h[; j :-pD + t.Len - 'epe~t (j t - 13; 16Z Tiiri :s to J ~o s.eh[;] :s t.eh[; 111 - 0 . 1]; 80 unt1 uneq or t. 163 eno -- 81 len); - } (i 164 else{ oon-contiguous strin.! 82 I,8'ttil (not uneq) or 165 83 Len tMn + 1);- = s. *****************- 166 PASCAL NEWS #17 MARCH, 1980 PAGE 47 1 {. puqoee: 111 ~ 2 Progra a.pJtes _1 f ,tiona of the fint and second 112 v.re := u.re .. lI.re; lII.i.:- u.i. + v.i. { }; 3 .inds for an integrel ceder and caopla: arglDel'lt. 113 .!!!! add 4 114 5 . Author: 115 6 O.M. '!'ran. SclXlOl of Electrical !njineering. I..hiversity of New 116 7 South iiales. 117 8 118 ~ 9 . Method: 119 >I.rl; '.re{ := y.re}; - '.i.:* u.i. - v.i. 10 Hankel flA'lCtions of a required order are calculated frOll 120 .!!!!!. sub 11 corresponding Bessel flmctions of the first and second .inds. 121 12 A backwrd recursive sch8e is used in C<8IpUting Bessel flmction 122 13 of the first .ind for a III.IIIberof orders. 123 8ult(l: rell; z: cOIIPlex; :!.!!. III: cOIIPlex); 14 '!hese are then ..- to <}ive the two orders a and 1 of 124 ~ ies a real wi th a caopla: 1 15 Bessel flA'lCtion of the second .ind, which in turn serve as 125 16 starting point for finding a higher-<>rder Bessel flmction of 126 begin 17 the second kind. 127 liI.re::i(a z.re; w.;. z.i. . { }; -=. 18 128 .!!!! 81l t * * 19 Description of par_ters: 129 p p 20 - integral order, -.here ~ <- <- max arx:II8U :8 500. 130 21 Z - CC8pla: arg.-nt. 131 procedure product(u, v: cCJ8t)lex; ~ III: cOIIplex); 22 fnl - Hankel flmction of the: irst kind. 132 23 fn2 - Hankel flmction of the second .ind. 133 begin 24 134 w.re := (u.re v.re) (u.i. v.i.); 25 InpIt: 135 v.i. := (u.,.e .* v.i.) + (u.i. *. v.,..) · (p) { }; 26 Progra reada in an integer and two real IIt.8Ibers (real and 136 .!!!!!. product 21 i88ginary parts of z). 131 28 138 1 QJtput: 29 . 139 procedure quotient(u, v: cOIIPl..; .!!!. II: cOIIpl..); 30 kg ts aod values of the !lllnkel fImCt:i0n8 of the first 140 31 ..., 88COIIdkinds are returl8l. 141 var 32 IlU:ning8eS8Iqe is <}ivenif ant par_ter a:ceeds specified 142 vr, vi, I, b, .1, x2, y1, 12, root: rl.l; 33 liaits or is outside range. 143 34 144 begin 35 · Liaitsticn8: 145 vr :- abs(v.,..); vi:- abs(v.i.); 36 -500 <-p<-SOO, 146 ,.oot :- sqrt(2.0) sQrt(vr) IQrt(vi); .:a vr + vi + root; 31 1.08-5 <- .au.. of z <- 317.0. 147 b :a vr + v; root;* * (a 0.0) - (b 0.0) 38 ~inary part of z <- 50.0 . 148 .if . ~ . .!!!!!. 39 p _t not be IIJCbgreater than the .auus of z. otherwise 149 llegi!1 40 expII8It erroc in the caop.Iter (PIP 11/10) will occur. 150 --;;;:Tteln( 'V: dividing by 0 in procedure quotient'); 41 151 stop { Exitto t:erIIinate progr_ }; 42 · 0:IIp1ter 8Y8ta: 152 end' 43 Progr_ _ run 1mdertllIXI'Uc:al(Berkeley- version 1.2. 153 x1~ U."I I I; .2 :- v.r. I b; y1:- u.i. I a; 1979) an II!IC_ 154 y2 12; 44 ","y 11/10. :- v.i. I b; v.r. :- .'\. ~ x2 + y1 * 45 155 v.i. :a x2. y1 .1 . y2 46 JlcCUrlll::Y: 156 { quotient }; · .!!!! 41 0:8put8IS r..,). ts wre checked against pjllished values over the 151 41 following r811J't8: 158 49 p 159 ((OI(Z: cOllPl.x; c: cOIIPlI.); - 100 <- <- 100 and ~r~edur. } .!.!!:. 50 real arg\8I!IIt z - 0.1 - 100.0 . 160 1.. of a CC8ples 51 -l<-p<-land 161 52 CXIIplesarg\8I!IIt z (0.01.5 0.0) then 74 1, It, n, ., l, p: int...r; 184 -~ - - 75 I, u, v, w, yo, y1, y2: cQ8PLe.; 185 v.re :a 88g(U); v.i.:a p; I 2.0 16 1"1, fnZ, 1"-, esU8, 01", no,.., zero: c08Plex; 186 end 11 f: array [0 .. lia)!.!. coaple.; 181 else 18 188 tiegin 19 189 v.r. :- 88g(U); V.;8:- .rct8ft(u.i. I u.re) 10 Drocedur. Itop; 190 end 81 191 .!!!! ,polar I; 82 192 ~ { 83 ~ 1 halt 1 193 84 end~ atop I; 194 )rOCedure cln(%: cOllPlex; var c: cOIIple.)i 85 195 Rlltural logarith8 of a ca;;ples } 86 196 81 procedure crl8d(.!!!. z: cOIIplex); 191 !!!. 88 198 p: cOIIPl..; 89 begin 199 90 reed(z.r., z. ia) 200 1I; 219 !!!!! order}; - 110 220 I PASCAL NEWS fl17 MARCH, 1980 PAGE 48

221 291 for; 1 to k do adcHs.., fe2 iJ, s..); 8Ult(2.0, s.., ...); s;gn(u: coltplex; vir :' 222 ~rOCedure 'I: cOIIC)lex>; 292 add(s.., 1(0!, nor.) * 223 cnanges the sign of a I 293 end """"Tex 224 294 else- 225 begin 295 begin ; 226 v.re := - u.re; v.i... - u.i. 296 for : 1 to k do ( ); = 227 .!!!! sign 297 b.?~n - - 228 298 1 oddU) then Idd(os.., fe2 iJ, os..> 229 299 else sdd(es.;l,fe2 iJ, u..) * 230 ~rocttdure check(z: c08pll.); 300 ener--- * 231 QleckS to see if the ftmction arq\llll!nt is outside range 301 SU~U8, as.., ,..>; -..U (2.0, '&8, Ita); 232 302 add(s..., f[O], 5">; ceos(z, u); quotient(s..., u, nOnl) 233 ~ 303 234 I, b: real; 304 fO~:= 0 to . do { }; 235 305 quotient(f[iJ,nor., feiJ) Bessel Mctions of 1st kind 236 306 zero; os...:= zero; l:- 1; ~ IS'" :* 237 I :- ml(z.r.}; b:= abs(z.,.); 307 if n 8: 0 238 if «e < 1.0E 5) end (b 308 then - < 1.OE- 5» or ( 239 - «b <> 0.0) end 11)< 1.0E - 5» then- 309 beyin 110 I 240 310 or i := 1 to k do ~ - - I); 241 "nt.C''': S8all .rg{ nt which eMlses exponent error :8 311 bey;" - - 242 cllrite(z); stop Exitto teDiinate pt"ogr_ I; 312 :a - 1; .ult; 245 -begin - 315 u.r. := u.r. + euler; product(u, 1[0], u)i sub(u, 'SUI, u); 246 "rHe(',,: argua.nt {with ;.'91n.ry part outsid. range:: '); 316 .ultlIJ!!S 323 { 2S4 fur.ctions I 324 end 110 I 255 325 else- ( ) 256 326 be,in 1m, wnete n <> 0 ~ wr:-r. 257 :- u.r. - v.i.; 11I1.1.:= u.i. + v.re; 327 or i :8 1 to k do 258 ,,2.r. :- u.r. + v.i.; ..2.i.:= u.i. - v.r. 328 begin - - { 1], u); 8(Id(eIUl, u, .,UI); 259 .!!!! banke1l2 I; 329 l :8 - 1; aultU I i, f[2 260 330 n, fe2 i + n,* v); 8Ult. lis then 334 u.re :11 u.re + euler; product(u, f[O], v); sub('l, eS18, v); 265 -~ - 335 .ulHtpi, v, yo) ( Yo I; productUte1111, e n <> 0,1 I 270 cri'iif(z) ; 340 begin 211 CMcHz) { If z is outside tange, exit to teClinete pt"ogt_ I; 341 Quotient(y1, z, u); 8Ult(2 i, u, u); sub(u, yo, y2); 212 . :08order(z); 342 yo :8 y1; y1:8 y2; i:- *i + 1; 273 if . )a li. then 343 end { POrward tecursion I; f[;] .S zero; 274 -~ - 344 i1.< .ax then for i :- 8 + 1 .!! .ax !!! 275 wr1telnC'W: starting order I, 8: 6, 345 hankel12(fenJ~, rnr, fl\2); 276 . 346 if (p 0) odd(p) then IKeMds( the specified ..x; ', ..x: 4); < and 277 stop Exit to teClinete pt"ogr_ I; 347 -begin - - 278 ~ 348 _sign(fn1, fn1); sign(fl\2, fl\2) 279 zero.r. :* 0.0; zero. i. :s 0.0; SU8:a zero; fS...::a zero; 349 ~; 280 :- zero; fCe + 1] :- zero; fCe)..r.:a: 1.0. - 30; 350 "nt.ln; writeln; write<' Function .rgU8ent at); 281 0'"fe.J.i. :. 0.0; 351 cwrit.(z); wri teln; ; 282 for :- 8 dc*nto 1 do 352 "rite( . Henkel function of the first kind end order', p: 4, 283 -segin - - 353 . a'); 284 quotient(fCi], z, III); 8Ult(2.0. i, w, w); 354 c:write(fn1); writeln; 285 sub(w, 1(i + 1], 1(; IJ) 355 write( I Hankel f1l\ction of t~e second kind and order', p: 4, - I I); 286 356 = 287 k ~~; div 2; ) 357 cwrite(fnZ); writeln; writeln; 288 if abs(ue) 10.0 abs(z. i.> 358 ~ {Hn}; 289 IT," * 359 1: 290 begin 360 end { Hankel I. PASCAL NEWS 1#17 HARCH, 1980 PAGE 49

{ 1 111 ~ltipli88 a real witha caopl_ I Z 112 3 113 begin 114 v.r. :- a I.re; w.i. :- 1 z. i. 4 { * 5 Author: 115 ~ 81lt I;* 6 * Q.It. Tran, School of Electrical lhgiMering, tbiver.ity of 116 7 New South iiaJ.es. 117 8 118 9 ""thod: 119 10 * B8ckwrd recurrence equation is eIIPloyed to CCIIP1te the fmction, 120 vir vr, vi, I, b, .1, x2, y1, y2, root: re8l; 11 starting at a higher order for "'ich the Be_I fmction has a 121 1Z "",all value. The .tarting order i. calculated ing an 122 13 eoopirical foDlUla. II1en the fmction arq.-.t i. mainly real, 123 b.gin 14 norllalization i. to mity. If it i. aainly iaaginary, 124 vr :- abs(v.r.); vi:= abs(v.;.); 15 norllalization invol cosine of the caopl_ arq.-.t. 125 root :- sqrt(2.0) sqrt(vr) sqrt(y;); 1:- vr + vi + root; * 16 126 b :* vr + vi - root;* 17 Description of par_ters: 127 if (a 0.0) or (b 0.0) then * p p _ and_ 18 integral order, .tIere _ <- <- - 500 128 -b.gin" - " - - caopl_ arq.-.t. w.,t.ln( dividing by a in procedure quot ient'); 19 z - 129 { 'II: ZO fn - Beuel fmction of z and order p. 130 stop Exitsto terllinate progra ); Z1 131 end; ZZ InpIt: 132 x1:= u.re I I; x2:a v.rl I b; 11:- u.i. I a; Z3 * Progra read. in an integer (pI and two real !ll8ber. 133 y2 v.i. I bi v.re:2 x1 x2 + 11 y2; :* * Z4 (real and iaaginary parts of zl. 134 v. i. := x2 y1 .1 12 * { * Z5 135 ~ "",tient I; * Z6 Q,tput: 136 27 * Ar9.-.t , value of the Ile8ael fmction of the fir.t kind 137 28 are returlBl. IiIrning Ilell8aile is gi if any par_ter 138 ~rOCedure ccos(z: cOIIPlexi !!!. c: cQ8plu)i 29 exceeds specified li11its or is outside ran;le. 139 COsme of a CCIIIPlexI 30 140 31 LiJlitati0n8: p 141 :!!!.. 32 - 500 <- <- 500, 142 ep, e., p, .: real; 33 1.0e-5 <- 8XIul of z <- 377.0, 143 34 Iaaqinary part of z <- 50.0. 144 b.gin 35 145 ep :11\exp(l.i.); HI := 1.0 I ePi p:-.p + H; .:-.. - IPi 36 Q8p.1ter systa: 146 c.r. := 0.5 p cos(z.re); c.i.:- 0.5 . * sin(z.f.) 37 Progra was run mder tilIX Pascal (Ber ley - Version 1.2, 147 ~ { CCC8 I; * * * 38 May, 1979) on !EC POP 11170. 148 39 149 40 kcuracy: 150 function order(l: c08Plex): integer; 41 * Q8p.1ted reSlll ts were checked against pblisbed values over 151 { Gives a starting and even order for recursive CCIIPltation I 42' the following ran;les: 152 43 p 100 <- <- 100 and 0.1 <- 8Jdul of z <- 100.0. 153 Vir 44 They- were found to be accurate to at l t 8 decimal digits. 154 a: real; 45 155 .: integer; 46 156 47 progruogr.. bessel1(input,bessel1 (input, output); 157 b.gin 48 158 a ::: .ag(z); 49 l8bel 159 if I < 0.1 !!!!!l-:" 10 50 -,-r Exit to terllinate prograa ); 160 ers. -,;e~in _ rouncl<1.2 a + 48.0) 51 161 .1!. I < 2.0 !!!!!l :" 28 ~.:" * 162 52 . 53 163 or~ :a.; .i.!. odcH.) !h!!!. order = 1 54 164 .nd { order I; . + 55 165 56 !IE!. 166 57 cQ8plex 111 record 167 ) 58 re, i.: real 168 O\anI;Jes the signof a c:aoPrex 59 end; 169 60 170 b.gin 61 171 v.re := .2t. { - l.4..re; v.i. :s - u.i. 62 It, n, ., p: integ.r; 172 ~ signI; 63 z," w, fn, SU8, '51.8, OSla, nor., zero: C08P lex; 173 64 f: Irrly [0 .. li.J .2!. c08pLex; 174 65 175 fr~ed:e check(z: coaplex); 66 176 ec to see if the fmction arq_ is outside ran;le I 67 procedure stop; 177 68 178 :!!!. 69 gin 179 a, b: real; { 70 ~ 1 halt 180 71 .ndd { stop ); 181 b.gin 72 182 a := abs(z.re); b:= abs(z.i.); . 5) and (b (b 73 183 if «I < 1.0. - < 1.0. - 5» or «b <> 0.0) ond < 1.De 74 procedure crea(H~ z: coapLex); 184 - - 5» - - - 75 185 then 76 b.gin 186 b.gin 77 read(z.,.., z. i.) I); { 187 vr1te('V: s.all arg...ent{ which cauSIS expoMnt error:: 78 .nd cread }; 188 ,,,rite(z); stop Exitstc teIJIinatepE'ogr_ }; 79 189 80 190 i/~; 50.0 th.n 81 procedure cwriteC.!!!: z: coaplex); 191 -b.gin - I); 82 192 wrHe('IiI: argUlient (with i.a9inary part outside rlnge :: 83 b.gin 193 cwrit.(z); stop Exitsto terminate progra I; 84 wr1teln(' (',. z.re, .,., z.. i., ')') 194 .nd { }; 85 ~ cwrite I; 195 ~ \Check 86 196 87 197 88 function ..g(var z: cotlplex): real; 198 b.g in ( Bessell I 89 { Caoop.tesClllPltes the modulus of a canplex m.mbernl.llber 199 read(p)i n:= abs(p); 90 200 if n >= li. then 91 begin 201 -b.gin - I, p: 6, I (I, 92 .a9 :. sqrt(sqr(z.re) + sqr(z.i.» 202 vraeln('V: required order is outside the range { mag ); - 93 .nd 203 .ax:( 4, I,., .ax: 4, ')1); 94 204 stop Exitsto terminateprogra ); 95 205 ~ 96 206 creacHI); ( 97 207 ch.ck(z) If z is outsiderange,ezit to terllinateprogra I; 98 b.gin 208 . := order(z); 99 w.re ::1 u.re + "I.rei w.i.:= u.i. v.i. 209 if. >= li8 then 100 ~ (add I; 210 -b.gin - 101 211 w,.;teln(, IV: starting order I, .: 6, 102 212 exceeds{ the sPecified ..lti..', ..x: 4); 103 procedure sub(u, v: cOIIpl.,,; :!!!: w: cQ8Plex); 213 stop Exits to terminate progra I; 104 214 .!!'E; 105 b.gin 215 if n>=. 106 w.re := u.re - "I.re; w.i.:= u.i. - v.i. 216 tii.n 107 (sub I; 217 b.gin ~ I); 108 218 vriteln; writelni write( I Function argu8ent :: 109 219 cwrite(z) ; writeln; I p: 4, 110 procedure 8Ult(a: real; z: caplex; !!!. w: C:08Plex); 220 vriteln( 8 l funct ion of the first kind and order ., PASCAL NEWS 117 "ARCH. 1980 PAGE 50

, ( ) , I); .. 0 ZS9 eLse 221 0 { }; 222 .riteln. .riteln; stop Exit:8 to teminat.e ~ClJr_ l40 """"'iiain 223 !!!!!; 241 ~ i :-1 to k do 224 zero.."e :- 0.0; ;nro.ia:* 0.0; SU8;a z.ro; 1'5\8:. zero; 242 1) ~ -- 225 OSUII:- z."o: fC.. :- zero; fC.l.,.e:* 1.0. - 30; 243 if oddti> tlMn8dd(osw, fa . U, ...) 226 H8]. i. ;- 0.0; 244 ...te,..-;-1(2 U, a..) 221 for i ;- 8 dovnto 1 do 245 ~ * 228 De;;"gin - - 246 s..,iii';.., 08\8, sua); eult<2.0, S\8, I.); 229 Quotient(f[iJ.. z, v); It(Z.O... i, 'II..W>; 241 add(SU8, fCOJ, s.); ceos(z, .d; quotientt_,.., AfifliJ 230 subC 1(i + TJ, 1[i 1]) 248 - QUO~nt(l[n], IIOnI, In); 231 end; 249 (p 250 if (odd(p» then 11",(1", fft); "riteln; ..rit.ln; 232 k :s-. div 2; ) < 0> .net I); cwrita(z); llir1teLn; 233 if es(w.) 10.0 . ~s(z. i.) 251 write(' -r~t;on IrgU8~. 234 tnen 252 IIIrite(' fW'lction of the first kind .. onter I, p: 4, 1 .. 235 l53 ). ""el 236 be,~~ :_ , , 51.8); 254 ,,,riteCfn); writeln; IIIriteLn; 1: i 1 to k do .ades 1(2 ... 1], 1\8); ault(Z..O, { 231 aaif; ._ 109 'I: :!!!..: 10 Initially, a n\8bet' of Bessel f~i0n8 of the fust kind 110 11 generated by backward recursion. '1bese are then ..-i to give 12 the _ ocdeu 0 8Id 1 of the _1 function of the kind. 111 ~ 13 tJBin] fOn8rd recurrence relation b8sed an t:be8 two ocdera,"""""" 11l II..". :. u.re - v.re; lI.i.:- u..i. - v.i. 14 a nigher order is calculated. 113 ~(sub!; 15 114 16 115 Desclipt.ion of par8l!ters: 116 11 * p integral .order, C)ere -.ax <- p yroUdur. .uLtC.: r..l; z: cOIIPl.x; var ..: c08pled; - <- au andDIU: :8 500. 111 It.1J.tiplies a realwitha calPl... )- 18 Z - CXIIIplexar<)l8I!nt. 118 19 fn Bn8el f\n:tian of z and order p. 20 - 119 ~ 120 III.re:- . z.re; v.i.:=. z.'i. 21 . InpJt, { ); 22 Progr_ reads in an integer (p) 8Id be real ruobers (real 8Id 121 oRd 81lt * * 23 ~inary parts of z). 122 24 123 25 .~tpUt: 124 procedure producUu, v: c08Ple.; ~ If: c08Pln); 26 Arg\8Slt . value of the lIe l flmction of the oec:ond kind are Il5 126 begin 21 returned. NarnirIJ lleSS8Je is given if any paJ:8etet uc:eeda 121 v.i.); 28 specified 1iaitsOE' is outside rarr:je. ...re :s (u.". . v.r.) (u..i. 29 128 ...i. :- Cu.,. v..i.) (u.i. * v..reJ 129 { }; 30 LdlitationB: ~ !Koduct * * * 130 31 -500 <-p<- 500, 131 32 1.0e-5 1IDdu.l.. of x <- 377.0 lIIaginary<- part of x , 132 proclldure QUOtient(u, v: coaplex; !!!. ..: coepled; 33 <- SO.o 133 34 p ...t not be ax:h qceater thanthe 8D1lus of I, otherviae 35 exponent erroc in the OC8IpIter (Pt'P Uj70) will oa:ur. 134 var 36 135 V", vi, ., b, .1, xl, 11, y2, root: "eal; 31 .CaIIplter sys_' 136 38 Progr_ WI88 run 1ftSeE' 1.1UX Pascal (Berkeley - Version 1.2, 131 begin 39 May1979) on !EC Pt'P U170. 138 vr :- absev.r.); vi:- 8b1(v.i.); 139 root :=- sQrt(2.0) sQrUvr) sQrthi>; a:a root; 40 * 'II" + vi + 41 Accur-acy: 140 b := vr + vi - root; * 141 if (. ~ 0.0) or (b ..0.0) then 42 * CallpJted results checked aqainst pU>J.ished values over the 142 43 foUowing ranges' ""re b.gin - - 143 ..,itatnC'V: dividing by 0 in procedure QUOtient'). , stoo; 44 100 p 100 8Id { - <- <- , 144 Exittoterllinate!KOIIr- } 45 real arg~t z . 0.1 - 100.0 145 46 p 1 and !!!!!; - 1 <- <- 146 .1 :z u.r. I a; .2 ::a I b; u.i. I a; 41 calPlex argl80ftt. . (0.01,5 dog.) !l0.O,9O dog.). v."e 1':- - 141 y2 :- v.i. I b; v.n :* .1 . .2 . y1 .,2; 48 148 .,1 * 49 ']hey found to be accurate to at l t 10 significant digits. 'II.i. :- JC2 - .1 12 ""re 149 { * }; * 50 ~ besseL2(input, output); ~ "",tient 51 150 52 libel 151 ); 152 53 ~ Exit to terllinate !KOIIr- )r~edure ccosCz: c08Plel; vu c: cOIIPle.); 54 153 llIeof a cmoplex) - 55 eonst 154 56 --rii . 501; 155 ep,vor ttI, p, 51 ... =500; 156 .: re.l; tpi 0.6366191123615813 I 2.0 by pi ); 151 58 . 158 59 oylor 0.5112156649015329; ~ _; ep; 60 = 159 ~ :. exp(z.i.);p ..:a 1.0 let»; p:1I eo + .:-.. - 61 160 c..,.. := 0.5 cos(z.re); c.i.:- 0..5 . . s;n(z.re) !.l.I!!. 161 one! I CC08 ); * * 62 cOIIpLex -= record * 63 re, i.: real 162 !~~.';~..".:,-,.., 64 ~; 163 65 164 .: -,.... 66 165 61 ~ 1, k, n, ., l, p: Integer;. 166 68 z, u, v, v, yo, y1, ,,2: COIIPtItX; 161 const 69 fn, SI.8, .s , OS.., 1"10,.., zero: cQllPl.x; 168 --pro 3.1415926535891932; 169 10 f: arr.y CO .. li.J ~ cOIIplex; 11 110 12 111 13 procedure stop; 112 ~ 113 ..riUln(IV: -conversion of 0 in- procedure pol.r'). , stop; 14 { } 15 gin 114 Exit to teC1l.inate ~ogr_ { 115 !!!!!; 16 ~ 1 halt 116 0_0) (U_i8 0.0) then 71 ena-{GTstopstop }; if (u..re = and <> 111 -b~in~;n - - 18 8ag(U); pi I 2..0 19 118 v.re :Z' V.1.:= 80 119 one! 81 180 elM 82 begin 181 83 re8d(z.r., z.1.> 182 v..r. :z 88;(u); v.i.:s arct..(u.i8 I u..re) { }; 183 one! 84 !!!!! cread j; 85 184 ~ 1Polar 86 185 186 81 proc!tdure e",rite(!!!. z: cOlIPlu); 187 88 procedure cln(z: cOllPlex; 'I.r c: cQllPle.); 188 ) 89 begin 1)1) ! Natural logari_ of a cOiPlex 90 .rit.ln('(', z."e, .,., z.i., 189 { }; 190 91 .!.!!!! cwrite !!!. 9Z 191 p: cOIIOlex; 93 192 94 f\6lction ..g(var z: coeple.): rut; 193 ~ 194 pol.r(z, p); In(p.r,); C.t8:S p..i. 95 ! CoIIpItes the-!8Odulus of . caaplex nuober c..re:= 96 195 ~ I cin); 196 91 ~ 98 ..g := sqrt(sQr(z..re> + SQr(z.i.» 191 99 ~I_); PASCAL NEWS #17 MARCH, 1980 PAGE 51

267 zero.r. :* 0.0; zeta. i. :* 0.0; S\8:- zero; elw:* zero; 198 function order(z: eOlllll..>: int_r; z.ro; fW.r.:* 1.De - 3D; 199 ( Gives a start~ ani even ordK foe recursi"" CC8I'IJtation 1 Z6I 0_ :* zero; ft. + 1] :* 200 269 fW.i. :* 0.0; 201 var 270 for i :* . _to 1 do 202 : real; 271 !!Ii!l 272 QUOtient(f[;],- z,- w); 8Ult(2.D i, w, w); 203 .: int~er; lub(II, ftl + 1], Hi 1]) 204 273 - 205 begin 274 !!!!!; . 275 k 8 d1V 2; 206 a :2 8.g(Z); :* 276 if a!Is(z:r.) > 10.0 . abl(Z. i.> 207 if a < 0.1 then 8 := 10 277 iiien 208 ers. 278 209 begin i! a < 2.0 ~ 8 :* 28 .!!.!!. 8 :* round<1.2 . a + 48.0> ~in ; iJ,SUi); eult(2.0, s__, SU8); end; 279 or :* 1 to k do Idd(S\8, 1(2 210 Idd(.us, ft1l!, nOiio> * 211 orm :8.; odcU.> !!!!!!. order :a 8 + 1 2ID ( ); .i!. 212 ~ order 281 end 213 282 eLM 214 283 215 procedure s;gn(u: c08C)le.; v: cQ8Plex); ~in ~ ) 284 1 to k do 216 ( OIanges the sign of a caopleo: or i :* 217 285 Deain - - 218 begin 286 -rr-odd(i) thenadd(osus,f[2 . iJ, osus) 287 219 il.. add(.I.-;Tt2 . iJ, esus) v.r. :8 - u.re; v.i. .S - u.i. 288 220 end ( sign ); cr:- 289 I~UI, 01", SU8); ...It(2.0, SUI, I..): 221 Z9D add(IUS, ftOJ, IUS>; eeol(z, wI; quotientClus, w, nora) 222 291 .!!!!!; 292 for 1 223 ~rocedur. elt.ek(z: eOlllll..>; ( :* 0 to. do quotient; 224 Cl8cka to _ if the functiat arql8Slt is outSide rilllJe 1 293 iil88el flmctlCna of 1st kin! 1 I 294 elUi zero; l:- 1; 225 :* zero; 0''':- 226 var 295 ifn*O I 227 ., b:real; 296 tften 228 297 ""DijJln ( Yo 1 229 ~ . 298 for i :* 1 to k do Z30 . :- abaCz.re); b:- ..and (b < 1.De- 5» or «b <>0.0>and (b < 1.0e 3DO ~* - l; ault

  • ; eult(O.5, z,. u); cln(u, u); Z34 3D3 u.re :- u.r. + luler; product(u, frO], u); sub(u, "t.8, u); 235 --::~t.(,,,: ...ll Irguaent..hichC8US'Sexponenterror :II:'); 304 8Ult(tp;, u, yo); fn:" yo; wr;teln; writeln; ellrl..(z>; Itop; 305 I Z36 } "rite( F\8'Iction arg...ent a I>; cwr;te(z); writeln; 237 { Bdt to terainate ""agr_ 3D6 .rhe(1 Belill function of the second kind and order 0 - I>; ,. cwrite(fn); writeln; _ _ w,;teln; stop; Z38 307 { 239 i~ 5D.0 th.n 3D8 Exitto terainate ""agr_ 1 24D ~in - I); 309 .nd{Yol -vrTte< tV: argu8ent vith i88g;nary plrt outside range 310 eLse 241 = { ellrit.(z); Itop; 311 Yn llbere 242 { ~,in n <> 0 I 243 Exit to terainate ""agr_ 1 312 or 1 :* 1 to k do 244 end 313 beyin }; -- i], u); 8dd(e.l.8, u, 15&8); 245 !!!! TCbeck 314 :- - l; 8ult; ault; n:* ebl(P>; 318 eutm.O,. esl.8, SI.8>; 8Ult(O.S, z, u); cln(u, u); 25D if n lis then 319 u.re :- u.re + euler; product(u, f[O], v); sub(v, v); >* 8Ult(tpi, v, yo); IS"', 251 Deain - 320 ( 252 ~teln( tV: requ;red order ., p: 6, . h outside the. range (', - 321 Yo 1 product(u, ftiJ, v>; 253 ...: 4, .,., ...: 4, ')'>; 322 quotient(f[O], z, III); sub(Y, w,. w); Idd(w, osu., w); ,too; 323 ault; eh.ek(z); } 326 begin - 258 If . 18outSiderange,exit to terainate""agr_ 327 quotien, 11,. z,. u); eult(2 i, u, u): sub(u, yo, 12); \ 259 . :- orcar(z); 328 yo * \' :- 11; )'1:= )'2: i:- i + 1; 26D if . lis th.n 329 .!!!!!; . 261 >* 330 POrllllrd recurs10II 1 ~ - ., (p D) and odd(p) then .ign(fn, fn); .rlt.ln; 262 writeln(, tV: start;ng order 8: 6, 331 fn :* y1; if < 263 exceeds the specified ..xi..', .,x: 4); 332 writeln; wrTte(1 FUnction .r9\8~t .. I); cwrite(z); 264 stop; 333 writeln; 265 { Exit to terainate ""agr_ I 334 write(' Sessel funct;on of the second k;,~ and order', p: 4, I 8; 266 !!!!!; 335 '); 336 clllrite(fn); "riteln; "riteln 337 { end" 338 YnT 339 1: ( 340 !!!! tesse12 I.

    1 PASCAL NEWS #17 MARCH, 1980 PAGE 52

    ( . 1 111 \DIetL-.dJ Z 112 end 3 113 .lH~ p :. il; .veil:. wen' t !!!!Y 4 Autboc I 114 ar niiiiiJ; 5 * Judy II. 818bap, 0aIIprt8t" Sew- Diviaion, !)\i nity of tile 115 6 IlitatH.8111S, ~ ZOOl, South Africa. 116 procedure dlspo...(p: c kptr); 7 117 . DHcriptjcn of routu..: 118 begin p. .neat :. w.il; .nil:. Pi !!!!!i 9 * StringInitiaUa - 88t up tile fr_ 8P8C8 list ... called first 119 10 8IId once. 120 procedure revrit.s(~ s: str;,.); 11 - Internal erroc reporting routine. 121 1Z - Internal 8tr ing allocation routine. 122 13 - Internal string deallocation routine. 123 14 - Oller callable. Initialia a 8tring for writing. 124 15 - Oller callable. Initiali_ a 8tring for reeding. 125 16 - Oller callable fl81Ction. 126 17 aeturn8 string'8 lellJth. 127 ,. IIDfs - Oller callabla fl81Ction. 1Z8 19 '!ne if at en:! of 8tr ing. 1Z9 ZO PUts - Internal str ing character put routine. 130 Z1 Gets - Internal string character get routine. 131 ZZ ~ - U8er callable 8tr ing creation routine. 132 procedure resets(.!!!. s: string); Z3 ClO8H - Oller callable 8tr ing r..,.,al routine. 133 Z4 Roada - Oller callabla reed 8tr ing routine. 134 Z5 .ita - Oller callable write 8tring routine. 135 c: ch kptr: Z6 Qq>(x- - U8er callable trailing blank r8CMLl routine. 136 Z7 II8IIjqn - Oller callable 8tring asajq.-.t routine. 137 Z8 O:IIp8re - Oller callable fI81Ction returning tile 138 Z9 relationship betwen boD 8tring8. 139 "liiain-, 30 - U8er callable asajql8lftt of alfa to 8tr ing. 140 --rrIUtuIstatus .a writing 31 - Oller callable asajq.-.t of char to 8tring. 141 tlien 3Z 142 "liiai n 33 An i8pl-.tation of character 8tr ing pci8itives using Paac:al' 8 143 ength :z length + position: c:- current- .next; 34 dynaic storlrie allocation facilities. 'D>eroutines foilollllrtlu: 144 current- .n.xt :-!!.i!; 35 Sale's r.-.dation that 8tring8 be treated 88 sequences of 145 while c <> nil do 36 characters. ~ ~nces are pcocessed by file routines, thus 146 :-Jin~in current:-current:. c-c. .next;.neat; dispo...(c);dlspo...(c>; :. current 37 tile. string routines use 8i8ilar _ for 8i8ilar fl81Ctions. 147 38 148 encI;- 39 * 0:IIprter Syllta: 149 current :- Itlrt; position:- 1; chunkno:- 0; 40 IBII 3601370 ItN!J:.~ ~iler ver8ion 1.2. 150 statuI :... readi "I; :_ . I; 41 151 if current <> nil then w :" curr_- .llneCn .!!!!. w 15Z { tiben r t dciie on an IIII(Ityatr ing J 4Z · References: 43 J. II. Bishop, 'I8plaenting String8 in I'IIscal', "Softwre - 153 end 44 Practice and Bxperience", 9(9), 779-788 (1979). 154 45 A. B. J. Sale, 'Strings and the" sequence abstraction in I'IIscal', 155 46 "Softare - Practice ani Bxperience", 9(8), 671-683 (1979). 156 ~ lengthCI: Itring): natur.l; 47 *J 157 48 158 ~ reletl(I); length:. I. length; !!!!!i 49 159 50 ~ It,(input, output); 160 ~ eofl(l: It ring): boolean; 51 161 5Z conlt 162 begin 1) chunkno. chunkshe + po.'tion; 53 --cliUnks he . 32; 163 with s do eofl .. (length + . 54 .l talen . 10; 164 enTIeofi'l ; 55 165 56 166 procedure puts(!!!. s: string); 57 natural 8 0 .. ..xint; 167 58 text: fi le of char; 168 (1 be~:~h 59 .l faa FC"ecr.".y Y .lfalenJ ~ chari 1" s do chunkpt r a chunk; 170 60 be9~n-, 61 chunk :8 ~ 171 stltuS': reading then stringerror(1); 6Z n.xt: chunkptri 172 'iT position .: chunksiz"- 63 line: p.cked .rr.y (1 chunksize] 2!. 173 then 64 174 be,;n 65 end; 175 i current- .next ~ n; l then 66 string a record 176 -be,in -- 67 w: char; 177 nevs(current- .next); current" .next- .next :-.!!.i!; 68 length: natural; 178 end: posit ion: o .. chunksize; 179 current := current" .next; chunkno:- ch kno + 1; "70 start, 180 length :* length + chunks;ze; position.. 1; 71 current: chunkptr; 181 end 72 chuntno: natural; 112 eCH posh ion := position + 1; 73 status: (reading, writing, not ready) 183 C"U'r'rent-.l ;ne[positionJ := v; W.- '; 74 end; 184 end }; 75 relation a 1bi'fore, beforeorequalto" equalto, afterorequalto" 185 .!!!!!.TPuts 0) ; 76 Ifter" not equa: It 186 77 187 procedure gets(.!!!. 5: string); 78 188 79 avail: chunkptr; 189 80 190 be~:~h s do 11 proc~ure ,tr;ngin;ti.lize: 191 be,;n- IZ 192 , StltUS:I writi~ then stringerror(2): 83 bet;n Iva; l :- n; l: Met; 193 IT eofl(l) then stringerrod3); 84 194 iT position =~ksize 85 procedure str;ngerror(n: natur.l): 195 tnen 86 196 begin 87 begin 197 current := current- .next; chunltno:=- chunkno + 1; 88 wnteln; writeln(' execution error in string library ****'); 198 position := 1 89 case n of **** 199 end 90 --r: wrTte( I PUt attepted in read state'); 200 elu position := position + ,; 91 2: write(' get attt8pted in write state I); 201 TrCurrent <> nil then w := current" .line[position] I 92 3: wrHe(' get attetlpted beyond end of string '): 202 { iTse w '4- - 93 4: write(' delete port ion bigger than string '); 203 When~"=eof ~oincides withthe en:! of a chlDk. 94 5: write(' extract portion b'igger than string t>; 204 end 95 6: write(' insert ing beyond end of string ') 205 end Tgets }; 96 end; 204 97 writeln(' ****'). . 207 98 {} 208 h.lt( 99 .!!!!!. 8tr ingerror ); 209 gin 100 210 with I do 101 Z11 begin-gin- 102 212 length := 0; chunkno:= 0; position :- 0; start:- !!i!; 103 213 current := ni l; status:= notready: iii := ': 104 i: 1 .. chunks;ze; 214 end - ' ,opens }; 105 215 ~ 106 216 107 217 108 218 109 219 110 .. 1 ~ chunksize ~ tin.en .. '; 220 .!!i!!!.s~ PASCAL NEWS #17 MARCH, 1980 PAGE 53

    221 while start <> .!!.!l ~ 275 .h; le not eafs(.2) do 222 begin 276 ~eg;n 51.11I:= $2..;; put.(.1) ; gets(s2); .!!!!!; 223 current := start" .next; disposes; gets(s); end 295 can r of 242 end l wrlres }; 296 --O;10r;: CQ8p.re := less; 243 297 beforeoreqU8lto: cQllPare :11 less or eqU8l; 244 ~rocedure suppress(var 5: string); 298 equalto: cQ8Pare ecaaal; r_s trailil'lJ[;Ianks. ) :* - 245 299 afterorequalto: C08p:are :* not less or equal; 246 300 after: COIIPare:= not less;- - 247 ~ 301 notequalto: cOIIPlre:= not equal 248 space '; 302 eM" - 249 303 enn calpU"e }; 250 304 251 spaces: boolean; 305 252 .ark, 306 253 i, 307 ~ 254 l: natural; 308 space =. '; 255 309 256 in 310 257 := length(s); .ark:= 0; resetsCs); spices := false; 311 ;: natural; 258 for; := 1 to l do 312 .tate: (.c ;ng, ended, 'p.lcefouM); 259 313 ~n - - 260 ~ns.w:: space 314 261 then' 315 re..ritts(s); i:= 1; state.. scanning; 262 316 9;" re~at~.t , 263 spices then ~ spaces := true; .ark .-;~ 317 i > al f.len !!!!!! st8te := ended 264 ena-.!!2!. 318 erse 265 else b~g;ngin spaces.paces := false;fal.e; .ark:=urk:= 0; ~ 319 --rf ,Ci] =space then state := sPice found 266 gets(s 320 irs. ~ 5.v := iriJ; puts(s); i:= i + 1 ~ 267 end" 321 until state <> scanning; 268 iTia;k > 0 then 5. length := .ark - 1; reset 5(s); 322 269 end! suppcess );- 323 270 324 procl!dure chartostring(c: char; !!!: s: strir\9>; 271 procedure assign(.!!!: 51: string: 52: string); 325 272 326 begin re"rites(s); 5.V:= c; puts(s) end; 273 begin 327 274 re..rites(s1); resets(s2) ; beg;ginn 328 !!!!!"

    f J Articles I

    I

    I. PAGE 54 PASCAL NEWS*********#17 MARCHI 1980

    CONFORMANT ARRAYS IN PASCAL

    by A.H.J.Sale University of Tasmania (at the request of Andy Mickel)

    ~. CONFORMANT ARRAYS AND THE NEW STANDARD

    The draft proposal for an ISO Standard for Pascal contains within it a definition of what I shall call a "conformant array parameter". The basic concept is that of a parameter specification which allows a formal- parameter to assume the values and types of different actual array- parameters.

    How did the draft Standard acquire this feature? And why?

    z. PRESSURE GROUPS

    During the preparation of the draft Standard, a considerable amount of public comment was received by the sponsoring body, aSI, and the chairman of its Pascal Committee, Tony Addyman. (I seem to recall a figure of 10kg.) A significant amount of this was devoted to the problem of writing general procedures to sort and perform other array operations, inevitably leading either to suggestions of a full dynamic array facility, or some sort of conformant array parameter.

    Of course, contributors to Pascal News have not been idle in this regard either. Many suggestions for conformant array parameters have been received; some good, some not. It is clear that this is perceived by many t to be a deficiency in the language, though there are quite good arguments to support the view that it is only a deficiency viewed in a particular way. Correct or not, the perception has led to pressure being applied to the Pascal Committee to put a feature of this sort in the draft, the Numerical Algorithms Group (NAG) at Oxford being an important example.

    However, this pressure had not had an effect by the time of the publication of the third Working Draft (N462) widely published last year. Then, two critical pressures were applied to the Committee by N. Wirth and C.A.R.Hoare (independently) supporting the view that ~ was the time to add a conformant array feature to Pascal. It seems safe to assume that in the absence of pressure from such quarters the urge to add to Pascal would have been successfully resisted by aSI.

    The proposals put forward by way of defining a conformant array feature have been many and varied. Some have been strange in their exploitation of minor aspects of Pascal, and many others have been obsessed by syntax to the exclusion of what the construct should mean. It is quite clear, even before you look seriously, that the additionof conformant arrays to Pascal is not a trivial task.

    The aSI Pascal Committee accordingly had to choose something to satisfy the pressures from the joint designers of the language. They rejected the silly sugg~stions of course, and chose to put in the document which went to Turin (N510) a conaiderablymodifiedversionof s schemewhichse88edto Reluotantly,beoause I waa not an original supporter of oonformant arrays, originate with Jacobi. SUbsequently, it became olear that there were I have been oonvinoed that both timelinessand utility require the aotion better possibilities,and BSI withdrew support for its own draft, in favour that was taken at Turin. I think the inolusion ia warranted. of an improved one, now inoorporatedin the Draft Proposal. This soh..e, whioh seems to have originated with N.Wirth, has been examined by both opponents and proponents of the addition in order to ensure that at leaat ~, CURRENT STA~US if there ia to be an addition, it should be the best one poaaible. That is ay own posHion. To keep readera of Paso~l Newa informed, I reproduce aome pieoea of the draft propoaal aa they relate to oonformentarray parametera. It can be The key idea behind the ourrent propoaal is that it preaerves the aeen that the addition ia entirely looalized within the parameter liat, abstraotion of an array as a oomplete mapping, and inoorporatesa number of exoept for the addition of one it88 to 'faotor' (and no need even to write "oompile-time"Oheoks on the validity of aotual calls. The ooat 1s that of anything about it in the aooompanying text), The oonformant array introduoing what the draft proposal oalls a "sohema"; or in other words a parameter aohema ia well-orafted ao that it hangs together aa an integrated apecifioation whioh ia not a ~ but a rule for identifying and whole, and the reasons for most of the statementswill be clear after some oonatraining a set of typea. Thus the type of a formal oonforaant-array- thought. parameter is not known from its deolaration,but is supplied by eaoh oall. The oonaequencea are very simple outaide thia one point, eapeoially in The exaot syntax may be ohanged without damage to the propoaal. The uae of derining parameter-liatco'~ruity whioh many other propoaala make very "..", ":" and "in is ba.¥d on analogies with aubrana8S. variabl.- heavy weather of indeed. declarationa,and formal parameter lista respeotively. Other people may prefer to use oommaa or what.ver. It doesn't really matter aa long aa the abstraction is right, exoept for atudents. !I.. I!!IWI.

    At Turin, the aite of the very first oomputer oonferenoe ever, there was a 1. IMPLEMENTATION oonsiderable amount of diaousaion of the conformant array proposal. Oppoaition to the propoaal waa stated by the US. and one Or two other I have notioed aome people aaying that the implementation of conformant people, but there waa clearly a substantialmajority whioh would aooept the arraya ia unproven, and I ahould like to aharply diaagree. There ia no inoluaion of auch a feature, and many indeed welcomed it. Consequently, problem whataoever about the implementationof &OX of theae aohemea, and the feeling of the experts group waa reoorded aa being in favour of aome they have been well-known for a very long time. The whole argument has form of oonformantarray parameter being in the firat Standard. been around fitting the idea into Pascal with the minimum of chsnge to its fabric. Any oompetent implementorwill be able to implement thia feature ::s Disouaaion then turned on the form of the parameter mechanism, with the on any machine I know, and exiating implementations which diffsr oan be > possibilities being the BSI original, the redraft now inoorporated,and an altered~ ~. , im~roved Jacobi-like proposal. Conformant array parameters took over two ::z:"" houra of technioal diacussion (about 12S of the total), and alao ran into There is one exoeption. Not thst it is unknown, but that we know verY well .... dinner, breakfast and a coffee-break. However, it is useful to realize that if We sre going to allow packed arrays to be actual paramatersto a u:> that the Turin meeting perceived this as an important issue, but not of oonformant array parameter, then we will be forced into either giving up co over-riding importanoe. packing oompletely on some machines, or imposing some ugly restriotionson C> oonformant array parameters, or passing some bit-size argument and requiring the called procedure to reproduce the vagaries of the packing 5.. TIMELINESS algorithm. The problem is easentially that the ~ (inbits,aay)of the oomponent-type may not be known until exeoution. For this reason, the use Part of the pressure to make this feature appear in the Draft Standsrd of pscked in a conformant array parameter was not allowed. arises from s desire to have important numericsl algorithms translated into Pascal, and the language used in this area now dominated by Fortran. But It should be realized that the inolusion of packed in the Standard me8na si.ply beoause this pressure is present, many implementorshave already that III implementors mYJ1 provide it (do not fall into the trap of inserted a feature of this general type into their implementations, and thinking of the Standard as a permissive one or a layered one such aa they differ very widely. Not surprizingly,not many implementorsthink COBOL), and the likely effects are simply to oause it to be ignored and the muoh about the abstraotionsbehind their extensions,or perhaps they borrow effectiveneaaof the Standard nullified,or to csuae no packing to take axtensions. The signs are there that if conformant array parameters are place when the 'Standard'compiler option is set. Thia would be singularly not standardizednow, they may as well never be for all the good it will unfortunate for a feature whose main use seems to be to simulate aomething do. else (atrings). It should be pointed out that ita exclusion means that aome implementorsmay choose to provide it as an extension. The abatract S~..kinl personally, I hsd had six new impl88entora oall me in the lsst meaning is olear; the syntax is olear; only the implementation ia month, and all of them have aaked for guidsnoe on how they should implement diffioult. oonformant array parameters. Suoh intereat by new commercisl iDplementations is significant; however the existing implementations are ~cQ.-. lLkely to be harder to bring into any sort of conformance.

    V"I V"I

    / ...... ------" - .... EXTRACTS FROM WORKINGDRAF'l'5 (Shortly to be Draft Pl'Oooeal to ISO) It TI 18 an array-type, and T2 18 the type the Stdim- 6-6-3 ordinal-type-identlfier of a conformant-arraY-8Ohe.a,then Tl la oonformable with T2 If all the following four .tate.enta ar. true. variable-paramcter-speclflcatlon (a) The index-type of Tl ia ooapatible with T2. "varN lddnt1rler-11st .:" (b) largeat value (type-Id~ntlfier : conf~rmant-~rray-.cheaa) The ..all..t and of the Index-type of TI lie within the closed interval defin.d by conrormant-arrdY-5chema value. ot T2. . (c) The coaponent-type of TI ia the ...e aa a o08pon.nt-type of tha "array" "C" Index-type-spec1flcatlon ,,). conformant-array-ache.a, or 1. oontor.abla to a oaponent I Index-typc-speclflcatlon I .of. ( ";" oonforaant-array-ache.a. typ.!-Identlfior : conformant-arraY-8Oheaa ) . (d) Tl i. not d..ilnat.d paoked. lndex-type-spp.clflcatlon . bound-id.!ntlfar bound-ident1r1er It shallbe an errol' If .:" ordlnal-typ"-Identlfler the ..all.at or larla.t value of the bOund-Identifier. Identifier index-type ot TIll.. out.ida the 010884 lntarval datlned by tha . vaI s of' 1"'2.

    Tht occurrence of an Identifier wHhln an Identlfler-Ustof a During the entlr. aotivation of the blook, the first II.Ju,,-paraDleter-apeolflc~tlonor a var1able-parameter-sp.clf1ca~lon bound-identIfierah..lld.not. the ..ell eat v.lue of the index-typa shall be its defining-point.s . para.eter-ldentlflerfor the region of the aotual-para.eter., .nd tha ..cond bound-identlflar .hall t.h,H18 the for...l-p.ra.eter-Ustin whloh H ocoura ..nd its denote the l.rg.at valua of the ind.x-type of the defining-point I. a variable-identifierfor the region that is the actual-paraeetar.. procedure-blockor function-block,If any, who.. foraal param.ters are deflnp.dby that formal-para.eter-l!st..

    The occurrenoe of an identifier aa a bound-Identifier within an lndex-type-apeolflcat.lon ahall be Ita defining-point as. 6.6.3.6 Paraeeter l1st con.ru1tv. Two toraal-paraaet.r-11at. aha 11 bound-ident.lfiertor the region that i. the formal-para.eter-listin be congruoua if they oontaln the ..ae nweber ot paraaetera end it which It ocours and for the region that Is tha procedure-blockor the para.et.ra in oorreaponding poaltiona .atch. Two param.tar. .hall mat.ohif any of the four .tat..enta that follow is true. runctlon-block, if any, whose foraal para.etara are defined by that (a) They are both value para..ter. of the ..me type. ror~..l-parameter-liat. (b) They ar. both variable parameter. ot the sa.. typ., or hay. equival.nt oonfor.ant-arr.y-8Ohe Two If tha componont of a oonformant-array-ache.a la Hael f , conforaant-array-sohe.saare aqulv.lent if they hay. the .... conformant-array-sohe...,then..n abbreviatedfor..of def1nt1lonIny ordinal-type speolfl.d in th.ir ind.x-typ.-speclficatlona and be used. In the abbreviated form, all the Index-typo-specificatIons their ooaponent. are .Ither of the ..ee typa or are .quiv.lent shall be contained within t.he sa.e anclosing square braoketa, a conforaent-.rray-eohe.aa. aingle ...I-oolon replaoing eaoh sequeno. of right-square-bracket (0) They are both proo.dural para.eter. With oonlruoua par.."t.r .of. .array. left-square-bracketthat occurred in tha full fora. Tha 11.ta, it any. abbreviated fora aIIallbe equivalent to tha tull fora. (d) Th.y ara both fUnctional paraeet.r. with oongruou. par...t.r 11.ts, It any, and tha result-type. Exallples: arrayCu..v: TI) ot arrayCJ..k: T2) of T~ arr"yCu..v: TI; J..k: T2) of 13 8te1iJw1, 6-7'1 6.6.3.3 Variable Dara.eters. The actual-para.atar (aeo 6.1.] and 6.9.2.]) correapondlnl to foraal p..ramaterathat occur in the ..me faotor . v.riabl. I unalgne~-con.tant I bound-Identifier identifi.r-listin the for.al-paraaeter-llatahall all be of the functlon-deslgn.tor I SAt-oonatruotor I type. ThiS type ahall be the aa.e aa the type of the .(. expreaaion .)" I .not. f.otor . t~p.-Id.ntlfler in the varlabl.-paramet.r-apaolflcationif the for.al paralleterIs eo .peolfled, otherwi.e it anall be oonfora.ble to the oonfor.ant-array-aohe.a in the variabl.-par.meter-apecificatlon.Saohtoraalpar...ter ahall denote the oorra.ponding aotual-paraeeterduring the .ntire aotivatio~ of the block. Any operation Involving the for.al pera..ter ahall be perforaed i88ediataly on the aotual-para.eter.

    Ir accea. to the aotual-par..eterinvolvea the indexing of an array and/or tha .elect.ion of a ti.ld within a v.riant of a r.oord and/or the de-referenolng of a pointer and/or a ref.rance to a buffer-variabl., th..a actiona .hall be axacuted befora the ectlvation of the blook.

    Coaponenta of varl.blea of eny type de.ilnated paoked ahall not be us.d aa aotual variabl. para..t.ra.

    ...... -..- w - - - - - T DEPARTMENT OF THE ARMY PASCAL USA OARCOM AUTOMATED LOGISTICS MANAGEMENT SYSTEMS ACTIVITY SURVEY PO 80X 1S7', n LOUIS, MISSOURI 6318. Pascal is a computer language developed by Niklaus Wirth at ETH in Zurich, Switzerland. It is derived from Algol 60, but is more powerful and incorporates structured programming principles. Pascal has been DRKAL-T 18. January 1979 implemented on a variety of computers throughout the world with the most common being Control Data Corporation and Digital Equipment Corporation computers. Its widest use to date has been as an instructional tool to teach students the principles of programming in a structured manner, but some computer companies, notably CDC and Texas Instruments are using it Mr. Andy Mickel as a systems programming language. P~.c.l Uaer's Group Univeraity Computer Center: 227 EX ALMSA developed a Questionnaire which was sent to approximately 950 208 SE Union Street membere of the Paacal Ueer'e Group in the United States. We received Univeraity of Minneaota about 120 usable reeponsee, which were analyzed to provide the statistics Minneapolia, HN 55455 for this report. The response., e.pecially in the area of relative speed and size of Pascal generated code compared to other languages, were often incomplete, so each area of the report indicates the number of responees on which it is baaed.

    Dear Andy: The Questionnaire brought IIOlIe interesting facts about Pascal usage to Our agency aent queationnairea to about 950 membera of the Pascal light. The first interestingstatisticis thatalmost. of theresponses were from educational institutions,and another 1 were from computer Uaer's Group in the United States in order to gather information companies. Most goveMIIDentorganizationsresponding were research on their experience with the language and available software. Thank of the you for providing uS with a copy of the User'. Group mailing list oriented. It is safe to say that aa yet, Pascal has not moved into the for this ~nde.vor. mainstream of computer programming, although judging by the fact that over 4/5 of the respondents said that Pascal usage at their installation 0- increasing this developmentmight lD We are submitting the attached copy of the results of our survey to wae be forthcoming in the future. 00 you for publicstion in the Pascal New.. Also, encloaed i. a copy o of the questionnaireforyour information. If youhaveany questions, Another interesting fact is that 3/5 of the respondents were using Standard please contact John McCandli.s, 314-268-2786,or Sue Burklund 314- Pascal. Pascal was highly rated as an educational tool, but got its lowest ratings as a lan~age for writing operating systems 268-5151. ' and business applications. Extensions of Pascal, such as Brinch Hansen's Concurrent Pascal, will be necessary before Paecal will be acceptable for writing -~y) operating systeme. Other exteneione, such ae betterI/O capabilitiee will be neceesary to make Paecal an acceptable business programming \ <.L~,L J.:. -<1 :-_ language. 1 lncl R~BERT R. RANSOM A. etated Director for ADP Technology It is hard to make any judpent aa to the efficiency of Pascal generated code, becauee of the small number of reeponsee, and the large variety of compilers cited. In most cases, the Pascal generated code was both slower and larger compared to modulee in assembly language and other high level languagee. However, a couple of compilers, including the widely used Unhersity of Colorado veraion, were producing code that wea compared favorably with that produced by FORTRAN compilers.

    / ------June-October June-October 1978 1978

    ~: The following three areaa were rated on a 0 to 3 scale where: PASCAL QUESTIONNAIRE STATISTICS Poor o = 1 Adequate = Genera1 Statistics: 2 Good = ~~Number 3 Excellent of queationnairea mailed 950 100r. = Average 155 16r. Nuaber of repliea received Number ot repHea Rating Replie. from organizationa which didn't have wOrking 33 Jr. compilera or- aaid they couldn't answer our aurvey Reliability ot Pascal compilera: 116 2.2 Uaable repliea 122 1Jr. Suitability tor the tollowing applications:

    Types of Respondents: a. FORTRAN replacement 110 2.1 10 8.2Yo b. ALGOL replacement 95 2.4 a. Governmental organizations c. Educational uae 104 2.6 60 49.2Yo b. Educational organizationa d. Operating aystama 23 18.9r. 88 1.4 c. Buaineaa organizations e. Syatama programing 101 2.0 d. Computer organizationa ~Total ,i t. Busineas applicationa 87 1.4 g. Scientific applicationa 99 2.1

    Peacal'a capabilities in various programming areaa: TYpe of Pascal Uaed: 65.or. a. I/O operationa 114 1.4 a. Standard 78 3 12 10.0r. b. Numericcomputations 122 1.8 b. Subset of standard c. Integer arithmetic 111 2.4 XI". c. Sequential Pascal 11 9.2Yo n 5 4.2r. d. Character handling 114 1.9 ::z: d. COncurrent Pascal e. String handling 112 1.1 . e. Other 14 ..... ~Total m 00 Speed/size of Pascal generated code compared to a similsr module on the '"o ~: Theae numbers are not exact aince some organizations had more than a_ system in another language: one Paacal compiler. spee~ Size a. ber ot repliea 20 a.--Numberof replies 13 How aany of theae organizationause Paacal compilera b. Faater 3 b. Smaller 1 ea oppoaed to interpreters? c. Slower 17 c. Larger 12 a. Pascal compilera 87 76r. 1Jr. b. Peacal interpretera 15 Commenta that many reapond8l1ts...deabout the limitations of Pascal and c. Both 13 Total m ~ what they thousht would be the moat useful extenaions to Paacal: ~. Formatted I/O b. Randomaccesa capabilities Percentage of coding being done at each installation in Pascal: c. Better interfacea with other programs d. Ability to initialize variables .. Numberof repliea 94 e. Bit atringe b. Average r. ot coding 14.5" f. Halee it easier to. C08Ipile procedures separately g. More interactive tunctiona h. Dynamic arrays Trend or Pascal usage at each inatallation: .. Replies 116 84r. b. Increasing IT c. Decreasingor stable 16r. 00

    / HVS do.. not .ctu.ll~ writ.to. t.rmin.l until. line i. compl.t.d. CONVERTINQ ~ APPLICATION pROQRAH ERQtt with writ.ln. H.nc. .11 prompting m g.. h.d to b. ch.ng.d to ~.. QtW. ~ l 1E. IQ ~ ~ gQQ!U_L.~ writ.ln in.t..d of writ.. Q.offr.~ R Orinton a. It w.. n.c r~ to ch.ng. .11 output for...t. to .llow for . St.t. El.ctricit~ Commh.ion of Victoria c.rri.g. control ch.r.ct.r. Thi. w.. not .trictl~ n.c r~. but it Richmond. Victoria 3121. Au.tr.li. r.~uir.d if the .~.t.m d.f.ult DCB inform.tion w.. to b. u..d "'..(i. RECFH"FAI. I r.c.ntl~ h.d occ..ion to tr.n.f.r.n .pplic.tion progr.m origin.ll~ 9. Sine. the AAEC v.r.ion do.. not .p.cific.ll~ .llow for int.r.ctiv. writt.n on . I'DI' 11/34 .~.t.m u.ing RT-l1 .nd 01'151P.n.l 1. IF to .n u... .11 input h.d to b. ch.ng.d .0 th.t the Pi 1. point.r w.. .lwa~. in.t.ll.tion running AAECp.sc.l aOOO/l.;j/und.r HV5Oil. du.l IBI'1370. d.fin.d. Thi. don. prim.ril~ b~ ch.nging .11 occur.nc.. of r..dln!..) to r..dln."'" r..d!..), .lthough ..v.r.l oth.r minor progr.m..in. Although the progr.m h.d origin.ll~ b..n writt.n with this tr.n.f.r in ch.ng.. .1.0 n.c r~. mind. .nd h.nc. with. ..inimum of .~.t.m d.p.nd.nt f..tur... th.r. w.r. ""1" ..v.r.l '1"" in which un..p.ct.d ch.ng.. h.d to b. m.d.. So... of the 10. Th. OHSI compil.r do.. not pre-d.cl.r. fil.. INPUT .nd OUTPUT. .nd ch.ng.. '1" of . trivi.l n.tur.. .nd ",.r. ..p.ct.d. Oth.r.. how.v.r. con..~u.ntl~ do.. not .llow r.f.r.nc..to input~ to look-.h..d on the ",'1" 1... obviou.. .nd po..d .om. probl.m.. input fil.. With the ch.ng.. d..crib.d in point 9. it u..ful to be .bl. to do this in the AAEC v.rion of the progr.m. "'"Furth.r ch.ng.. Thi. not. d..crib.. the diff.r.nc.. .ncount.r.d. .nd i. int.nd.d to .how b.c.m. n.c r~. how.v.r. wh.n I r..li.ed th.t the .~.t.m wa. .ddin. oth.r. the .ort. of probl.m. lik.l~ to b. .ncount.r.d in .uch .n ..tr. bl.nk. to the .nd. of m~ input lin... to fill th... out to ao ...rci... ch.r.ct.r.. (I c.n't ..~ th.t I w..n't w.rn.d b~ .J.n..n .nd Wirth, but th.t one took. lot of find in.!) 1. Th. origin.l v.r.ion w.' writt.n u.ing . mi.tur. of upp.r .nd low.r c... ch.ract.r.. Wh.n this w.. f.d into the AAEC compil.r the compil.r 11. 0l'1S1p..c.l u... ..odified for... of r...t .nd r.writ. to .tt.ch cr..h.d. no indic.tion of the lik.l~ c.u.. of the probl.. w.. giv.n. .0 .ctu.l RT-l1 fil.. to int.rn.l file v.ri.bl... Th. AAEC .~.t.m re~uir.. . bit of in.pir.d gu work w.. r.~uir.d. Th. .olution u..d w.' to this conn.ction to b. ...d. ..t.rn.ll~. .nd h.nc. the .ppropri.t. ch.ng. the ",hol. progr.m to upp.r c.... initi.li..tion rout in. h.d to b. ch.ng.d. ] n.c r~ to conv.rt occur.nc.. of the ch.r.ct.r. C. .nd 12. A. OHSI p..c.l ignor.. the 'p.ck.d' .ttribut., .nd .utom.tic.ll~ 2. It ..... to the "'" AAEC .~uiv.lent., n.m.l~ !., .) .nd.. 1 h.v. sine. found th.t p.c k. .11 c h.r.c t.r .rr'.~. .nd .tr ing.. I h.d not .p.cifi.d .rr.~. of o.D ], but thh i. not docum.nt.d. t~p. ch.r .. p.ck.d. Thi. w.. n.c r~ on the AA~C .~.t.m for 00 the AAEC compil.r .cc.pt. C .nd prop.r o op.r.tion of ..~ progr.m. 3. Th.r. ",.r. ..v.r.l occur.nc.. of VALUE... v.ri.bl. n.m.. Sinte the AAEC compil.r .110"" . VALU~ ..gm.nt. ",hich folIo",. im...di.t.l~ Th. conv.r.ion proc... w... d..pit. the diff.rence. outlined .bove, .fter the VAR ..gm.nt. this c.u..d it .om. confu.ion. prob.bl~ .impl.r then I h.d ..p.ct.d. Ap4rt from the I/O rel.t.d difficulti... th.r. w.r. f.w incomp.tibili.tie.b.tw.en the .~.t.m., .nd 4. I h.d omitt.d to includ.n.m.. of ..t.rn.l file.. including INPUT conv.r.ion of the whole progr... of 1200 lin.. w.. compl.t.d within. .nd OUTPUT. in the progr.m h..d.r (which i. option.l in the 01'191 coupl. of d.~.. compil.r). .0 th... had to b. in..rt.d.

    ,. It w.. n.c r~ to r.duc. the n..ting l.v.l of proc.dur... .ince l"h H.~. 1979 AAEC .110'"onl~ .i. l.v.l.. Th. 01'161compil.r .llow. up to t.n l.v.l.. Such. r..triction would .pp..r to m. to b. contr.r~ to the philo.oph~ of .tructur.d progr.mming, .. it r.~uir.. the progr.mm.r to .ith.r u.. l.rg.r (.nd h.nc. 1... compr.h.n.ibl.) block., or to pl.c~ proc.dure. which .hould logic.ll~ b. cont.in.d in .noth.r block .t. hlgher l.v.l. 6. Th. 01'181.~.t... h.d f.i l.d to d.t.ct .n inv.l id ...ign",.nt to . .ubr.ng. v.ri.bl.. Thi. w.. corr.ctl~ di.gno..d b~ the AAEC run-time .~.t... Th. p.rticul.r ..."'pl.w... .ubtl. for.. of: Y.r. index: 1.. top.

    7. Th. AAEC .~.t.m. wh.n running und.r the Tim. Sh.ring Option (T80) of

    / - Next we consider the User Manual. Here in Chapter 1 (pp. 6-7) we find it again DOES SCOPE ~ BLOCK IN PASCAL? statedthatscope~ proceduredeclaration.Alsoit is stated"thescopeor rangeof validity of an identifier x is the entire block in which x is defined, including T. P. Baker. those blocks defined in the s8Jlleblock as x." Applied to program PI above, this Department of Computer Science would seem to imply that the correct output of PI is 1. However the above quote has a The University of Iowa parentheticalcomment that all identifiers must be distinct for this to apply and Iowa City, Iowa 52242 refers to Section 3.E for the case where identifiersare not necessarily distinct and (this is the case with PI). Reading Section 3.E, we find that the definition of a variable definition in an inner block is valid throughout that block. This might sug- A. C. Fleck gest the correct output of PI is 2. Actually this rule has nothing to do with program Department of Computer Science PI as it deals exclusively with ~ identifiers, the topic of Section 3.E. and Unfortunately the other sections on type identifiers, procedure identifiers and con- Weeg Computing Center stant identifiers give no rules at all. The University of Iowa

    Iowa City, Iowa 52242 The last t most speci fie and least satisfactory source for a resolution of scope rules (other than for variable identifiers) is the E.T.H. compilers. Because of Wirth's close association here, their performance must be considered significant. The INTRODUCTION output of both the Version 2 and Version 3 compiler for PI is 1. This perfonnance is supported by the rule in Chapter 1 (p. 8, item 16) of the User Manual that "All ob- There seems to have developed sOlre controversy over whether the scopes of identi- Jects must be declared before they are referenced" (two exceptj ons noted are pointer fiers are (or should be) synonymous with blocks in PASCAL. In this note we call types and forward procedures). In the absence of other rules about scope it is not attention to the formal statement of the "rules" dealing with this situation, point unnatural to apply this one, hence accepting the outer definition throughout its scope out several other items in the literature that address the question of the title, and until another occurs (the Version 2 and 3 compilers do violate the wllque association present our own personal conclusions. We relate our comments first with respect to rule which doea not corne up in PI). This is preswnably the reason for Wstt's [4J "Standard" PASCAL and then to the new BSI/ISO Working Draft Standard PASCAL. assumption that Sale [3J criticizes.

    WIRTH'S S'fANDARD PASCAL THE BSI/ISO STANDARD :3 ::c> n There ere several levels of docwneutation to consider in this case, in decreasing We now turn our attention to the new Draft Standard [lJ. While there are prob- :r order of abstraction: the Report [2], the User Manual [2J, and the several E.T.H. lems with the eXisting language specification,it is this new definition whIch caUSes compilers. Arthur Sale in [3J argues strongly the position that scope m block. But Us the most serious concern. The Draft Standard eliminates the previously existing we would like to suggest that there are loopholes. The Report is unfortunatelyvague. omissions on the specification of scope rules. There is an explicit enumeration of In section ~O, we are told that scope a procedure (or function) declaration and that the nested scope rules for all varieties of identifiers (see Section 6.2.1). Unfor- identifiers are not known outside their scope. But it gives no details of ~ they tunately, as we shall see, these rules imply that scope" block for all cases except are known inside their scope. The crucial issue is nested scopes which are mentioned variable and type identifiers. in Section 2 but for which no rules are given. Section 4 of the Report tells us that the association of an identifier must be unique \lithinits scope. This is essentially Eachidentifierhas a definingoccurrenceand eachdefiningoccurrencehas a the extent of the specificationsin the Report. In this light, consider the folloving scope which encloses all "correspondingoccurrences" (a term not defined). Here the example: Draft Standard leaves some ambiguity as it does not state precisely where such scope begins and ends. Since the scope must enclose all IIcorrespondingoccurrences"we 1 PROGRAM Pl(OUTPUT); shall simply assume that the scope ends with the end of the block in whose heading the 2 PROCEDURE Q; BEGIN WRITELN(l) END; defining occurrenCe appears. The choice for the beginning of the scope is another 3 PROCEDURE R; question. Since each defining occurrence is prescribed as having a scope associated 4 PROCEDURE S; BEGIN Q END; with it (i.e., scopes are associatedwith defining occurrences not blocks), one seems 5 PROCEDURE Q; BEGIN WRITELN(2) END; naturally forced to assume that such a scope begins with the defining occurrence. 6 BEGIN SEND; This assumption seems reinforced by the rule (in Section 6.4) that the scope of the 7 BEGIN REND. defining occurrence of a type identifierdoes not include its own definition, except for pointer types. There is one exception to this assumption explicitly stated in Now there are two definitionsprovided for identifier 'Q' within nes~ed scopes. rule (5) of Section 6.2.1. This rule states that the defining occurrence of any The one witbin R must not be known outside R. There is only one invoking instance identifier or label must precede all its "correspondingoccurrences" except for a of the identifier 'Q' (hence its association must be unique) and its occurrence is pointer-type identifierwhich may have its defining occurrence anywhere in the type- validly within both scopes and the Report's rules give us no reason for preference. definition part. Hence we assume that the scope of a pointer-type identifierbegins with the beginning of the type-derinitionpart rather than with its derining occur- rence.

    .Present address: Mathematics Department, Florida State Univ., Tallahassee, FL 32306 CT> CO

    / A. -'-.., ... .. '- Now consider the previously given program example Pl. There is no longer any doubt over what its correct output must be. This program has two defining occurrences Programs Pl and P2 show how present scope rules provide for the binding of cor- of the identifier responding occurrences of identifiers to defining occurrences outside the block of the 'Q' (thespecificationof a definingoccurrencefora procedure corresponding occurrence even though this block itself contains a defining occurrence. identifier is given in Section 6.6.1), in lines 2 and 5. The scope of the first extends to the end of Pl (i.e., lines 2-7) and the nested scope of the second extends A convention which provides for the binding of one identifier to two definitions with- in the same block seems entirely contrary to the evolution of PASCAL. ~o the end of procedure (i.e., lines 5-6). Clearly then the call in line 4 is a corresponding occurrence~ for the definition in line 2, an association clearly vio- lating ALGOL60-style scope rules. The scope rules should state that the scope of a defining occurrence extends from the beginning of the block in.whose heading it occurs to the end of this block. This (2) The same situation prevails for constant identifiers. As an example consider would replace rules (1) and of Section 6.2.1 of [1]. The other rules would be retained as stated; however we would rephrase rule (5) slightly to say that the com- pletion of the definition for a defining occurrence must precede all corresponding 1 PROGRAM P2(OUTPI1J'); occurrences--then the scope rule in Section 6.4 is dropped. This would make programs 2 CONST TWO 2; 3 PROCEDURE" Q; Pl and P2 illegal as they then violate rule (5)--the defining occurrence in the nested 4 CONSTONE" TWO; block does not precede first use. It has already been suggested [5J how this inter- 1; pretation can be handled in a one-pass compiler. The only complication to this comes 5 TWO = in the exception to rule (5) for pointer-types which must force the binding of !1l 6 BEGIN WRITELN(ONE) END; such identifiers (even those with definitions in enclosing scopes) to be deferred Q END. 7 BEGIN until the end of the type-definition part. We do not include the scope analysis for this program as it is similar to that We feel the approach we suggest provides a conceptually clesner solution to the for program Pl. The upshot is the same as for procedure identifiers, namely scope; scoping questions. The treatment of all varieties of identifiers is internally con- block for constant identifiers. sistent and consistent with the conventions of other block structure languages as On the other hand since type-identifierscannot occur in a heading prior to the well. Moreover it conforms with the principle of locality. With the rules given in type-definitionpart, rule (5) of Section 6.2.1 implies that scope" block for type the present Draft Standard, a block can contain identifiers with both a local and a identifiera. For instance, in contrast to the previous examples, the program nonlocal binding--a very confusing situation.

    1 PROGRAM P3(0I1J'PUT); REFERENCES 2 TYPE A RECORD L: fA; C : REAL END; 3 PROCEDURE" Q; , Exper. 1. A.M. Addyman et a1., "A draft description of PASCAL," Software-Pract. 4 TYPEB = IA; 9,5(1979), 381-424; also PASCAL News 14(1979), 7-54. 5 A =RECORDL: B; C :INTEGEREND; ~ 6 VAR X: B; 2. K. Jensen & N. Wirth, PASCAL User Manual and Report, Springer-Verlag, Second Edi- '"00 Xt.C:= 0.5 END; o 7 BEGIN NEW(X); tion, 1975. 8 BEGIN Q END. is illegal because of the type conflict in the assignment in line 7 (however the Ver- 3. A. Sale, "Scope and PASCAL," SIGPLAN Notices 14,9(Sept. 1979), 61-63. sion 3 E.T.H. co~iler finds it legal). 4. D.A. Watt, "An extended attribute grammar for PASCAL," SIGPLAN Notices 14,2(Feb. 1979), 60-74. Also since variable identifiers cannot be used in the heading at all, these rules imply that scope" block for variable identifiers as well. Hence for the Draft Stan- 5. J. Welch, W.J. Sneeringer' C.A.R. Hoare, "Ambiguitiesand insecuritiesin PASCAL," dard we ge~ two answers to the question of the title; 'yes' for variable and type Software-Pract.& Exper. 7(1977), 685-696. identifiers and 'no' for constant, procedure and enumeration-type identifiers.

    CONCLUSIONS

    The lack of specification of rules for nested scopes in the original PASCAL defi- nition has reaulted in different interpretations being taken by different i~lementa- tions. This point has already been made in [5J. The fact that so basic an issue must be settled has been recognized in the development of a draft standard.

    We feel that while the Draft Standard does resolve the ambiguities of scopes, the -0 solution tbat is proposed is very poorly conceived. The answer to the question "does > scope" blockY" should be uniform for all varieties of identi fiers and furthermore we I'TIC'> agree with Sale [3 J, that uniform answer should be yes.

    / Note that according to current and proposed scope rules [I], this is the "correct" program behavior in each case. A NOTE ON PASCAL SCOPES z: We propose that PASCAL can be standardized to follov the ALGOL60scope conventions, ~ vith the added restriction that (except in recursive pointer type declarations) no use ~ of an identifier may precede its declaration (this appears to be the approach taken in T. P. Baker and A. C. Fleck ADA [2]). Thus, program PI above vould be consid~,'ed incorrect, since the use of Q in procedure S precedes a local definition of Q. P3 vould be incorrect for a similar rea- Department of Computer Science son, because the use of F in procedure R precedes a Jocal declaration of F. Program P2 The University of Iova would be considered incorrect, but for a different reason. The variable X would be in- Iova City, Iova 52242 terpreted as a pointer to a record, so that the assignment "X":.' A'" vould be a type conflict. This is exactly vhat vould have happened if the outer declaration "A = CHAR" had not been present. In this case, the convention folloved by the compiler not only makes the interpretation of the procedure Q dependent in an unobvious vay on its global In response to the recent efforts tovard development of a PASCAL standard [1], ve environment, but also effectively blocks the possibility of defining a pointer type for vould like to point out a peculiarity ve have obaerved in the PASCAL notion of scopes, the local record type A. as exemplified in the E,T.H. compilers, and to suggest hov a "cleaner" alternative notion might be implemented. A single pass compiler can enforce these conventions. On first encounteringa use of an identifierX that is not yet declaredin the localblock,the compiler attempts Beginning vith ALG0L60, "block structured" languages have folloved the convention to resolve the reference to a previously processed nonlocal declaration, say D, in one that scopes of local declarations correspondto the boundaries of the blocks in vhich of the surroundingblocks. If this search is successful,the processor creates nev PASCAL superficiallyappears to follov this convention,a programmer they occur. Since "dUIWIJY" entries for X in the symbol table for the local block and all surrounding blocks, is likely to go along for some time before he stumbles upon a case vhere PASCAL scopes out to the block where D appeared. These dummy entries viII include a pointer to the do not correspondto blockboundaries.Whenhe does, it is likely to be a source of entry corresponding to D and will serve the purpose of insuring thst any subsequent dec- confusion. For eX8ll1ple, consider the programs and output below (from Version 3 of the laration of X locally viII be deleted and treated as an error. PASCAL 6000 compiler): PASCAL already provides means for handling the fev cases vhere forward references 1 PROGRAM P1(OUTPUT); Q; BEGINWRITELN( 1) END; are unavoidable. For procedures, functions, and labels, there are forward declarations. 2 PROCEDURE For recursively defined pointer types, processing can be deferred until it can be 3 PROCEDURER; determined vhether a type identifier should be resolved as a local or nonlocal refer- 4 PROCEDURES; BEGIN Q END; ence. For example, processing of "B= "A" in P2 vould be deferred until the local dec- .... 5 PROCEDUREQ, BEGIN WRITELN(2) END; laration of A vas encountered (or until the end of the TYPE section). ~ 6 BEGIN S; Q END; o 7 BEGIN REND. We believe that the proposed conventions are an improvement in the direction of simplicity and conformity to established practice. Furthermore, as exempli fied best in 1 program P2, they improve program modularity, by permitting reliable local resolution of' 2 references, vhich under present rules is impossible.

    1 PROGRAM P2(OUTPUT); 2 TYPE A = CHAR; 3 PROCEDUREQ; [1] A.M. Addyman et ILl. "A draft descriptionof PASCAL," Softvare Pract. & Exper. 4 TYPE B . "A; 9,5(1919),381-424; also PASCAL Nevs 14(19,9), 1-54. 5 A ='RECORD L,R: BEND; 6 VAR X: B; [2] PreliminaryADA Reference Manual, SIGPLAN Notices 14,6(1979). :. END; 7 BEGIN NEW(X); X" 'A' 8 BEGIN Q END.

    1 PROGRAMP3(OUTPUT); 2 VAR F: INTEGER; 3 PR~CEDUREQ; 4 PROCEDURER; BEGIN WRlTELN(F) END; 5 FUNCTIONF: INTEGER; BEGIN F := 2 END; 6 BEGIN R; WRITELN(F) END; 7 BEGIN F := 1; Q END. 1 2 ""> .....en AN ALTERNATE APPROACH TO TYPE EQUIVALENCE wiae to prohibit multiple nsmea for the aame type. Typea are aaaigned to variablea ,....> rather than valuea, because 1 wiah to allow distinct typea to exist with the same z: William 1. MacGreRor value set. ,."s:: Bol t, Beranek. 811d Newman en SQ Moulton st. P2. All types are either predefinedor created in s TYPE definition Cambridge, m ;)21)8 part.

    The only function of the TYPE part ia to define new typ~s; the only function of the One of the strongest festures of Psscsl is the sbility to define new dsta VAR part is to define new variables. Aa obvioua as this may appear at firat glance types. Because thia ability ia central to the language it is unfortunate that the it is a very strong restriction--it i"",liea that all types muat be explicitly named original documenta deUning Pascal (1.e., the Jensen and Wirth "User Manual and in a TYPE part. For example, the Standard Paaca1 fragment Report" and the axiomatic definition) did not precisely state when two variables or values are of tbe same type, or preciselywhat constitutes"type checking" in an VAR aasignaent statement or procedure call. Language designer a have exerciaed their v :ARRAY [1..100!OF REAL; akill and imagination in attempting to reaolve the ambiguitiea without unduly e :(red,~lue,green); diaturbing the "spirit of Pascal"; this note is one such attempt. would have to be rewritten in order to conform to principle P2 Recently, the BSIIISO Working Draft of Standard Pascal waa published in Pascal Newa '14, and this standard exhibits a particular (and carefully considered) aolution TYPE to the type aquivalence problem. The technique is a hybrid of name and structural vector ARRAY [1..100) OF REAL; equ~valence; for strinBs and sets, the atandard specifiea a atructural definition of color (red,blue,green); type equivalence (for a diacuaaion of name varaua atructural aquivalance, aee Welsh, VAR Sneeringer and Hoare, "Ambiguitiee and insecurit1ea in Paacd", Software Practics and v :vector; Experience, N 7, 1977). While the solution is relatively direct it leaves s great e :color; deal to be deaired, for inetance, under the proposed interpretation all variablea which are structurally integer or sub range of integer are of compatible types. Since Thia principle will force the creation of many naw namea in a typical pr08ram, one ::s the criterion for type equivalence is a function of the underlying structure, for each type, but at the same time it provides the basis for a simple and explicit > seemingly inconsiatent caees arl.e. After the proaram fragment teat for type equivalence. In fact, the spread of names can be controlledin a .....X> manner deacribed below. ::r VAR x :PACKED ARRAY [1..10) OF integer; P3. Every clause in a TYPE definitionpart (i.e., every uae of the y :PACKED ARRAY (1..10) OF tnteger; operatorIt_") createsa uniquetype. u : PACKED ARRAY [1..10) OF char; [ v : PACKED ARRAY 1..10) OF char; This principle, too, seems like good common senae: the TYPE part exists to define new typea. (It is interestingto note that the proposed Standard Pascal allows new the .ssign_nt "U:-Vlf 1. lelal whereas tlX:_Y" 18 not. (The first must be permitted types to be created in a VAS part, and doesn't require types to be created by s TYPE to include atstements like "u:.'sbcdefghij''', and the second is presumsbly denied to partl) limit the complexity of the equivalence definition snd forthcoming Stsndard Pascal ) co..,llera. P4. Two variablas have the aama type if and only if thay are declared with the aame type nsme. The rest of this note deacribes a different role for typea and type equivalence in a Pascal-like language. The scope of the aolution is strictly limited becsuse In other words we adhere to a very strict form of name equivalence, After the TYPE significant extensions to the syntax of Paacal were not ~onaidered (thia eliminated and VAR parts intereating but grandioaa achemea involving a new unit of program modularity, aa well aa the poaaibility of explicit type tranafer operatora). The detaila are developed TYPE from a meriea of principles embodying my underatanding of what strong typing means in speed - .real; the context of Paacal. weight - real; VAR . . . . a.b : .peed; x :wel8ht; y :we18ht; PI, Every variable haa a unique type and a unique symbolic type z :re81; -0 name. en> the variablea a and b have the aaee type (namely speed); x and y have the ssme type ,." Since both the typa and type name are unique, the type of a variable can be referrad (weight) and no othar type equivalences exiat. to by ita aymbolic name without ambiguity. In the intereata of aimplicity it aee..

    / .. - - PS. In every assignment, the type of the variable on the left muat "real" . be the same as the type of the expression on the right (exception: lntegets may be aasigned to real variables). With S088 information about context, these principles are sufficient to deduce the type of an expression or subexpression, or to select the correct operator for an I believe thb is the sillplest definition of "strong typing". To continue the overloaded operator symbol. Given previous example lIa:_b" 18 a legal assignment but "a:-x" 1. not. even thoulh the values of both a and x are real numbers. Since parameter ~ran8m188ioncan be IF 3 < round(x/4.S + 3.0) THEN... described in terms of assignment this principle applies to parameters in function and procedure calls; it forces an exact match between the types of formal and actual the operators in the boolean expression must be parameters, and it implies a careful interpretation of operator overloading in expressions (discussed after P7 below). < les8 than; integer < integer -> boolean round weight integer The exception is galling but historically founded. It ia pervasive, as will be -> + addition weight + weight -> weight seen, becauae it implies that any type derived from integer is assignment cOllpatible / divide weight / weight weight with any type derived from real. -> and the conetante 4.S and 3.0 muet both be of type weight. In a few cases involvin. P6. The types of all constants (aimple and structured) are only constants, it may not be possible to determine the constituent types, but the deter.ioed from context. correct action 18 obvious, e.g_,

    There is no way to avoid this, given PS and the fact that variables of different IF 3 IN {l,S,7,12}THEN... types may have the same value set. Continuing the example, if the statement "a:-4.7" ia legal, then by principle PS the constant "4.7" 18 of type speed; but if "x:-4.7" does not permit the determination of a unique type either for the set or tha baae is also legal, in thia case the same value has type weight. To reconcile thesa type of the set elements, but the value of the expressionmust be false in spite of cases, the type of a constant muat be permitted to be a function of ita context. that. (Note that P6 paves the way for the introductionof other typee of structured conatanta. e.8_, record and array conatants; the proposed ast type equivalence P8. A subrange is a global constraint on the set of values assumed definition doea not extend so easily.) by a variable; it does not create a new type.

    P7. A created type inherits all of the predefinedoperators on its Sub ranges are used for many different purposes; sometimes it would be useful for thea underlying type, but none of the user defined functions or to be distinct types and sometimes not. For this reason it is a good idea to procedures. accomodate both uaages--if there is a simple way to do so. At this point I ad.it to .... bending the rules, and introduce one minor change to the Pascal syntax, in the form 1.0 This principle ia admittedly a coapromlee. Since the ground rules forbid syntectic of a typed subrange. A declarationof a variabls 00 extension., the promotion of opsrators to the nsw type must be automatic,and the <:> only iasue rsmaining is which operators should be promoted. A primal set of :integer 1..10 opsrators is specified in Standard Paacal; this providea a natural partitioning. (If ussr dsfined functiona and procadurea were promoted aa well, ambiguitiea would result means that the type of i is integer, but its values are constrained to the cloaed which could only be resolved through explicit typing of constants.) interval 1..10. A typed subrange consists of a type name followed by a subrange cOBtained in the value set of the type. If the type name is omitted, it is aesumed An operator in the language (e.g., +) conaists of a semantic action (e.g., to be integer. If a typed aubrange appears in s variable declaration, the variables addition) and a "signature",a tellplategiving the types of the arguments and reault havethenamedtype;but if the typed subrangeappearsin theTYPEsection,it of the operator (e.g., integer + integer -> integer). A user-defined typa extends participatesin the creation of a (range restricted) new type, just as required by the set of operators available to a progrem, implicitly creating new operators from P3. For example old onea by combining the old ssmantics with new signatures; each new signeture is obteined from an old one by uniformly substitutingthe new type name for all TYPE occurrencea of the base type in the old signature. For example, all programa will hout 1..24; initially poaaess an operator + defined by VAll : integer; addition; real + real real + -> am :hour 1..12; pm :hour 13..24; and in a p~ogr... containing the declarationsof apead and weight above the operators h :hour;

    + additioD; speed + apeed -> speed The variables am, pm and h are all of type hour, and the aasigD88Dts "h:-am" and + addition; weight + weight -> weight uh:-p." will alway. be valid; "..:_p.n will never be valid because the value seta of amandp. are disjoint;"am:-ill. up.:_i"and "b:_t"are all prohibitedby type are also available; but it would be iaposaible to add a "speed" to a "weight" or a mta_tch. ***************** FIXING PASCAL'S I/O by Richard J. Cichelli . . . . There have been a flurry of articles advocatin9 modifications to Pascal's file facility to improve its functionality for input/output. Here, questions regarding tenninal I/O and relative record I/O will be diswssed. These.principles lead to a view of types very different from the 851/150 Many criticisms of Pascal's file facility contain arguments that Pascal's Working Draft. It is a much 80re restrictive world, emphasizing type safety at the files don't support the full data set manipulation capabilities of the host's eKpense of flexibility. I suspect that neither approach is clearly auperior for operating system. An alternate view of the situation is to ask if the problem Ugeneral purposeu use, but the reader can form his own opinion. to be solved can have its solution cleanly specified as an algorithm in Pascal. If so, request that the Pascal compiler'/system writer provide an implementation Finally, a suggeation for controlling name proliferation appeared in an complete enough to run the program efficiently. In short, buy compilers and entertaining paper by Robert G. Herriot, "Towards the ideal programming language" computing systems to run your programs rather than write programs to instruct (5IGP~ Noticea, V 12 N 3, March 1977). Herriot propoaed the use of Engliah your (particular) computer. articles ("the", "aft, "an", etc.) and adjectives to create variable namea. With this Wirth created Pascal files. In the Revised Report Section 2, paragraph 10, syntectic mechanism, the fragment Wirth defines them as sequences of components of the same type. Although an implementer may map Pascal files into sequential data sets, this isn't required TYPE by the definition. The Report doesn't seem to require that the ideas of I/O car - (ford,GM,volkswagen); and files be associated. A valid Pascal implementation could exist on a system VAl. ~Ihich lacks backing storage and a third generation file system. If this is the :carj a car case for your system and you still can run your Pascal programs, what do you a sporta car :car; care? Besides, future data base oriented systems may avoid the redundancy of a compact car :carj a "file system". The problems of named data sets and directories are obviously a blue electric car :car; best dealt with in terms of local predefined (not standard) procedures. For legible input and output (Report section 12) Pascal has a special type would declare four enumerationvariables,referred to in the program text as "the of file called a text file. Text files have a special substructure and special car", "the sports carll, lithe co.pact car" anJ "the blue electric car". ThuR names procedures and functions. Since sequences work and Pascal has appropriate fa- for variables can be directly manufactured trom type names, frequently impl~ving the cilities for manipiilating them (1.(:. the Pascal file pi i,,,:l.i\',.).it ~I(Juld be program's readability. very strange if you couldn't make Pascal talk to terminals. Wirth specifically mentions them in the first paragraph of section 12 and, guess what, many imple- mentors have succeeded in implementing exactly what the report calls for and having facile terminal interaction as well. One of the techniques is called "lazy I/O" and it is fully detailed in Pascal News #13. There are those who want to put random I/O or "direct access files" into o.D..... Pascal. What's Pascal missing? Surely not random access. In the Report sec- 00 tion 2, paragraph 6, the array is discussed and specifically called rando!:1 o access structure. "But", you say, "I can't fit big dil'ect access "files in core". E~ery implementation of Pascal is likely to have some restrictions. Perhaps an array will need to be stored on bulk storage. Would you embed this DDDDDDDD limitation in the language and in your algorithms and programs? If you need to worry about a hierarchy of memory access fac il it ies in these days of v'i rtua 1 memory, etc, then a pragma or c~npiler directive might be the appropriate mech- anism for suggesting to a particular compiler that certain data be placed on backing store. Note: There is no prohibition to passing arrays (e.g. an im- plementation relative records I/O) as program parameters. See the Report sec- tion 13. Program parameters can reference any external object. It is only suggested that these are "(usually files)". Thus arrays and pointer based data structures can be external objects to Pascal programs. (The "(usually files)" reference has been removed from the current draft standard document.) Al,though doing relative record I/O ~lith Pascal arrays may seem strange at first, adding the unnecessary notion of memory hierarchies to the language is far worse. The IBM System/38 has a uniform 48 bit addressing mechanism. A System/38 applications progra~ner does quite well while being unaware of the storage location of his data whether it be cache, core, disk boffer or on disk. If the 38 can be said to auger the future, then certainly Pascal shouldn't take ..., a step backwards and introduce concepts which provide no additional functionality ~ In summary, fixing Pascal's I/O only requires implementing what the Report ~ suggests. ***************** JMIU( OFMltJU,M,&; JOANNA WtSNIFWSKA fllnctio't (,'eala (pl'OtCdtlfO 1):col'OIJli.lell); Creates a now prOCCS::i (curoutine), wilh tile same allributes and tile hody us in the Instilute of Informatics procedulp. given as a par..meter. Thi~; cUloutine IS slw h~d; alt~r an initial ~KIII it University 01 Warsuw should call Det.ach (see llHlow). COlltrol then returlls to u creator, P O.oox 1210 and the Itlnction ()(J.{){]t Warswwa retw ns as its vdlue U ulHqUtt cor oulion idelitifiL:r. flw first IlHllino calhoH this function 18 called H 1001 of the whole gel of coroutil1es Thele IS a lestriction that PoLAND Crea la may be laler called either uy Ihn loat or hy any other c.;oruutlfle, but lIot in its initial purl (I,e. no no sting of Ll'tHllo culls i:J allowod). pl'ocedul'u notaeh; flnishl.~ an initial part of u coruulinv and retwns control to its creator. Simpascal IH'OCtHIUI'o Stal'l (f:col'oulineIO; mi\xlime;l'oal); Starts Iho coroullOn C, thus initialiny the whole ttilllulation. II should l>e pointed thai, unli~e ill . aft root is lIul it t:Uluulillc ilsnlf ami /Hay he w:.ulned ouly aflor linbhinu tho SiluulullOIl. Simulation HlHls as soon as Iht!JO is no pIOU~S5 in Iho sas Int roductiol'i vfflhi.tS;'ttme less"Jhttl1".UJ.p\i"iU4xt ime par~mlt1lcrol Stal't nus routino may be culled only by the root. This article presents a new, extension (called .Simnancal) 10 Pascal. The goal of this pl'OcfHtul'e Activate (L:t.:ol'outilluIO; delaY:f'enl); exlunsion was to provide faci""~s for :mouiilliny ulscrete tllne systtJlIIs in way siIJular to Makos tho coroulint: C IDady, ie inberhi It into the SQS. Its time will he equal to the tht1 ona adoplod in 81111ul Removes the coroutine L Irom the SQ~. If thai was the current coroutine, tile next ::c Simpascal was designed as a pari 01 the aSKit Project (simulation 01 operuting syslems n [1H at the. Institute of hlformatics: .LJnlvo"sity 01 WarsiJw. Ih~se ext~nfiions wore necessary coroutine from the SQS is resumed. :z:: since m051109 slnndurd Pascal fucllltlBS didn't allow one to wnte a slIHulfitor in this language, funct.ion lillie (C:col'outlnellJ):raal; .... The reason lor creat"'g a new tool inst"acl 01 using S,"1Ulu was mainly beller performance 01 Returns tllne of the coroutine C, u:> the Pasc..1 obJect code. Besides, all other parts of Ihe project (dala inpul preparation and 00 output analysis) had been already willlen ill Pascal. pl'ocadura 1t01d (increment:raal); C> Suspends the current coroutine, increases Its time by incremenl and resumes the A general design 01 SIInpascal and its implementation on the CYHHII3 were made by first coroutine from the SOS, Jarek Deminet, while SUIII~ improvements and thtt 360 version were prepared by Joanna W.sniewska, A stanclard Pascal compilur was used un the CYBElI/3. 360 compiler wae functiol1 rl,is:coroutiI1810; produced at the Institute 01 Compuler Science. Pohsh Academy of Science, The whole work Returns an 10 01 the current corouline, lasted approximately 6 weeks, There is one very unpleU3ant and artilicial restriclion for a call Ihe so-called :;peclal routines, which may change an active coroutine (Ie Activate, Pass.0' Cancal and 1I0Id), If any 01 those is called from a Simpascal subroutine, called in turn (directly or Description indirectly) 'rom a coroutin~, then all subroutinos down to the level of the coroutine will be immediately terminl\lcd, That means that the coroutine IS suspended and reactivated alwaya A simulator in Pascal (as in Simula) consists 01 some number of coroutines. each of at its own tevel, This concept was called twshmg and is necessary 10 ensure sluck which implements one process, At any given time one of them is aclive and the others are consistency, suspended, Some 01 the laller may be ready to run and wait in a so.called Sel/uell/iut Sel (SOS) , other are lI/oche(1. SOS IS ordered according to inc.reasing ""1(}. which is an allribute 01 each process. Full description of Ihis idea may be lound in 12), From this pain I on, a term rouline will mewn either a coroutine, subroutine or the main program, while a subrouUne will Implementation be either a procedure or a function, The data structure on which Simpascal subroutines operate is very similar in both In order 10 provide all expected functions the following subroutines were implemented: implementations so it will be presented here in a relatIvely machine mdependent lorm,

    en en Each inslanlialion 01 every Pascal routine is defln,,!! by a segment on the stack (Ihe , PIHvious IOUtillC routine is called an UWllt'(01 this seynumt). Eat;h slIe!! segment (except the lirst 01 corresponding to the main program) consists generally 01 two pails; Oliok EnvirOl11nenl defulitlUlI Contains all mformalion necessary to refer non local objects, to salely execute a SUnk return jump, and to perform all t;:11or handling action if necessary. Local data Contains local variables (which include also parameters 01 the call, cnmpiler- generated auxiliary vLtllalJlldsami ~jnilce for reijlsturs saved in case 01 further routine DUnk calls). Generally, this part is 01 1\0 interest lor Simpuscal, excl!pt tor regislorsaving SUnk space.

    A base (all addro~s 01 th~ iii SI word) 01 the seUlOol11uf the currellt Iuuline is pointed by one of theregistfH'&(a B r~lister on CU<.;" a Helleralpurposercgiswr 011 18M), whichwill be Main pfOgUtl11 called a Base negishH (Utley). Also the lirst 'rtW locatiun ubove a top 01 tha stack is pointed by a regisler (Top Flegost", or Tfleg).

    In case 01 ordinary Pascal subroutinesinformationin the environmentdefinition is as follows: Figure 1. Pascal stack structure. Static Link (Slink) Points to a base 01 the segment definingthe lato:}t instantiation of the routine in which the segmenl's owner was declared. A chain 01 those links defines an access path to all non local objects_ This link is crealed always by the caller, according to its own access palh. Dynamic Link (DUnk) Points to a base of the previous segment on the stack, io the segmenl correspolldingto the routine which called the owner 01 this Sttument. It is used to restore the BI1e9 belore retuon ami to produce a Posl Mortem Dump should nn ..... \.0 error ufrive. 00 This link is created by the routine itself using the old vulue of BReg. -- o Return Address (RAddr) Contains the address to which control shuld I.>e translerred in a return jump. SllUIUlllillC This address is provided by a caller (passed through a register)_ _ ----.-..---.. Figure 1 presents the ganeral structure of the Pascal slack. BI'ley -. Dlmk -.. - -- --. The same data struclure had to be adopled in Simpascal. since the code 01 coroulines was to be the same as lor normal subroutines. Sevaral assumptions had 10 be made, however, to ensure a consistency 01 the structure: CO! oulino COIUtltjl1t~ All coroutine segments occupy a conliuuous space on the stack, directly above Ihe segment detining the root 01 the system (there may be no other segments in _._._-_._----~. between). '>Ii'lk -_4------The stack 01 only one coroutine at any particular time (the active, or current coroutine) Nuoali....O 'Jail may consis! 01 mOle than one seyment. This would mean that no action which implies a change of the active cOloutina may bo ullder1aken Irom any lavel other than the level 01 the coroutine itsell. r0 allow coeating of user defined conlrol trunster subroutincs the concept of IHI~hIllU (dHm:nued ulJove) was adopted. Us I\I\ce~lof implemcnt:,tlof1 is very simple: any special suhroutine removes from the stack ull segments loom abovo the block 01 the coroutine segments_ Main

    Figure 2. Simpascal stack (only some parts shown)

    / lhe fie!lmonl for eilch enroulino ww. c.;Iwnued III a Itlanner Invj"OIhle to oldinilry routine codo. rimt. iI iWUiltlllv p.1/1 WiI:; addt~d !It.olll;UflS a 1\!~;lafl addl(~ss 101 an inacllve coroutine, ***************** and also ~omc addillolli.ll mfonHaliwl (tI1I11!, status alld sonle poililers) us(:d by routines which handlt~ alld ~..equt:flt:I> IJroCf~~;~;Wj.Ttw 'IIt~ilnill~1 of SOIlU~ !.Iandard fiuldt1 was also modified. SIIlCt~ the a:i:;lllilpiion I~, Ihat iI coroutiliH will I1t]vm execute it Idurn IlilUP (hf~CCJlIse it would de:;troy the stlll.k struclult!), HAddr point5 to an error. handling loutine.

    DLinl~, ill turn, no IOl1qm puint~ to tho l'fOVIOliS fiegllltJl11 011 tho stack, sillcn if is not illtcndt~d to be lIsl~d10 lIpdall.' tho rJlfcD. I'\m:aw,c! lit :;U!lh: functloll;; playmt hy DLiI1I( during stand.ml t-.HIOI'huncHiIlH, II wa:~ df!l;lllnd that IIlIs It stlUtild poilll to a base of the root's seyment.

    Contonts of URcU, riley and 5t ink we'e left ullchanged. Fi{lllfO 2 illustrutus tho uenmul 1;tack nlruduw ill Simpascal. The U ni versity of Tasmania Post.1 Address: 80x 252C, G.P,Q.. Hobart. T.sm i.. Austr84i. 7001 In urdU! tu hLlvo such a utruCIWH, tht! followiny actions have to ho porformud by C.'eato before culling a coroutinH' rlt.phone: 230661. C.bl.,'r.,uni' r.lex: 58160 UNTAS . setti 11(1 BHell 10 a base 01 the root; IN AEPl Y PLEASE QUOTE incrclllenling '(I Icy by tho size of the neyative part of the segment; FilE NO . sottillg SUllg aceoldiny 10 infUl iHiltion which is always a part of the actual.parwneter- descriptor in u (.aIlLJY'Jjroc0dure in Pascal IF TElEPHONING OR CALLING

    ASK fOA

    Results

    Several programs havo already been written in Simpascul ami run on both machines. fulfilliny all CKpectations. A companGon wllh SIIHulu shows thai a progrum in Simpascal needs 50 to 80% less memory and l>O tu 70')6 less tllne. This is mainly due to much simpler memory struclure allowiny beller performance 01 Ihe code. Someobservations on Pascal and personal style .....

    [1) tepperl M.. Madey J., Schroll R. : liS Sliltus nopo,/ Report 773D, Technisd1tiS lJnlversllal Munchel1, Munich, Germany; Report 63, In"tytut Inlormatykl Umwersytetu Warslllwak'dgo, Warsaw, Poland Background

    (j7 Recently, arising out of a course I gave for microprocessor engineers and (2) Simllia Common UW;!' IliflUlIllUO Pub!. no. SU, NorwtJu1iln Computlnll Ct!nte', Oslo, NUlWIlY their possible use of Pascal, I had to write a program of around 800 lines to control a hot-plate assembly (as might be installed in a home with provision for switching the hot-plates individually up or down at selected times). The purpose of the program was to demonstrate the viability (and superiority I) of Pascal for microprocessor purposes over assembly code or Fortran. The experiment was a demonstrable success, taking one man-day to writ~ together with its correctness proof, and another man-day to transform the abstract program into one having some useful properties for ~icro- processor Pascal compilers and run-time support. The experime't will be reported elsewhere; by contrast the writing of the consequent paper has consumed over a man-week, and nearer two...

    However, in the course of writing this up, ! came across some interesting facts I should like to share with the readers of Pascal News. They relate to personal stylistics, and use of Pascal's features. None of the reported statistics here were considered specifically while writing the program: they reflect a personal style. Identi fiers contains 120 The program identifiers and one label (as a consequence of a 7rans~onnati~n to el iminate a task). ' The length distribution of the 1dent1 f1ers 1S shown in Figure I. It is interesting to note that approximately 55\ exceed 8 characters in length, and approximately 2710\ exceed 10 characters in length. These correspond to the significance limits of the Pascal Standard and the Control Data Cyber compiler. The 8urroughs 86700 compiler I used has, of course, no limit on significance.

    Since the 86700 compiler is good in this respect, it is possible to write programs which work on the 86700, but .which give rise to compiler error messages (or worse, altered and undetected scope renaming) on systems with limited significance. How often does this occur? Fortunately, the STANDARDoption on the 86700 compiler checks the possibility of any such events. The answer seems to be: surprizingl}often. In previous programs I have seldom been able to escape changing an identifier name to avoid problems elsewhere, and it happened twice in this program. The instances were: nwnbeI'ofeuents (an integeI' uaI'iable) NwnbeI'OfPlates (a "onsta'lt, alteI'ed to NoOfPlateB)

    DiBPlay Type (the type of the diBplay I'egiBteI') DiBplayTime {a pI'oaedwoe, altered to DiBplayATime) 1 draw the conclusion that any compiler that has a significance limit greater than 8 characters ought to perform the same checks; software I receive from elsewhere often exhibits the same problem. I also conclude that the 8-character limit is a mistake, and should never have been introduced into Pascal.

    The 86700 compiler also produces as a by-product of this checking a list of instances of renaming under the scope rule:L NQne were reported in this program at all, which surprized me. Usually i and j crop up with mono- tonousregularity,but in this case it appeared that the lesser numeric orientation and the program structure minimized this...... <.D 00 Letter Cases C> As the examples above indicate, the compileracceptseither lettercase in accordancewiththe Pascal Standard, and I write programs in predominantly lower-caseletters. I dislikethepracticeof capitalizingthe reserved wordsas it has a bad effecton readabilityforme. However,during the course of this programI found myselffallingintoa practicewhichI had neverused before, but which seemed to be useful. I offer it as an example of the differences in personal style that can arise with a little thought devoted to stylistics.

    The practice I adopted, more or less by chance at first, was to write variables in all-lower-case,as in numberofevents,but constants, types, and proceduresin mixed-cases,as in NoOfPlatesor DiBplayATime. Rationalizingit after the event, I noted that variables often have shorter and less complex names than other objects and thus may have less need of extra lexical cues, and procedure names are often the longest and most complex. Sometimes these are a verb-phrase,while variable names are more noun-like.

    The practice improved my understanding of the program, mainly because 1 could detect in expressions which were variables and which constants. Such slight cues are worth a lot more to me than emphasizing reserved words (which I knowvery well)~ Example: 0'1 if {time - LastMinuteOfDayJ than begin 1.0 I am not yet sure whether this will be a stable feature of my future style.

    /' Line Layout 1 used my usual line layout and indentation rules, reported in Sale [1978], and had no need to edit or correct any semicolons or ends. A consistent style minimizes these trivial but annoying errors.

    Conunent s classified the comments into three categories: (a) Marker comments, used to assist picking out corresponding points 1n a program, typically attached to an end to show what it is the end of, or to pick out a procedure name by underlining. Little semantic content. (b) Procedure heading comments. These have considerable semantic content, and outline the purpose of the procedure. (c) In-text comments, which either give additional information relating to the execution, or explain definitionalpoints. They vary all the way from a hint: (Midnight changeovel') to an assertion: {Re-estabLishing the invariant: Ri ¥ '~LL events up to and including the one pointed to by the 'pl'eoeding' pointeI' are due to OOCUI' befol'e 01' simultaneously with the new one. Also if state=E:x:it thel'e are no mope l'ecol'ds that satisfy this oritel'ion."

    Procedures and Functions ::s The comment characteristics are shown below. > Having arrived at a suitable transformation level by eliminating tasks from , \ lines "" Kind of comment no lines the conceptual solution and substituting interrupt-driven procedures (Ves, :z:: spanned spanned - I know they aren't standard), the resulting program had 18 procedures; .... functiens, including the main program. Other statistics are:

    The closing comment marker (")") was aIW~YS the last non-blank character Parameters: of the line it appeared on. Since one-l ne comments make up 80\ of the total number of comments, and 51\ of the total numb!,r of lines spanned, here is support for the idea that comments delimited by end-of-line require no more keystrokes than brackettea comments. (Apart from other, better, reasons for preferring them.) The low frequency of parameters is explained by the nature of several of the procedures: they are refinements. In fact six of the parameterless The distribution of comment lengths, shown in Figure 2, emphasizes this. procedures are called from only one place each, and a microprocessor It is certainly influenced by my habit of putting correctness assertions engineermightwellapply a transformto put theircode in-lineand their and hints in the code body, thus reducing the size of procedure header local data in the caller's stack. Personally, I exert pressure on compiler comments. (The comments often share lines with code, so do not make the suppliers to make their compilers do it automatically: detecting the once- mistake of assuming that the program contains 190 lines of waffle together only call is not difficult for a multi-pass compiler. On the 86700 sucha with the 157 blank layout lines). transformation would save 54 bytes of code out of a total of 2304 (2.3\), and would also speed up the execution slightly.

    The maximum level of procedure nesting is three, and this occurs 7 times. This is astonishinglylow for me, since my-re1Tnementsoften creep up into the 10 to 12 levels deep. Analysing it after the event, I conclude ...... (a) to the complexity of this that the low nesting level here is due (b) o problem being in task interlocking, not in algorithm complexity, and to several refinements being pushed to outer levels for use in several contexts (by the sub-tasks). ~ "unna ry As might be expected, real numbers are not needed in this problem. The purpose of this little letter is to give you some insight into The usage of different types in the program is shown below: some personal stylistics in the hope that you will examine your own equally carefully and ask yourself whence they came and why. Pascal is no language for nongs who mindlessly copy others. 1 also definitions uses in var or type hope it may give some ideas to compiler-suppliers on the sorts of -._-- things I do. If you ever want to please me, here are some hints. boolean (1) 2 Preserve the abstractions and make any limits on what I can do at integer (1) 0 what I call virtual infinity.... char (1) 0 real (1) 0 user-definedscalars 6 7 subranges 0f ~' scalars 1 1 subranges of integer 9 30 - records 1 1 arrays 3 8 sets 4 8 pointer types 1 4 files 0 0

    The absence of integers arises naturally because no negative numbers occur in this problem, and because the range of every integral value is predict- able. Only innate laziness allowed one of my favourite types: Natural = 0 .. Maxint; DODD in to substitute for the type of a value parameter which ought to have had a special type declared for it in the outermost block: l} TWoDayeWorthOfNinutee . 0 .. 2879; {2'24'60 - I salved my conscience by adding a comment to this effect, which probably took more time doing it right...

    Of some into rest is the ratio of user-defined scalars to uses of pre- ...... <.0 defined types (7 : 2). This is a measure which I take as roughly indicative 00 o of a switch from other language thinking to Pascal (or abstract) thinking. lbe problem isn't big enough to draw any more conclusions.

    Boolean expressions Some people, on seeing my programs, adopt a knowing look and say, "You used to be II Fortran programmer, weren't you?" and point to an example like: if (event list . 0) then begin Since this is totalmisunderstanding,it deservesa few words. I usually put parenthesesaroundeveryrelationalexpressionI write. The prime reason is that I find it greatly improves the readability of the program in that the limits of some complex expression can be more readily found, as for example in: if (modulooounter in pattern[plate(i]]) then begin Open Forum for Members But having done this for a long time, it confers several other benefits: (a) I almostnevermakemistakesin writingexpressionswhich the Pascal syntax will parse in a way I didn't intend. (The few priority levels are well-known as a trap). (b) 1 have to devote less thought to trivia while writing programs, and therefore more thought to correctnessproofs, simply because I use codified rules...... To illustrate the point, the same thing happens in the following example: IeT1B6foreT2 :- (tl < t2);

    / - - - -. - Andy Mickel January 23, 1980

    Yale University NewHa"...,Connec'icUI06,lo these systems are complex by definition, and thus a full DISPOSEis probably not excessive. In this case release effectively signals the SCHOOL OF MEDICINE garbage disposal system to function. 333 C,th,S".., An extension sorely needed is simple arithmetic in constant definitions, Seelion 01 LrbOftIJory M.ai,i"e allowing all compile time constants to be slaved to a single definition. Similarly the use of OROand CHRfunctions in constant definitions would be useful. January 23, 1980 Implementation of goto's out of procedures is virtually impossible (at reasonable cost) on many machines. The HP3000 is an example. I would therefore recommend that the standard does not require these, and that they be considered an extension. Logically, I have never found such Andy Mickel goto's necessary, and in addition such use customizes code segments to University Computer Center any overall program, preventing direct re-use. University of ~innesota Minneapolis, Minnesota 55455 I amalso running the USCD Pascal System, VER11.0. Users should be warned that, as supplied, this does not detect integer overflows, (at Dear Andy: least on 8080/Z80 Systems), and that the complement of -32768 is O!! with no warning,Some stack overflows can occur without trapping in Yesterday I called and spoke to Rick Marcus about a bug I have found in addition. Myrevised interpreter cures these problems, when many 10210. Myversion is attached, together with the data that showed the system programs proceed to crash on integer overflow, and thus the over- fault, and the symbol table progression in the original system. flow check has been made switchable. The USCDSystem does not detect EOFon the remote files, and thus cannot read text files remotely with- Please consider this as a letter to PUG,and pass it on accordingly. out considerable contortions. attach a second copy for the purpose. Sincerely, ./ _r-' OnPascal Standards, I have several observations. First, based on Bob <7f ,/' Fraley's HP3000 Pascal Compiler, I feel the need for a standard procedure C~~.,;. , . PROMPT (FILE) Charles Falconer ..... Chief Instrument Engineer which will have the effect of a writteln without causing a line-feed or

    ...... N

    11.- .. - - fA T

    Carnegie -Mellon University Department of Computer Scionce leading blank. I .u~,gesl rewr'iling lhe spedfication Schenley Park so that tlds is ('lear - by noting that 0 rather L!I;li\ Pollsburgh. Pennsylvania 15213 1 leading blank is required. 1 have seen the notation Ihite(Va]: 1) used to olean: Use Lhe smallest possible Ueidwidth. A cuLe use of Lhe sp(.dUcations, but it. obscurity is not in the .pirit of the language. Perhaps \:rite(Val) ()ught to prinl Val in t1tt~ sl.Ja11es( Ucld\1idlh r(Js~:;jb)c (no leading blanks dther~) while a fixed fjdd,ddth I,'ouid be used only if spccHied. This would unquestionably be lhemosL pleasant solution for most users, especially novices.

    The l~r1te(\'al: J) idiom is deficient for "noLtler reaSOI1. Many implementors have chosen to implement output in an undendzcd field January 29, 1980 by writing out asterisks. A good case can be made for this, and I 8uspect many Pascal implementors will continue to do 80 despite th.e standard.

    A.M. Addyman Sincerely~ Department of Computer Science Univeraity of Manchester Oxford Road Manchester M13 9PL El11. Cohen England

    Dear Professor Addyman:

    I wae delighted to see the proposed Pascal standard in ~ ~. In general, I think the proposal is excellent. However, there were a few points that troubled me. BRlnSH COLUMBIA HYDRO AND POW.R AUTHORITY - Textfiles. 6.4.24 seems to require that every textlile end wilh a linemarker. Is thal intentional? If so, it must closing a file(used for writing)force a linemarker Red Stripe Computer Trailer to be output if one does not already end the file? Gas Diyision 3777 Lougheed Highway Pages. It seems bizarre to include a standard Page Burnaby, B.C. procedure without specifying the effect on the file V5C 3Y3 CANADA or includinga procedureto testfor end of page . 1<1f!O Ja'\ l.L 1 propose.making the procedure optional, but if it i.. ""'j included, require that a E!&! ~ be written which Dear Pug i..(like a linemarker) read as a blank, and that an Eop (end-of-page)predicate be included a..well. Additional questions: Should Eop imply Eoln? Should I wrote a while ago about banning the marriage of PAscal and EBCDIC. Page force a Writeln automatically? I think I stated a decent character set should have the following property "ORD('9')"'f'RD('O') should be B" That should read "ORD('9')-oRD('O') should be g", The CASE ..t..tement.1 mu..t y 1 em eurprieed the OTHERS clause was not included in the standard. 1'. If you decide the publish that letter, please correct the mistake: equally unhappy (but less surprised) that subrange.. Please do not publish this letter. were not to be permitted in the case-con..t~ntlist.

    Numeric output. 6.9.3 requires...leadingblank lot e number that fit..in the output field, while no leeding Thallks blank i..required if it does not. So, in the case of e number who..ewidth ia the same as the fieldwidth, the number ~ printed out in just that fieldwidth~ a

    / :J>'"'0 V> W INT H HOP PUBLISH EHS, INC., ..., THE CITY COLLEGE ",-." ~.'rld," _'..m "'""~..,,. t""> (!f? o. r-:J> THE Cln' UNIVERSITY Of NEW YORR z: ~ NEW YORR. N.Y. 10011 IT! V>-= SOPIlIE UAVISSCIIOOL OJ.' Wednesday, January 30th, 1980 (!12Ifi90.6629. 8255 January 8, 1980 BIOMEDICAL EDUCATION ...... '"" Ri ck Shaw Professor Andy Mickel PASCAL User's Group University Computer Center Digital Equipment Corporation 227 Experimental Engineering Bldg 5775 Peachtree Dunwoody Road 208 SE Union Street Atlanta. Georgia 30342 University of Minnesota Minneapolis. MN 55455 Dear Rick; Dear Andy, Enclosed is n~ personal check for $2G.00; please enter n~ subscription/ I'm a little concerned about some possible unintended membershipto PASCAL Ne~ for this academic year 1979/80, and also send the effects of your brief book reviews section on page 8 previous two years' back issues 9 - 16. I would be glad to pay XeroXfng and of Pascal News. No. 15. mailing expenses (within reason) if somebody could furnish copies of your extinct issues 1 - 8. You quoted a table from a review by Jan Hext, of the University of Sydney, comparing Pascal textbooks in their In our mammothCUNY University Computer Center (Amdahl 470/V6 and IBM3033 coverage of the language. I am concerned that, taken under OS/MVT and ASP; IBM 3031 under VMand CMS). Stony Brook PASCAL 1.3 is ou~ of context, that table may scare potential readers standard. and Version 2S was just added to a test library last week. (I gather away from our book by Conway, Gries, and Zimmerman, from the documentation that both are rather limited in complex applications - A PRIMER ON PASCAL, the second edition of which is due for example. no external files...) Although I know of no campus among our 20 t:hia spring. where PASCAL is the prime teaching language, faculty and student use is clearly on the rise; we've just brought up 2 PASCALs on a PDP-I0 here in the CCNY There is no question that the coverage of Pascal in that Science 8uilding. book is not nearly as extensive as many other books ..... (although in the new edition it will be somewhat more so), I am involved in bringing up an orphan Z-80 microcomputer from the defunct

    Thanks for listening. Sincerely yours;

    regards, I I B~si . \ . ck ~ Charles F. Durang Alan N. Bloch, M.P.H. Editor, Computer Science CCNYBiomed J 910 Cl CFD/mw encl.

    .fN EQUAL OPPORTUNITY EMPLorER

    / If IF T T - \

    KI:RN .".TftUMI:NT8, INC. TELIE:PHON!E:: GENEVA ROAD. 8RE.WSTER, NEW YORK 10108 (tI4) 271.50'1 BRITISH COLUMBIA HYDRO AND POWIR AUTHORITY TELEX:

    8"'24 970 BURRARD STREET VANCOUVER. B,C. January 15, 1980 V6Z 1Y3 TELEx 04.54386 1979 December 31

    Mr. Rick Shaw Digital Equipment Corporation Dear PUG Pascal User's Group 5775 Peachtree Dunwoody Road Atlanta, GA 30342 re: outlawing EBCDIC and Pascal marriage Dear Rick: 1 have tried to write sometext tidyin9 routines with the While renewin9 my subscription, 1 am taking the opportunity to say University of B.C. Pascal compiler under MTS. It uses a few words. EBCDICas its underlying code. Arrgh: 1 have used two Pascal systems in my work here; initially, a ORD('l')-ORD('A') should be 25 in all decent Pascal implementations. Northwest Microcomputer 85/P with UCSD Pascal, and now a POP-II ORD('z')-ORD('a') should also be 25. There should exist a magic with RT-ll operating system and OMSI, Pascal I version 1.1. 80th number m such that you can do lower to upper case conversions. have advantages (and disadvantages). The UCSDoperating system ORD('9')-ORD('0') should be 8. (Even EBCDICgets that right:) (with CP/Mutilities) was fantastic, especially the editor. How- ORD(' ') should be less than ORD('A'), ORD('a'). and ORD('O'). ever, I/O handling (1 wanted interrupts) was poor. With RT-ll, I can use all the I/O facilities of this excellent operating system, ASCll has these properties. EBCDICdoes not. It is thus difficult but OMSIdoesn't support them very ~ell. Hopefully, this will be to write portable code. fixed in version 2 which is due any day now. I'm also disappointed that several Pascal features I used quite heavily with the UCSD I suggest that any Pascal standard insist that an "excellent" rated system are not implemented in OMSIPascal I, particularly the Pack compiler provide a compile-time switch to insist that all internal and Unpack functions. These are very convenient for formatting and character codes be ASCII even if this means translation in and out. unformatting I/O records used in certain peripherals. Alternatively, Pascals that live in an EBCDICenvironment that wish to manipulate all 256 characters should work internally on a 1 see almost weekly announcements concerning new Pascal compilers modified EBCDICthat has the above nice properties. A compiler and machines. Nowthat most of the established computer manu- that could not provide this option could only obtain a "reasonable" rating. facturers have taken up the cause, we can say that Pascal has arrived. So much so in fact, that I would not have resubscribed to To indicate the honrors of EBCDIC, consider that none of the following PUGif not for Arthur Sale's recent issue describing the Validation code works as you would expect. Suite. Congratulations to Prof. Sale and his group. !i C in ['a'..' z'] then 51; j..f C >= and C then 53; Nowit's up to us Pascalers to encourage the compiler writers to ' a' <= 'z' meet the standard and implement any extensions in an acceptable for C := to do 52; manner . 'A' 'l'

    Good luck, Rickl It is also impossible to write (I hope I am wrong) decent hashing algorithms and random number generators that are truly portable (ie. Sincerely yours, give the same answers in all implementation~ Perhaps "excellent" rated compilers should also provide some extra builtin functions for these KERNIN~TR~ENTS~ I~C. , tasks. It wouldn't hurt to define their names and parameters now. I I

    T. P. Roberts ~.:j G~'\. Photogrammetric Systems Engineer Roedy Green TPR:pm

    - ______._, N~_ I' COMPUTER SCIENCE PRESS INC. COMPUTER eCIENCE PRES. INC.

    ~ 9125 FAll RIVER LANE ~ 9125 FALL RIVER LANE POTOMAC, MD. 20854 POTOMAC, MD. 20854 [301) 299-2040 - (301) - 299-2040

    November 27. 1979

    Dr. Andy Mickel Edi tor Pascal Newsletter Texas Technological University U. of Mississippi at University University of Minnesota ThaJlles Valley State Technical Coll. U. of Oregon at Eugene University Computer Center Towson State University U. of Le Pacific at Stockton 227 Experimental Engineering Buildir~ Union College U. of Pennsylvania at Philadelphia Minneapolis, Minnesota 55455 U.S, Military Academy at West Point U.of Saskatchewan U. of California at Berkeley U. of South Carolina at Columbia Dear Dr. Mickel, U. of Chicago U. of Southern California at Los Angeles U. of Houston at Clear Lake City U. of Texas at Austin In the 15th issue of Pascal News on p~e 8 you inadvertently omitted U. of Maryland at College Park U. of utah at Salt Lake City the list for our book PASCAL, An Introduction to Methodical Pro~SIIl- U. of Massachusetts at Amherst U. of Washington at Seattle minf by WilliSlll Findlay and David Watt in an article comparing the Villanova University ava lable Pascal books. It was listed in the table at the bottom of the p~e. We would appreciate it if you would correct this ommission. WE INVITE ALL COLLEGEPROFESSORSWITHIN THE UNITED STATES ANDCANADA Pascal. An Introduction to Methodical Programmin~ is published for TO WRITE TO COMPUTERSCIENCE PRESS ANDREQUES'f A COMPLIMENTARYCOPY @ the United States and Canada by Computer Science Press, Inc. $11.95. OF PASCAL. AN INTRODUCTIONTO METHODICALPROGRAMMING.Please write :::II it ie available and pubUehed throughout the I:emainder of the world by on school stationary, identifying the current text, the course nSllle :oD>- n Pitman Publishing Ltd., )9 Parker Street, London, England WC2BsPB. and number, as well as the anticipated annual enrollment, and we will ::r be happy to let you determine for yourselves which is the best book In its first year Computer Science Press has sold over 12,000 copies of for teaching Pascal. .... \D Pascal. An Introduction to Methodical Programmin~ wi thin the United 00 States and Canada. We also believe that a much more meaningful com- We would also like to call to your attention our short course program o parisonand evaluation of books can be obtained by the basis of the offered through our Computer Science Education Extension Division which universities and colleges which are using it. Our book has been will offer 2-) day courses on Pascalon, adopted at over 50 schoolswithin the United States and Canada including, March 24-28 at San Francisco Arcadia University Lucas College May 18-19 at Anaheim (preceding the NCC) Albright College Marian College Brock Univereity Marquette University Thank you. Broome Community College Merri tt College California State University at Montana State University at Bozeman Sincerely yours, Long Beach Moravian College Cari boo College Morningside College Case Weetern Reserve University North Carolina State University at College of WilliaJIIand Mary Raleigh Barbara B. Friedman Dalhousie University Northampton Community Collegs President Dickinson College Northeastern Universi ty Fairleigh Dickinson University Plymouth State College BF,cw Framin@ham State Uni versi ty Purdue Univereity at Wsst Lafayett; Iowa State University at Ames Rollins College John Brown University Rosemont College Ianaaa Wesleyan University Sonoma State College E. R. Lauren University Southern Methodist University LeTourneau College Stanford University Loyola University Teolple University CT."W PRINDLE AND PATRICK ARCHITECTS: PLANNERS

    October 17, 1979

    Pascal User's (;1'(;u1-> c/o An6re~ hickel, BRITISH COLUMBIA HYDRO AND POW.R AUTHORITY Univerllity ot Ninne~ota, :a7 k.xl-'erin,ental I::n",illeer in~, l'o1rmeapoli&, M, ~51j"" it Red Stripe Computer Trailer He. ~a&cal L~er'& Lroui' and Pascal ~e~sletter Gas Division 3777 Lougheed Highway Dear Sir. Burnaby, B.C. CANADA V5C 3Y3 (604)298-1311 loc 372 1 ,~ould like to ~et intoCl,atioll Oil the Pascal User's (,roup, eS1->ecJ.allx. as SOOIl aJ; 1->0&.iLle to ~et the ~ascal t,e~sl"tter incluoing,back 18;&uesif pos&iLlt:..I ...ouldlike to join th~ or",..nu:atJ.o" ana tind out all I can a. I 1979 November 20 a" conteJil1>latiny con..,itti'''iIthi. sxtit"n,to ""tow.ive u." 01 ~a.cal, althou..h I an. Dear Pascal Standardizers: lIot at l'c'".ent a ~aIlC'.}us..r. 1 ...oulaIH.e to learn .on,ethin", ..bout the availability 01 ~aacal 60ft~are, either to a1> or lIell. The key beauty to Pascal is that if you take a valid Pascal The corhpanX1 ,,"oc'kfor i. an arcl,itecturefirn, ...hich has .. program and randomly change/delete/insert a character, there is a ~1J~~II/J.. runnin", H1'-11 anu (TbX provioes .everal virtu..l RT-il .in",le job nonitor. ~ith'1'1>><'&or..e lin,it..tions ..nd .om.. very high probability that you will have an invalid pro9ram. There edditionll, if you are t..n.ili..r~ith RT-Il.). Our is also a high probability that this invalidity can be detected by DI::C's the compiler at compile time. Ie. Pascal will catch typos. apl'lic~tior.sare Accountin~, \,ordProce..in",,ana lIon,eIItatilitic. a~.a IIJ.lI1ulation. \,e hOl'e .om..dax to yet into soo.e ~raphics. RJ.\jhtnow there is One of the few exceptions involves the semicolon. Randomly ful lot ot a...iulassend;.ler .tuff around sprinkling semicolons can change the intent of a program as described here ",hich n,u.t olle""...ax or anoth..r I.,etransformea into .on.ething in the User Manual and Report on page 26. RoOr.. port..ble.

    Another hit ot background i.. that I an, one of the first u.ers if P then; begin Sl; S2; S3 end is a surprise of the iIIhites...ith'sLtd. C con'l_iler, ~hich .atisfie. the To get around this problem (and to force everyone to use the ...... 1'ecitication \jive..in Kerni..han end Ritchie'.. bc>ok ",ith one Il> semicolon as a separator instead of a terminator as God intended), I 00 aGdition, which i8 that ditferent "typedef"s can have ele."ents suggest making the empty statement invalid. In its place we would o ",ith t1,le.an,,,name. I.e. ther.. can be an A.x and a b.x. invent the null statement. AccordJ.n~ to Kerr.i..han ana Ritchie. thi. ill not allo"'eti &ellin.. if !!'ten null else Sl it tor .huch 1 than the cost of Ut.IX. I ellti...ate that one case n of (such as a verx serious hoLbiest) could have.. quasi-UlIIIX system 2:X: =5; ",ithina year for unoer \ilU, UO(J. ,}'herub 1& that 1>..11 Lab& ill 3: null; currently tryiny to n.ake it appt!ar 8& if UboIX u.er's .ociety 4: x;;;b aott~are cannot be spread ..round to non-n.enob"r". at lea..t that is end the in,pre".ion I \jet. But a nunJoer of .ourcea fro.u DI:;C to Yourdan, Inc., to whi ttolin,ith'.tell n...they don't have a legsl lev to .tanu on. but ~ho ~ill g"t the ball rolling? Other than that, Pascal is perfect and should' be left alone. However, why not let people extend the language in any way they want 1 QOl'I't know if all thi. intereat.. you or not, Lut 1 thought by using pre-processors written in Pascal that produce Pascal code. there w... . fair chance it n,ight. and that you might be able to Nowall we need is an ingenious general purnose pre-processor to leaa me to aome help in findin~ or helping to establi.h aervicea implement any goody your heart desires. that ",ould do tor ~ what xOu are doing for Paacal. ~~ own iRlprealiion ia that C ana l'...cbl are "ui te coruplen,entary, C being a bette~ eYlltea,s lan\juage, and Pascal being better for Jl18ny,or even R'Olit applicationa. L~ 0(.(\'" bincerell'. Roedy Green

    hal !>Iorria ~Yllte/J" !>.enaytor

    / - ~ -- ..... It - THi ROYAl Cnll(C~ Of PHI'SICIAN') AND SUR:;fONS 01 CANADA t( COUlGf HO'IAl OfS MfOfCINS rr U'If!UkGHN', nu ri\~:\: -

    THE R. S. McLAUGHLIN LE CENTRE D.EXAMENS The UNIVERSITY of WISCONSIN - LA CROSSE EXAMINATION AND RESEARCH CENTRE ET DE RECHERCHES R S McLAUGHLIN

    LA CROSSE, WISCONSIN ,.601 (10') 716-'000 785-8029 PHOU,CTRIl-I'. ~"'Io!"JE50TE I We have a Hewlett Packard 3000 computer system which among other things I am always rather disturbed at the insistence on ~ supports undergraduate computer science instruction. In the past six uniformity in the name of technology, or efficiency, or cost. Surely people should ~ months we hsve installed the contributedcompiler from HP labs made come first? Whynot leave a few print-outs at full size, and ship those to the .... availsble to the HP General Systems Users Group. The current version is feeble-sighted? You save on the cost of reducing and binding, at the expense of fairly complete, although it is somewhat slow because it is a P-code 00 a little extra organization. ""o system, which first trsnslates into SPL (system programming langusge) snd I do appreciate that yours is a volunteer effort, run then compiles snd executes the SPL. with minimal staff. But are not PASCAL and its devotees worth it?

    Nonetheless, for pedagogical reasons our computer science department Is going to tesch Pascal. In fsll 1979 we will introduce Pascal to three sections Yours sincerely, of Computer Science 121, Programming in AlgorithmicLanguages, replacing FORTRAN. This will introduce about 100 Computer Science students a semester to it and will provide them with a tool which they wiil use through much of I ./.-- the reat of their curriculum. Pascal meets a long unfulfilledneed here for a block structured, high level language for teaching which enables one to teach proper programming structure. Colin Park (Ph. D)

    Sincerely, (Assistant Director).

    \-.... P.S. In the case of PASCAL, some of us may even be prepared to pay a little .-.~~- {.';/"'''''''-}' more for the privilege of not straining our eyes. John A. Nierengarten. , Assistant Director I Computer Center

    JAN:lh C.c. J. Storlie ..... OC' AN EQUAL OPPORTUN!TV EM PLOVE R CLINICAL .CIENC!S ILOG. UNIVUUITY Of ALIERTA, EDMONTON, CANADA TlO loa '-1U

    - ... .. - Pete Joodeve compUer "P5" to aV0111 some of sucll iuUt by associ4t10n. 3012 Deak1n Street, apt D Restrictions tbat have now dlsappeared lnclude: Berkele/, Calif. 9.705 1) Upper-case-onll ASCII: lower case ~ay no~ 1979 Nove~oer 9 be used freell in progra~ text; 1t 15 not d1st1ngu1shed fro~ lts up~er case equlvalent. Tbe standard brace convention tor comments is Andl Mlc.ll;;el allowed. Pascal News ' University Computer Center 2) Tinl strin, constants (originally 16 chars ma~): 227 Experimental Engineerlng Building the 11m1t has been (arbltrarl11) exten1e1 to 12~ chars, 208 Soutneast Unlon Street but complier heap space used corresponas to actual length. Unlversitl of Minnesota MlnneapollS, Minnesota 55.55 3) GOTOsw1tbin procedures only: tbe full Pascal standard 1S now lm~lemented; thls was felt to be important for the occaslonall, vltal .pan1c sequence". Dear An4~: .) No second fleld-width specifier for real output: Willett (empton mentioned, in D1S letter to you of a few full standard formattln& ls now implemented. months beck, that I was finisbing up a new Pascal s/stem for Data General AOS 1nstallations, and ever since tben I have been Other changes to the complier -- such as increased set-sile gettlng around to sendlng IOU a proper report. As the slstem bas are really only relevant to tbis i~ple~entation, and I will been stable now for over a montn, it 1. Obviously hlgn t1me to leave them aside here, but one otber internal cban,e mal be of flnalll set tbls note written. more general interest. It turns out tbat while tne stac~ fra~e size allocation mecbanism used In tbe original P. was quite We Dave actually bad a version of AOS Pascal out In the fleld adequate for an 1mplementation wbere all stack elements are tile :s for nearll a year now, but tnis 1S basically the Lancaster P. same sile, it doesn't reali, cope with tbe situation of differing :I:> Nova RDOS Pascal w1th a run-time s/stem modified to mate with AOS. Slzes. In brief, wnen generatlng a P-code lnstructlon tnat does ""n The new edltlon lS extenslvel, rewritten, at botD tne run ti~e not bave a fixed operand ty~e, tbe complier didn't take the .:: and compiler levels. actual tlpe lnto account when allocating'space on tne stac~; lDHead, lt would"allo\iate the J.u:gu.l posslble size if tile Tne run time interpeternow ta~es full advanta,e of the instruction was a.. pUin type, and release tile ~!l.d,I..e.~l possible Eclipse's instruction set (ratber tban being Nova compatible), in tbe case of a po~. Thls meant that tbe longer tbe procedure, has completel, revised file-variable ~anage~ent and has been the larger the stack frame it apparently would need, wuile ln expunged of tbe few eXlstlng (and actualll rarel, encountered) fact most procedures reali, need ver, little in the wa, of bugS In the Lancaster origlnal. temporar, space. Th1S defect became especially severe when we went to a-word setsl The P5 algOr1thm is exact, keepin6 proper The com~ller is now considerabl, closer to tbe (draft) track of tne amount of space needed or released oy eacb standard than is P4: I had lnltially boped to remove ~ll the instruction. essential discrepanc1es, Out a couple still rema1n due to tl~e and budget 11m1ts. A couple of non-standard features -- in tbe L1~e a number of otner syste~s around, the approach to form of some addltional predeclared procedures (~od1fied from the aenerat1ng an executable Pascal progr~m is fRr the compiler to Lancaster orig1nal) -- improve the links to the external world generate a fairly low-level symbollc P-code fro~ tile ori~lnal somewhat. Tnese are: a) abnor~alprogram termination w1th HALT; source; this is converted to blnarf form and boun~ with tbe b) ran40~ access of the components of anf Pascal file via run-tlme librar, modules to create an executable fl1e; toe whole GiTRANDO~ and PUTRANDOM. Thls compiler -- ll~e its Lancaster sequence of course follows automaticalll from a sin61e command to parent -- su~ports external procedure declarations, and as these the 01leratlDg system by tile user. I don't lntend to e;et 1nto ma, be wrltten in eltber Pascal or assembly lan~uage, the user discusslon here of the relatlve merits of interpretation versus has considerable freedom ln adding ani s/stem functlons etc. that comp1latlon to macb1necode, althougbtile s'ste~ see~s to perform ma, suit hlll\. very cre~ltabll a,ainst DG fortran, for lnstance. The main advantage of tnls approach as I see it is 1tS modularlty: 1f one I snould POiDt out tbat wbat LaDcastercalls"P4" has been later wants true compiled code out of the slstem, there is co conslder4Dl, extended from tbe orlginal Zurich verS10n. In nee~ to toucn toe complIer at all j P-code a~pears to translate particular, it embodies full, t/ped file-variable facilities, ver, smoothllintoman, machineinstructionsets (lncludlng that includln, external flies. I havehad the gall to label tbe new of the ~clipse) andin somecases this may be poss1ble uS1Dg aD

    - - " >." eusHn~ l1IacroaHembler. (In fact, for simjil1c1tl 4nd bec4IAse of PATTERN ANALYSIS & RECOGNITION CORP. ....U> > tbe slowDess of macro expansion, in our Slstem even tbe r- translat10n of P-code to its ~acKed form is mostly done by a translator written in Pascal.) Certainly, 1f tbe P-code 1s z: complete enolAgo, it snolAld be reasonably simple to ~roduce ZZ8 LIBERTY PLAZA ~ translators and interpreters for d1fferent machines, uS1ni ROME, N,Y, 13~~O U> C!I'lll the same complIer. Tn 315<:Ue oo ""...... , Bec4IAse f1rst 1ancaster, and then ourselves, found some 15 February 1979 lacks in the Zur1ch P4 p-code in the anc111arl information that one would liKe to have when ~enerating a binary version of tbe code, aD attempt has been made in the P5 variant to pass on all Mr. Timothy M. Bonham toe informat10n that a translator pro~ra~ ~i~ht need, in II form 0605/1630 S. Sixth Street entirel1 independent of the target machine. The P-code 1nstruc- Minneapolis, MN 55454 t10ns aDd their formats are unchanged from the orig1nal, exce~t for the.inclusion.of the new faci11ties, but a new statement type Dear Tim: -- 'he direct1ve -- bas been added. Directives are used to indicate such things as procedure entry labels -- together with I have modified the POP-ll pascal compiler kit (version 4) dis- tneir ori~inal Pascal ident1f1ers; this sort of extra informat10n tributed by OECUS and by Seved Torsterdahl (see Pascal News H12, June 1s useful in bu1ld1ng ""'elllorl maps. or other debuggug aids dur1Jle; 1978) to improve it in several ways and would like to make it avail- translation. External procedure declarations and entry points able to interested RSX-IAS users. I have called my modified kit also have their own directives, so that su1table 11nks can be set version 4.5, to avoid confusion, because version 5 is now available up when the lIIodoles are bound 1nto executable form. Other from OECUS. All of the modifications were made in order to allow the directives SUPpll the progralll name and 50 on, and the source 11ne compiler to compile itself (until now it had to be cross-compiled numbers DOWappear W1tO the 1nstruct10n counts recorded 1n the using a DEC-IO), but as a side effect my version has the following ad- P-code. vantages: 1 bad intended to enclo~e a ~pecification sheet for the 1) Can be configured to have one of three different levels of Implementation Notes of the News, but 1 th1nk we should be sure overlaying (with correspondingly different symbol table toat you rece1ve it 1n flnal released form, so 1 will let Ga~Da space) in order to allow trading of compilation speed for Technologl suppll that item. If anlone 1s 1nterested in more capacity to compile large programs...... details 1n the meantime, they are welcome to contact I GAMMA TECHNOLOGY, INC. version 4. 2~52 I~barcadero Way Palo Alto, Calif. 94705 3) Produces object code which is 12% smaller than and is faster (415) 856-7~21 than version 4.

    4) I corrected bugs to allow procedural parameters to work. S1ncerell, 5) It can compile itself in approximately 15 minutes (without using memory resident overlays) with all files on the same /l~ RP06 disk drive.

    P~rsons interested in obtaining a copy should contact Richard Cichelli or John Iobst, who will be distributing the kit (and making further fixes and improvements) at the following address:

    A.N.P.A. Research Institute 1350 Sullivan Trail P.O. Box 598 Easton, PA 18042

    Sincerely.

    I'f ( ...,.J,~ "r~"'1'n' \, 00 c::> Michael N. Condict MC/dms

    .' KF """ Dalurn 8ctccknina NKF EOP department 1918-10-26 Datum Bctecknin& Michae 1 Evans EOP department 1918-10-26 Michael Evans

    converted between various COBOL dialects without leaving the COBOL language. It ought to be possible to convert to a new PROBLEMS IMPLEMENTING PASCAL IN A COMMERCIAL ENVIRONMENT Pascal dialect if this does not involve a complete rethink regarding education, progrananing techniques,development We are interested in implementing Pascal as a normal program- tools etc. ming language in parallel with COBOL and Assembler. The current program development envirorunent is One of the advantages of Pascal is the use of machine inde- pendent p-code. Is this standardized8uffici~ntlythat code IBM 310/168 under ~NS from one compiler may be used with anothermachine which Interactive developmentusing TSO supports the same level of p-code? This is of interest for Logical modular programming us as we envisage the use of satellitemachines of various Interactive testing of modules programmingusing macro COBOL (MetaCOBOL) sizes with centrally developed programs. This development Structured would be eased if tested object code could be to remote Data base management using System 2000 sent Applications development staff of about 10 persons sites.

    Pascal is taught at many universities.Unfortunately,many In order to b. able to u8e Pascal in a production environment. we need to know about the future of Pascal in the following of our programmers,and many of those whom we employ in the areal - future, h.ve not had the benefit of this education. Are educational materials, in the form of video cassettes, Standardisation/Formalisation course books, examples of good programming practices available Integration with existing systems for Pascal? It would be of great i~terest if we could get in Special commercial requirements touch with other installations,e6v~cially in Europe, who Development environment use Pascal in a commercial environment.

    Programs produced in our environmenthave long useful life Standardisation Although Pascal can be used to implement operating systems Integration .....

    00 .....

    ......

    / KF Dalum 8ctecknin, '" KF 8c~kniDI EDP department 1978-10-26 '"EDP department ~~IIJ'A-IO-26 Michael Evans Michael Evans

    to be catered for. This problem may be avoided if a standard The programmersinvolved in developingcommercialprograms Development "THING" were available.A parameterdefined as THING type are among the most expensive items used during development. envi ronment may contain any type of data. It may only be used a8 a para- To enable them to work as efficiently8S possible. they must meter to the standard function DATATYPE (variable) which have better tools than a straight batch compiler. Combined returns BOOLEAN INTEGER REAL CHAR USER etc, or in an assign- with a suitable compiler, Pascal p-code"gives the ability to ment statement. Execution time type checking would be needed have an advanced interpreterwhich allows single statement in that statement but nowhere else. This sdmittedly breaks execution.breakpoints.setting oeh listing global and local the rules of Pascal as a strongly typed language in the same variables, statement trace and path execution summaries.When way as GO TO breaks the rules of control structures. The type used in an interactiveenvironment,these features would violation would however be well marked both in the invoked greatly ease program development. Many of these ideas are function and probably in the invoking function (in order to found in the current Pascal compiler series in Byte magazine. pass type information). It would allow such functions as ge- neral interfaces to external systems to be implemented in As Pascal makes it easier to write large compilable units PascaL than many separately compilable modules, it is essential that the programmer be able to find variable definitions and Pascal as defined by Jensen and Wirth only defines sequential uses. A cross reference listing would be very useful. files. It is often necessary to be able to access a particu- lar .ecord in a file, either by means of a key (indexed Occasionally, commercial data proces.ing requires handling files) or by means of record number (relativeor direct files). of such large data volumes that speed of operation is a The use of Pascal would be eased if it were possible to pro- 7ritical issue. To allow Pascal to be used in these situations. gram this in Pascal and not need Assembler routines to do it. ~t must ~e possible to translate r-code to executable machine Instructionson tbe target machine. It may even be possible Other programming languagesuse different formats for internal to optimize this machine code. The interrelationship between data. These formats are often used on existing data files. It these functions is illustrated below. must be possible to access even these kinds of data. One method is to implement general Pascal functions to perform the .... conversion to and from standard Pascal types. To ease the U> 00 coding of this function, the data type THING mentioned above "NORMAL" C> would be useful. The other method would be to support data INTERPRETER types which are already supported in FORTRAN/COBOL/PLI even in Paacal possibly with some limitations. PASCAL COMPILER Arithmetic operationsoften involve a fixed number of'decimal Conmercial progrBOI11ing SOURCE places. It must be possible to define these fields as integer with decimal shift instead of risking inaccuracy caused by floating point errors.

    The for~tting requirements for figures in a financial listing are many and varied. Zero suppression, credit/debit signalling, thousand comma insertion and floating currency sign are just a few of the features need. Pascal must be able to define the editing required when outputting numeric variables to text files in a way similar to COBOL's report item PICTURE clause. TRANSLATOR/ If this i. not donecentrally, each implementor will find his OPTIMIZER own way of editing. resulting in confusion similar to that .urrounding BASIC'. PRINT USING statement.

    o This paper contains the ramblings of a newcomer to the Poet-8cript Pascal user community. I have tried to see Pascal through the eyes of the business data processing department where I am responsible for programming methodology. I imagine that many of the questions have been answered earlier or rejected as contrary to the spirit of Pascal, in which case I apologize.

    az "P'GS ItF10'

    . - . - PAGE 83 PASCAL NEWS 117 /'\ARCH, 1980 Pascal Standards Progress Report ------Jim Miner, 1 December 1979

    Several newsworthy events have occurred since the last Progress Report in Pascal News #15 (pages 90-95). In a nutshell, these events show substantial progress toward an international Pascal standard. (See the Progress Report in #15 for a glossary of some the terms used here.)

    Another Workin~ Draft

    As expected in the last Progress Report, a fourth working draft prepared by BSI DPS/13/4 was distributed within standards organizations in October by the secretariat of ISO/TC 97/SC 5 under the document number "N510". (Recall that the previous draft is called "N462".) N510 contains a large number of changes from N462. Most of these changes are corrections to "obvious" errors and oversights. A smaller nuuber of changes address fundamental ambiguities or other technical flaws in the Pascal User Manual and Report; these changes often are more controversial than the "obvious" ones.

    As an example of the more controversial kind of change, consider the restrictions placed on labels to which goto-statements may refer. The User Manual and Report specifies that a goto may not jump into a structured statement. Although the wording in N462 was felt to be unclear, this was the intent of the restriction in that document. But the comments received from the public on this section of the draft clearly showed that run-time tests were required to enforce the restriction in the case of goto's which jump out of procedures or functions. In order to allow efficient compile-time checking of goto restrictions, the restrictions were tightened in N510, as described later. At the same time, of course, the wording was clarified in response to many comments.

    A full list of all changes between N510 and N462 would be very difficult to compile and explain. Rather, we hope to print in a future issue of Pascal News the next draft which will be based on N510.

    However, there is one very important new language feature which was introduced in N510. This feature is called "conformant array parameters". The feature was added to N510 in response to the many comments, including those from Nik1aus Wirth and Tony Hoare, which cited as a major shortcoming in Pascal the inability to substitute arrays of different sizes for a given formal parameter in procedure and function calls. Because this such a significant and recent change, Arthur Sale has written the description which appears below. ; The ExPerts Group Meetin~ t The new draft, N510, served as a basis for discussion at the meeting on November 12 and 13 in Turin Italy of the ad hoc Experts Group. This meeting was held in conjuction with the ISO/TC 97/SC 5 meeting on November 14..16. The following individuals were in attendance. ! Franco Sirovich (Italy) David Jones (USA) Bill Price (USA) Coen Bron (Netherlands) Michel Gien (France) Jim Miner (USA) Christian Craff (France) Scott Jameson (USA) Olivier Lecarme (France) Makoto Yoshioka (Japan) William A. Whitaker (USA) Akio Aoyama (Japan) Don MacLaren (USA) Albrecht Bied1 (Germany) Fide1is Umeh (USA) Arthur Sale (Australia) Bengt Cedheim (Sweden) Emile Hazan (France) Martus Troost (USA) Tony Addyman (UK)

    The purpose of the meeting was twofold: first, to advise the "sponsoring body" (BSI, represented by Tony Addyman) on solutions for remaining technical issues, and, second, to advise SC5 on a course of action for further work on the standard. Most of the two days was spent on technical issues. Also evident waa significant interest in extensions to Pescal within aeverel countriee. Technicel iuues were informally divided into three cetegori.., (I) "niggles" (or especially France. Germany. the Netherlands. and the United States. Therefore, any future "obvious" problema having fairly s1mple solutions), (2) "local" hsues which affected few sections of the draft. and (3) issues of greater magnitude, affecting several sections of extended standard must be developed in cooperation between the interested nationsl groups the draft. Naturally. discussion centered on the last two categories. as a longer-range project. This project undoubtedly will involve the newly-formed Working Group discussed below. An exallple of a "local" issue (category 2) was mentioned sbove, namely the restrictions on labels and goto's_ The relevant section reads as follows_ The SC5 Plensry Session 6.8 Statements The Experts Group sent two resolutions to SC5 for approvsl. The first resolution, wbich passed SC5 without opposition, states that Tony Addyman should revise the Paacal draft 6.8.l~. Statementsahall denote algorithmicactions. and shall (N510) according to the agreements reached by the Experts Group, and that this revieed be executable. They may be prefixed by a label. Within its scope. a draft would be registered as a Draft Proposal for voting. What this means is that so.. label shall only be used in tbe statement S that it prefixes, tbe time in the next few months the revised draft will be distributed voting cond~tional-statement(if sny) of which S is sn immediate constituent, to SC5 ...oars for a ballot. We hope to print the full text of the Draft Propoaal in the statement-sequence (if any) of wbich S is an immediate three-month letter News when it becomes available so that readers will have a chance to provide constituent, and, if this statement-sequence 18 the statement-part of ~ comments on it to their own national standards group_ a block, the procedure-declarations and function-declarations of that block. The second resolution, passed unanimously by SC5, established a formal Working Group [ statement label 11:11 ( ("Working Group 4, Pascal") to advise the British group on further standardization, and to - simple-statement I structured-statement) . consider proposals for .uch from bodie. recognized by ISO. The Working Group i. intended to replace the Expert. Group, and will be under the Convenorship of Tony Addyman. Ha8bera are to be nominated by SC5 member bodie.. This group will aid in resolving negative The group qu~ckly .greed both that the word "used" (in "a label shall only be used") should be chanaed to indicate the fact that the only possible use of a label is a comments (if any) on the new Draft Proposal, and will probably coordinate future work on reference by a goto-statement, and also that the long sentence which statea the Pascal extensions_ restrIctions on references to labels should be broken down Into more-eaaily understood parts. It was agreed that the intent of the sentence allows goto-statements to reference The SC5 meeting also saw an intere.ting exchange on the .ubject of Ada (the U.S. the label of a statement S only in the following contexts: Department of Defense langu.ge). William A. Whitsker, attending as en observer fr08 the United States, made a presentation to SC5 on Ada. Under questioning by the Austrelian (a) when tbe aoto-ststement occurs anywhere witbin S; or repre.entative (Arthur Sale), Whit.ksr admitted tbat Ada sctually has little in C08800 with Psscsl. This stend. in stark contra.t to the impression one might get fr08 readiDI (b) when the aoto-atatement occurs anywhere within the if-statementor case-statement of DoD pre.. relea8e. and otbsr articlsa which aome feel have attempted to lsnd cradence to which S 1s one "branch" or component statement (e.g., the goto may occur anywhere in the the Ada project by associating it with Pescal. Thsnkfully, Pascal need no longer auf fer from such derogatory associations I else part of an if-statement and still reference tbe label on the then statement, but not a label within it); or

    (c) when the goto-statement occurs anywhere within a statement-sequence (in a In the United Stateo compound-statenentor a repeat-statement)of which S is a component statement; or Several small points should be noted as having changed since the Progress Report in '15. (d) when the Boto-statement occurs In a procedure or function declaration (within the These changesoccurredat themeetingof November28..30in.Boston. scope of the label) nested in the block which declares the label (i.e,. non-local goto's). First, a single joint committee has been formed from the ANSI-X3J9 and the IEEE Pascal and only if the .tstement prefixed by tbe label is not nested inside a structured Standards Committees.The new committeeis formallycalled the "Joint ANSI/X3J9 IEEE statement (other than the compound-statement which is the ststement part of the block). PascalStandardsCODDittee",abbreviatedtlJPCII. More than one member of the group certified that these restrictionscan be enforced Second, Jess Irwin has resigned as secretary of X3J9. Carol Sledge of On-Line Syste88 has efficiently by a one-pass compiler with no run-time overhead. volunteered to take the job. Correspondence with the JPC should be sent to: There was resietance to allowing jumps between 'tttranchesilof conditional-atatements. It tbat the use of such goto's poor Carol Sledge (X3J9) vas argued is not good, is "atyle", and should not be c/o X3 Secrstariat part of the standard. After some discussion, the group agreed to further restrict the CBE~: Suits 1200 goto by not allowing the references cited in (b), above. As with most such changes, the 1828 L Street NW preci~e redrafting was left to an individual member of the group. Washington, D.C. 20036 The major topic of discussion was conformant array parameters. Tbi. was confu.ed by the Third, the proposed thst the form present been renouncedby the British "SD-3" for conoidering extensions to Pascd printed in 115 (pa... fact in N510 had already in favor of a 93..95) was modified to reflect the international intereat in Pascsl exten.iona which waa form drafted by Arthur Sale. With tbe exception of s different proposal by Coen Bran. apparent at the Turin meeting. The revised document specifies that the JPC will cooperate which was clcser to the version In N510, there was nearly unanimous support for the version proposed by Arthur Sale. (See hie note, below, for a description.) with Working Group 4 of SC5 on developing an international extended stsndard, and tbat the resulting American National Standard will be compatible. In addition to technical issues, the Experts Group also briefly reviewed Pascal standards ()O activitieswithin the nationsrepresented.It was clearthattheapproachtakenby BSI J;: DPS/13/4 towsrd a Pascalstsndardhad a great deal of support internationally. witb the ***************** exception of a few technical details. Discussions are currently underway in attempting to resolve those iS8ues not completed in Turin.

    / . . r _ l Implementation Notes

    Coupon). This amazing piece of paper is simply an implementation checklist with room to write on. Fill in the blanks, fold, and mail to the address on the back. Feel free to also send in camera ready Editorial checklists. I hope this will give us a little more to print in the mean time.

    Tektronix, Inc. Now for my biggest irritation. In my everyday work, I have used many ..,-, P.O. Box 500 Beaverton, Oregon 97077 different implementations/versions of Pascal. On our DECsystem-l0 alone . '1' 'I we have six different versions of Pascal available. This does not . ',',.. include some cross-compilers for other machines. Why do we have so many " Phone: (503) 644-0161 different compilers for the Same machine? ~ TWX: 910.467.8708 The reason we have so many versions still active is that many user programs have not been updated to account for major changes in new First, the formalities: releases of the compilers, and so the old release stays around. Most of the changes have been non-trivial, and heavily impact whether the Bob D1etr ich programs can be simply recompiled under the new release. The changes MS 63-211 have included the way the character set, terminal I/O, 1/0 in general, Tektronix, Inc. phone: (503) 682-3~11 ext 3018 operating system interface, et cetera, are mishandled. Even worse are P.O. Box 500 the versions that made "improvements" to the language, such as: Beaverton, Oregon 97077 U.S.A. j := case k+3~ of Feel free to call me (I'm usually in between lOAM and 5PM Pacific time), And but consider yourself lucky if you find me near the phone. I don't have a secretary, and may have to be paged. Consider yourself foolhardy if 1 '- g FouledUp then sqr(x) else sqrt(z) you write me and expect a personal reply in less than a year. I'll try to do better for those outside the U.S. Should you wish information on Of course, the changes are rarely upward or cross compatible...... a specific implementation, please read Pascal News first. It I S unlikely

    directed toward fhing errors and implementing the full language. How I in itself, and not that far from where the ISO standard will probably long for a full set of {ASCII I charI As a compiler writer, I realize end up. that extending the language in a particular implementation both is fun and might help differentiate the product in the marketplace. This is The second tool to help quality is the Pascal Validation Suite that was especially true in the Pascal market, where both users and implementors published in issue , 16. The biggest problem in quality assurance is have not really understood the language. finding quality tests, and the validation suite goes a long way toward salvina this problem. It is also a very big advantage to have the suite What 1 am really looking for (I don't think I'm alone) is quality in the available now, even before the Pascal standard is adopted. Implementors tools I use. Just as I wouldn't be too happy buying a saw missing half of other language standards had to wait quite 8 while (many are still its teeth, or with halt the teeth backwards, or with teeth on the handle waiting) before such a measurement device was available. I will have where my hand is supposed to go, 1 really dislike the so-called quite a bit more confidence in a particular implementation of Pascal if implementations of Pascal whose manuals list ten major omissions to the 1 know the results of having it try to process the validation suite. language and thirty "improvements". The omissions are even less tolerable once an implementation has gotten past the "well, at least it I would like to encourage both users and implementors to use the looks like Pascal" stage. This is not quality. validation suite and send the results to me as well as to Arthur Sale. By all means, also send a copy to the implementor. 1 will then publish Perhaps yo u feel I expect too much for a language that owes its the reports I receive in Pascal News for the world to see. Please see popularity to the efforts of many individuals rather than large the sample reports in issue H 16 for format. 1 would hope that over the companies. True, we owe these implementors a debt that will never be next year we can get reports for each and every implementation (then repaid. But this debt does not relieve implementors of their again, 1 always have been an optimist). The letter campaign to responsibility to do the job right, especially if they have the time and implementors will also be requesting reports of the validation suite energy to make their own "improvements" to the language. Another reason resul ts. I expect quality is for the many new users of Pascal. These users judge the language itself by the particular implementation they are first One last comment. Be kind to your implementor, especially if he ia exposed to, and I have already seen some discouraged by poor doing a good job. It's not all that easy to wrestle many at our poorly implementations. The most important reason to hold implementors designed machines into speaking Pascal. von't use the validation suite responsible for quality is the simple fact that if we do not, there to beat him senseless, but have some patience. On the other hand, if he has implemented something that cannot even pass for a subset of Pascal, won't be any, and we the users will find it much more difficult to get ..... our own jobs done. cannot add two numbers correctly, and has a lot of "imJ;rovements", be \D merc il ess. 00 o A good many implementors are professional enough to assume this responsibility for quality, and have probably already done so. What of those individuals and companies who have not? What can we users do? Well, the best approach is to convince the implementor that conforming to stilndard Pascal Is In the Implementor's own best interests. The reasons can be m..ny: good will, conditions of purchase, additional sales, blackmail, advertising, even legal requirements. In many Implementation Critiques countries, adoption of a standard (such as ISO Pascal) gives it the weight of law. Any product purporting to be Pascal in such a country MUST conform to the standard.

    It is fortunate that there are now two tools to back up this demand for quality. The first, of course, is the upcoming ISO Pascal standard. There are admittedly problems because the standard is not yet official, but at the same time the standard is for the most part not all that 1979December 19 different from the Jensen and Wirth Report. Getting most A of the Swedish implementations to contorm to the Report would be a major accompl ishment critique Pascal co~iler (as derived from its User M~1ual by A.H.J.Sale)

    1. Ths UsarHanualis a supplamentto Jeneen& Wirth. It is well-written, end d8lcribu the implementetiouof Seved Toretendahl runninG on i'W'-lle under RSX-llH and 1AS. 6. The extended case statement (otherwise clause) does not u.e the syntax more or Ie.. agreed internationally and published in ~a.cal New.. but 2. The manual first describes how to rUIl ~ascal progra".s under the operating u.es an OTl~RS label. The syntax .uggests it need not be last. systeuas. how to attach files, etc. 7. A LOOP-J:;,;Dcon.truct iI introduced. together with an J:;XlT. I stronah 3. The next section addresses exl~nsion8. The tok.ensare extended by: recommend the removal of this con'tructwhich is a frequent cause of error (. for [ 1reaaonable, given poor print capability in many programs. Why it was introduced is difficult to understand sine. .) ) J and uae of these ISO poaitions for Swedilh chars . Pucal handles the so-called loop-and-a-half atructure much b.tter without (* { exteosion. allowed by standard. it. *) J 8. There: are 'Standard' procedurel !.tATE and TIM}:;j it 8eems a pity tUat tne.. :/I: for <> These three extenlions are limply undeairable; cannot be guaranteed to relate to the same instant, and that a .ingle & for and especially .ince neither" nor: capture Tp!J:;STAMP, ,cannot , re,t\',f~th valuea guaranteed synchronous. NJ::Wi. !..*,.~ any of the .",aning of the well-defined tokens. for £!: J implemented. but not DISI'OSJ::; MARK and RJ::LJ::ASJ::are provided. recommend the removal of the laat tllree axten.ion. a. being contrary to the but interuts of portability of programs and programming skills. There is a HALT, and RESET and RJ::WRlTJ::allow file .election oy additional and ugly aa well. parameter.. BRJ::AKflu.he. line buffer. for the .pecial file TTY, and act. a. WRITJ::LNfor other taxt-file. (irragular). PAGJ::in.ert. a form- 4. Th. document introduc.. extr. pre-defin.d con.tant" MAXINT. KININT. feed charact.r into tho text-fil.. ALFALENG,MAXRJ::AL,Hl~RJ::AL, and SMALLRJ:;AL.It mi.-call. the.. :JI: >- '.tandard' con.tants which they are not, except for MAXINT. No probleD18 Random acce.. i. provided by allowing another integer parameter to GET and ::c :r:n with the introduction of extra con.tant. provided they are properly PUT. 1 cannot under.tand why people prefer to overload name. with new . identified. meanina .nd introduce irreKularitvin preference to choosing new name...... u:>00 .uch a. PUTR and GJ::TR. E.pecially .ince the axioms of GET/PUT do not hold. o 5. 'Standard' ty~e. i. also mi.usao. Tt~r i. indeed .tandard and need not be in a section on extensions, but type. 9. There are additional 'atandard' function. RUNTIMJ:;.TWOPOW.SPLITRJ::AL Mcn - ClIR(O). .CllII.(l27) i BYTJ:: CtlR(O). .ClIR(255); and IORESULT. are .imply extra pre-dafined type.. Thi. mi.u.e of '.tandard' run. throughout the document. Something can only be call.d '.tandud' if it conforms to 10. Thera i. an adju.tabl. array p.r...t.r f.atur.. tlowit work. i. a ~.t.ry a .tandard, either the oLd dM J'aoto .undard of Jenlen & Wirth, or .. the component-typeiI apparently not giv.n. The fo llowing .x8lllj>1. pref.rably the new ISO draft .tandard. We maY u well aet thil riaht nOli. iI taken froll the manual: PIWCJ::DUR£ HATADII(VAR A,II,C: ARRAY[L~T"GER,INTEGER]); It wouid aeem highly de.ir.bl. to alter thi. implementation to .omething LDrnPUTEA with more ab.tract .tructur., and more checkable. STU[] ~ES 11. There i. alao a facility to d.clar. a n.w kind of parameter PRDCEDURE'PRI~T(STRING S); The University of Southampton Thi. feature turn. Pa.cal'. ord.ring on it. head (typ. pr.ced.. id.ntifier) [3ADUP and it lIi.u.e. the word '.tring' by defining it to b. an array! Th. facility i. badly ."Pr d. and .hould be d..crib.d in t.r... of . ..quanc.. (- file) of characten.

    / - - - - 11 .. 12. Tnere ie e facility to paee procedural and functional parametere, but it differ. from tna draft ISO .tandard in defining a new form of parameter-li.t. Congruity of two parameter li.ta ia not adequately defined, but tni. ia an informal document.

    ( S.e ZII09 Z-9iI (DIgital Marketing) 13. Thara ia an external compilationhcility; tn. directive t;X"fEIIN i. uud ( followed by a parameter li.t. t;xamplel S.e Zllog Z-9iI Cl1et.Tech) } .:n'I:;UN(FORTRA.~) ( S.e Ga.Dt B Clo!elzllWll\fl) or t;XT£1IN(FORTRAN, 'UST') Thl. cOlllpiler run. under CP/M and producea macro-assembler code. pr Ice I. SZ75. 14. The r...rved word liat h .xtend"d by LOU!', t;XIT. OTHERS, I::XT£RN. Ithac. Inter.y.te... (for_rill Ithac. ~djo) If tn. loop conatruct h removed thia drop. to two. 1650 Hen.h... Road P.O. Box 91 Ithac., NY 14859 15. PACK and UNPAC: are not implemented;only cnar and Boolean array. are packed. (Presumablyno records are packed, which i. vary Thl. coq>iler run. under CP/M and I. . Puc.l-f' de.cendant. The pr Ice I. S35e. un.atiatactoryfor many mini and micro spplications.) Dlglt.l Marketing 2670 o,erry Lane 16. Only local COTOs are penuitted; a set may have up to 64 elamenta; Walnut Creek, CA 994596 files mayonly be declaredin tile main prOj;ram. Thl. I. . cOMpiler for. c..aette-bued .y.tem, and se lis for 535. .... <0 17. The documentation ch..ata on MAXINTby disallowing it as a limit in a Dyne.oft Sy.te.. 00 POB 51 o for-loop. It would be accurate to say that tiAXI~Tin thi. implementation Wlnd.or Janct lon, North Sa.k.tche " IBi 2V0 is really32766, aud that the Con.tant called MAXINT.IIould be renamed, Canad. perhapsto BIGINTor similar.Or the implementation sllould be improved The InforMation on this compiler Is unclear. It appears to be all or (.ea !'a.calNews 15). partly In Ra'1, and sells for .(40. The Golden RI..er Co., Ltd. 18. Set of char i. allowed, by definin~ tne type cnar to be tne .ubrange Te\ford Road. Blcester, Oxford.hlre C»<6IU.. of characters from CIR(32)..CHK(95). Of couree thia violate. a lot of England Paacal axioms, notably about the type of the result of CIR. A very crude approach to the problem. It should be done right.

    A.H.J.Sale

    ./ PA6E 89 PASCAL NEWS '17 "ARCH, 1980 Validation Suite Reports The University of Tasmania

    Postal Address: Box 252C, G.P.O., Hobart, Tasmania, Australia 7001

    Telephone: 230561. Cables'Tasuni' Telex: 58150 UNTAS

    IN REPLY PLEASE QUOTE.

    FILE NO.

    IF TELEPHONING OR CALLING

    ASK FOR 4th December, 1979

    " Mr. R. Shaw, Digital Equipment Corp., 5775 Peachtree-Dunwoody Road, Atlanta, Georgia 30342 U.S.A.

    Dear Rick,

    Enclosed is a copy of a report of the Pascal Validation Suite on a VAX-II Pascal system. The report was produced for us by Les Cooper at La Trobe University.

    The Pascal system is a Field Test version and is not available generally at this stage. All errors have be~.1 rep.orted back to DEC who presumably will fix them before the system is finally released. The report should be seen in this context. Nevertheless, it provides an insight into what the VAX compiler will be like when it is officially released early in 1980.

    Les Cooper says he will provide an up-to-date copy of the report after the compiler has been officially released.

    Yours sincerely,

    Roy A. Freak, Information Science Department

    , Lli ment

    V&~-11 Pascal - Tested At LaTrobe University Pascal Validation-Suite Report ~ Processor Identification 'Jests 6.4.5-2, 6.4.5-3, 6.4.5-4, (;.4.5-5 indicate that type cOlnpatibility is used I-I1th var param..ter elements COJ!1»uter: Digital );CJuipMent Corporation VAX-11/780 :r~t!le than enforcing identical types. Processor: Pascal Field TCHt v(;rsion VAX-11 TO.1-68 Test .6.2-5 sho\ls the cOL1pilerpermits a fWlction de- clara ion with no assignment to the function identif- ier. Tens 'I'est Condi tiona 6.8.2.4-2, 6.8.2.4-3, 6.8.2.4-4 sho" that a goto between branches of a statenent is permitted. Tester: Les Cooper ?ests 6.8.3.9-2, 6.8.3.9-3, 6.8.3.9-4, 6.8.3.9-16 show Computer Centre th"t assigllloent to a for !3tatement control variable is La Trobe \Jniversi ty not detected. Test 6.9.4-9 sholls that Australia zero and negative filed ~Iidths arc allowed in write. Oate: ,jovemLer 1979 Details of railed '.rests Vcraion: --.-- Validation Suite 2.~ Test6.(;.3.6-2, 6.6.3.6-3, 6.6.3.6-4, (;.6.3.6-5 check the compatibility of parameter lists. They fail to cOf,.;>ilewh"re they use a procedure with a formal paraM- eter list as a parameter to another procedure. Test 6.3.3.9-19 shows that insecurities have been introduced IJuHuer of 'l\~sts Passed: 12U into for statements by allowing non-local control vari- i~UJ:U.J~l' of 'fU5tS l"ailed: ~ ables.

    lJetails of railed ~ ~ Jlan_dling Test 6.4.3.3-1 failed lJecause an elopty record contain- ing a semi-colon produces a syntax error. j.jumber of errors correctly detected: 14 NumlJer of errors not detected: 33 'i'est 6.3.3.3-4 failed becaU!3e an attempt to redefine a tag finld else"hel-e in the declaration part produces synta" (n-rors. Uetails of ~ ~ detected ?est 6.4.3.5-1 failed because an attenpt define a file of pointertype failed to cOMpile. '1ests6.U.3.9-5, (;.8.3.9-(;, 6.2.1-7 indicates that un- Test 6.:'.1-1 failed because an atte:opt to define a file defined values are not uetected. Tests 6.4.3.3-5, 6.4.3.3-(;, 6.4.3.3-7, 6.4.3.3-0 indi- of filetYl'e failec1 to compile...... Tests 6.6.3.1-5, 6.6.3.4-2 failed to compile \lherethe" cate that no checking is performed on the tag filed of 1.0 00 tri"d to pass a procedure with a fornal parameter list variant records. C as as fonoal parameter to another procec1ure. All assignment to an empty record is not detected in 'Jest G.~.4-15 shOl's that a write "hich docs not specify test 6.4.3.3-12. the file does lIot Ilrite on the default file after Tests 6.4.6-4, 6.4.6-5, 6.4.6-6, 6.4.6-7, 6.4.6-8, reset(output). 6.5.3.2-1, 6.8.3.5-5, 6.8.3.5-6, 6.6.6.4-4, 6.6.6.4-5, 6.6.6.4-7 indicate that no bounds checking is performed on array subscripts, subranges, set operations, or case selectors. Note: The system default is run time lIurrJ>erof lh,viations Correct.ly lJetect.ec1: 61 checks off. If the tests had been compiled with checks Hur.L1Jer of te~ti) shouing true e;;t~l1tiiol1tj: 4 on then the checking would have been done. HLml~er 01 tCatu not ()et~cting erroneous d~vil:ttions: 18 Tests 6.5.4-1 and 6.5.4-2 show that a poor error mes- NumlJer of tests failed: 5 sage is given when a nil pointer is dereferenced and when an undefined pointer is dereferenced. lJetails of Cxtensions Test 6.6.2-6 shows that, if there is no result assigned to a function, there is no run time error message. Test 6.1.5-(; shm,s that 100lercase e may be uset1 in Test 6.6.5.6-6, 6.6.5.6-7 show that it is possible to nwobers. change the current file position while the buffer vari- Tests 6.8.3.9-9, 6.8.3.9-13, 6.8.3.9-14 show that the able is an actual parameter to a procedure and whilst follOl,ing may be uRed as the controlled variable in a the buffer variable is an. elewent of the record vari-' for stateMent: intermediate non-local variable formal able list of a with statement. para::K:ter, global variable. Test 6.6.5.3-3, 6.6.5.3-4, 6.6.5.3-5, 6.6.5.3-6 show ' that there is no errormessage "hen the following occur as the pointer parameter of dispose: nil, undefined Details .of Deviations lJetected ~ pointer, variable which is currently an actual parame- Test 6.1.2-1 ShOllS that IIi! may he rede fined. ter, variable which is an element of the record vari- Tests 6.2.~-4, 6.3-6, 6.4.1-3 sho~1that a common scope able list of a with statement. error was not detected by the compiler. Test 6.6.5.3-7, 6.6.5.3-8, 6.6.5.3-9 fail becauHe no checks are inserted to check pointers after they have

    / .. - - ...... - - I been assiyned a value using the variant form of ne\'I. Test 6.9.4-10 shows that the output buffer is flushed 'i'est 6.8.3.9-17 sho\! that two nested for state..ents nay at end of job. ahve the same controlled variable. Extensions ImplelOentation Defined Number of tests run: !lur.berof tests correctly run: 9 Test that otherwise is' implemented Humber of tests incorrectly handleo: 0 6.8.3.5-14 shO\~s though .not with the sarne syntax as that adopted at the UC~D Pascal workshop in July 1978. Details of !-mrleJner~ ~endence

    Test 6.4.2.2-7 shous maxint to be 21474883647 Test 6.4.3.4-2 shows that a set of char is permitted. VAX-11/780 ~ ~ Commentary on Results Test 6.4.3.4-4 shows that there are 255 elements in a set. The Validation suite has shown up quite II nUPll.>er of flaws in Tests 6.7.2.3-2 and 6.7.2.3-3 show that Boolean expres- the compiler, as documented in the preceeding report. Of sions are fully evaluated. particular concern is the apparent philosophy that the run Tests 6.1J.2.2-1 and G.1.2.2-2 ShO\I that the variable is time checking should be off by default. -".~~,!;,~t;,d befp,re.",.",!JleUxpression is evaluated in an as- sigu17.ent statument; TI""sri~~> weierujf"~hg Field Test"version TO.1-G8 of the Test G. 10-;/ sho\-/s that a re\/ri te is allo\/ed on file compiler. with luck (a lot), the problems found will all be output. fixed before tne compiler is releas~d. Te..t 6.11-1 ..ho\ls that altarnate connent delimiters are ir.lplenonted. DEC has been infomed of the results of all the tests. They have been given run listings, etc. where necessary. The Tests 6.11-2, 6.11-3 6ho\~ that equivalent syr.ibolcannot replies they send to me (when they arrive) will be included be used for the standard I'eference representation for the up arrow, :, I, :m, (, I, and the arithmetic opera- in thi's section of the report. tors. Tost 6.9.4-5 shows that two digits are written i.n an exponent. Test 6.9.4-11 shows the default field width to be in- telJ"r 10, ~ooloan 16, real 16.

    Quality r:easurement ...... lO Humber of tosts run: 23 00 lIumb..rof tests incorr..ctlyhandled: o o

    "Re6ults of tests

    Test 5.2.2-1 shol-ls that identi fiers are not distingu- ished over their whole lengtQ. Test 6.1. 3- 3 shows that there are 15 signi ficant char- acters in an idelltifier. Test 6.'.1:1-4 shows that no wraning is 9i ven if a { or I is detected in a cOl'\ment. ~'..sts G,2.1-8, 6.2.1-9, and 6.5.1-2 indicate that large list" of declarations nay be used in each block. Test 6.4.3.2-4 indicates that integer indei;type is not permitted. Test 6.4.3.3-9 show that variant fields of a record oc- cupy the same space, using the d..clared order. 'fest6.4.3.4-5 (\~arshal1's algorithm) took 1.010 CPU seconds and 249 bytes on the VAX-11/780. Note: This was using the VAX default of no run time checking. Tes;: 6.8.3.5-2 shows that no warning is given for im- pos..ible cases in a case statement. Test 6.8.3.5-8 shows that a large populated case is ac- copted. lO Test 6.1:1.3.9-18 shows that the undefined value of a for ...... ~tatercent controlled variable is left in the range of ~ts type. Tests 6.8.3.9-20, 6.8.3.10-7 show that at least 15 lev- els of nesting are al1o~led when dealing with for stat- ments, with statements, and procedures. Tut 6.8. 3.9-1 dail~ becau1>e the M~ignm£lat to a ~II. PASCAL VALJDA'I'ION SUI'J',; R~l'()H'I' ~tatemelat contlLol vaILw{,le dOUOW6 the eva(ua.Uon 01 the 6illt eXjJILel>l>ioli. U~e 06 extlteme valuu in a 6011.~ta.te- ment plLoducu all in6.['t.<-te toop (tut 6.8. 3.9-fr.-- Tutl> 6.9.4-4 MId 6.9.4-7 6ill beCaLu,e the w«ting 06 ILea( value~ dou not con601Lm to the ~tandM.d and the ComputeJL: Appte 1 I Wi\.U...tllg06 boolean va(uu u not peJLmilled.

    UCSV PMcal veJL~.[on 11. 1

    Veviance TeJ..u

    TeAt Cond)uoM NumbeJL06 dev,(aUoM cOMeetly detected: ------56 TuteJL: R.A. !ILeafl NumbeJL 06 tuu ~howing tlLue extenl>.[onl>: (4 actual exieMionl»

    Va.te : JallualLY 1980 NumbeJL 06 tuu not detecallg eMoneou1> dev,(a,t[onl>: 25 (12 bM..LC.cau1>ul

    VaUda.t;io., Suile VeMioll: 2.2 NumbeJL 06 tuu 6ailed:

    V~ 06 extell~ionl>:

    NumbeJL 06 tVAU pM6V.d: 116 Tut.! 6. J. 7-6 and 6.4.5-1 J ~how tha.t ~Wng~ Me aUowed to have bound6 otheJL than ,.. nand tha.t compa.t.{ble ~rung~ NWI.beJL06 tCJ..U 6a,ited: 22 (13 bM..Lc cau1>CJ..) can have di66eJLent numbeM 06 component1>. Tuu 6.8.3.9-9 and 6.8.3.9-14 ,indicate that the 601L- contILol vM:iable dou not have to be local to the -immed,(a.t;etyenc.(.o~,ing blocfl. !!.~aLl6 06 6ailed tut.! Tuu 6.10-1 and 6.10-3l>lwwthat 6,(le palLameteM aile Tut 6.1. 2-3 ~hOW6 tha.t .{de'tUMvM and IIueJLved woILd6 ignoll.ed and the plLede6ined ,(dent,L6iell. output may be ILe- ..... Me not d.{~angu,(J..hed cOlllleetly Ov l>tatemf/.1l.t. Te a 6,ite 06 Tut 6.'.2-1 .lhoW6 tha.t n,(l may be iLede6..t.(ed. po..L.ntvlLl>U not peJLm.{;tte.d, nOlL cat! a 6,(le be paiLt 06 a ILecolLd .ltiLuctUlle. Tuu 6. 1.7-1' and 6.4.3.2..5 .lltowtha.t a nuU .lVW.g U accepted by the compUubltange06 wegeM M bou.uU. 6ill becau1>e the pM~ing 06 pMcedUllu/6uncUonl> M paiLameteM hM not been ..£mptemented. Tut 6.2.1-5 l>hOW6tha.t an uM..[ted labet u no.t detected. Tut~ 6.6.5.2-3 and 6.6.5.2-5 6aa. beCLt(u,e!Eiu not Tuu 6.2.2-4, 6.3-6 and 6.4.1-3 conta.[n a commonI>cope I>et Otl an empty 6Ue, nOlLU ..[t .let a6teJL a iLeIAJlL.i.te. eMOiLwh,(c.hu no.t detected. Tut 6.6.5.3-2 6~ becau1>etlUpo.le hM not been Tuu 6.3-5 and 6.7.2.2-9 ~how tha.t the unaiLY opeJtat.OIl, +, ..£mp(emented. may be appUed to non-Mlihme the pltocedUllu and unpacfl Tuu 6.4.5-2, 6.4.5-3, 6.4.5-4, 6.4.5-5 and 64.5-13 have not been ..£mplemented. ~ I>how that ..Ldent,Lcal compa.t.{b,itUy U not en60ILced. TIWW6that a 6uJ1cwn w..tt.hout an M6..tgnment peJullilled. to the 6unwon vaUabte U IWt detected. Tut 6.8.3.5-4 6aili becalMe a I>p"Me cMe I>ta.tement wilt Tut.! 6.6.6.3-4 and 6.6.6.4-6 '.Ihow that ileal pMameteM not comp,ite. (Ththat nuted 00lt ~tatemenU UA-in9 0It chiLo the ~ame contlLo! valLiabte aile not detected. Tuu 6.7.2.2-6 and 6. 7.2.2-7 ~howthat -integVt. ovVt.otow Tut 6.9.4-9 ~hoWl>that -integeu mo.y be W/l.Uten lL6..ing a negat.i.ve 60iLmat. and undVt.6tow COIIdU.:.i.oMaile not detected. Tuu 6.8.3.5-5 and 6.8.3.5-6 ~how that -io ~e value 06 the CMe ..index doel> not cOiLiLupond to aCMe' labet, contlLol pa.4~U to the ~tatement aoteJt .the CMe ~tatement. The Veta..i.U 06 6a.il.ed tut~: eMOiL.u not detected. Tuu 6.8.3.9-5, 6.8.3.9-6 and 6.8.3.9-17 ~howthat a 60IL Tuu 6.6.3.5-2, 6.6.3.6-2, 6.6.3.6-3, 6.6.3.6-4 and contlLot valLiable may be UAed a6teiL the 60iLloop hM 6.6.3.6-5 6ail becaUAe the pa.4-6..ing 06 plLocedullu/ouncUoM teiLlll-inated. Nuted 00iLtoo~ UA-ingthe -6amecOllbtol M pMameteu hM not bHlt -implemented. valLiabte aile not detected. Tut 6.8.2.4-4 6~ becalL6e non-tocal goto~ have not been -implemented. V~ 06 oailed tuu: EIVLOJthandUng: Tuu 6.6.5.3-3, 6.6.5.3-4, 6.6.5.3-5 and 6.6.5.3-6 6ail beclUl4e fupo~e ha~ not been -imptemented. NUlllbe.t.-a..QeMOM cOiLiLectty detected: 14 NumbeJl 06 eMOM not detected: 28 (14 bM-ic caMul Imptementat.i.onde6..ined NllmbeJl 06 tu.u, 6ailed: 4 (1 bC<4.ic caw. e) NwnbM 06 tuu 1tu.J1: 15

    NumbeiL 06 .tuu -incoiLiLectt!! handled: 0 Veta..i.U eMOM not detected: 0'; ~ 00<.P Tut 6.2.1-7 4hoWl>that vM.i.abtu aile ..in.U.ia.Uzed to what o IIIa4pJl.ev.i.oUAt!!ie6t ..in memOlt!!. V~ 00 -implementat.i.on-de6.i.n.i.t.ion: Tuu 6.4.3.3-5 6.4.3.3-6, 6.4.3.3-7 and 6.4.3.3-8 -ind.icate .that no checW9 .i.4 pVt.6oiLllled on the tag 6-ieU 00 valLiant Tut 6.4.2.2-7 4hoWl>maxblt to be 32767. lLecoiL~. Tuu 6.4.3.4-2 and 6.4.3.4-4 ~howthattalLge ~et-6 aiLe accepted by the. compileiL but a lLun-t-ime lli-it 06 512 element!> An M~-ignme.11t to an empty lLecolLd .u not detected -in .tut .u .iJnpo4ed. A ~et 06 chaiL .u allowed. 6.4.3.3-12. Tut 6.6.6.1-1 ~holll~that no ~tando.Jr.dpiLoce.duIlu alL 6uncUol14 Tuu 6.4.6-7, 6.4.6-8 alld 6.7.2. 4-1 .ind.ic~e tha.t no may be pa.4~ed M p:vrameteiL4. bOIUld6check.i.ng .u peiL60iLllledon !oet opeiLat.ioM and OVeiL- lapp.i.Hg ~et6 aile not detected. Tut 6.6.6.2-11 g-ivu ~ome detail-6 00 'Leal nwnbeiL60~ and mach.i.ne chMl1CteiL.i.4t.i.C-6. Tuu 6.5.4-1 and 6.5.4-2 -6howthat a nU po.i.nteiL OILan uninU.i.a.Uzea po.i.nteiLaile IlOt detecte.dlii60lLe lL6e. Tuu 6.7.2.3-2 and 6.7.2.3.3 -6how.that bo,.tean eXpiLU-6.tOM aile 6ulty evaluated. Tut 6.6.2-6 -6how-6 that a 6uncUon w.Uhou.t an a4~.i.gnment to the. 6uncUon valLiabte .u not detected. Tuu 6.8.2.2-1 and 6.8.2.2c2 ~how that a valL.i.abte .u ~etected be60lLe the expJJ.u-6.ton .u evaluated -in an M~.tgnment Tut 6.6.5.2-1 -6hoWl>that a put on an ..input 6.i.te .u net ~tatemen.t . detected. Tut4 6.9.4-5 and 6.9.4-11 -6holllthat the nu.mbeA06 Mgit4 Tut 6.6.5.2-2 ~hoWl>that a get pa.4t e06.u not detected. ..in an exponent Meld v4lLiu accOiLd.i.ngto the -6.tze a6 the Tut 6.6.5.2-7 .i.nMcatu that a 6.i.te bu66eiL valLiabte can exponent. The dc6auU o~pu.t o.ietd (~.tdth 00lt ..intcgeu .and be aUVt.ed .i.ttegatty. .'I.z~ ~o v4lLiu accOlLcUngto the ~.(.ze DOthe expl!Uuon ~ted. Tut 6.10-2 iJlCU:catu thaA: a Jr.wJr.de cannot be peJr.6alLmed an the .6tandaJr.d 6de, output. Ve.ta.i.ll.> 06 6a..haw thaA: the a.UeJr.naA:ive cammell( del .t 6.8.3.5-8 6a.ill> - a la.Jr.ge c.a.l>e l>ta:tement CaLL6el>the e.qu.i.vCLfcnt l>ymbvi.6 have been .impfemer.ted. l>.ize 06 the pltaceduJIe to oveA6taw tl,e max.i.mum (.<",..:..t.

    QuaUty Me.a.l>Wleme.n./:

    NumbeJr.06 tuu Jr.un: 22

    NumbeIL 06 .tuu .incaJr.Jr.ecay hal1d(ed:

    Tut 6.8.3.5-14 l>haWl>that the athvu\iwe cla.ui>e .ill a ..c.a.l>e l>.taA:eme.n./: hal> 110t been .

    "',,)''1;~ Tuu 5.2.2-1 al1d 6.1.3-3 l>how tW .i.dettti6.{.eJr.l> Me cUl>Ul1g- u.il>hed OVeILthe..iJr. 6.vu.t ugh.t chaJr.iJ.c.t:cAl>only. Tut 6.1.8-4 .incUcaA:u tha.t 110 help u pJr.ov.i.ded 6oJr. de.tec.t:- .iIlg ul1clol>ed commen./:i>. Tuu 6. 2. I - 8 al1d 6. 2. 1- 9 .il1cUcaA:e thaA: mOJr.ethal1 50 t.ypu II'.ay be compiled al1d muJr.ethal1 50 tabeu may be declMed al1d l>ded. Tut 6.5.1-2 l>haWl>a Umil 06 10 .i.dettti6.ieJr.l> .ill a Ul.>t hal> beel1 .impol>ed. Tut 6.4.3.2-4 l>howl>thaA: all aJr.Jr.a.ywilh all .in.tegeJr. ,uldex- t.ype '<,6 110t peJuni..Ued.

    rut 6.4.3.3-9 l>lwWl>that l'aJr..iant. 6.i.ef.d6 06 a Jr.ecJr.od a.6e Pascal Validation Suite Report Jr.eVeJr.l>ecOJr.Jr.eta.t.ion 60Jr.l>tolLage...... 1.0 00 Tut 6.4.3.4-5 lWa.Jr..l>ha.t1.'6al.goitLthm) t.ooll 166 byt.u o~ code. C> No .t.i.m.i.ngb160Jr.ma.tWn u «vmable. Pascal processor identification Tut 6.6.J-1l>hoWl> tW pJr.ocedwLu may be nuted to a depth 06 1. FaJr. l>.taA:emen./:i>may be 'luted .to a depth gJr.ea.teJr..tltal1 This Pascal-VU compiler produces code for an EM-1 machin~ as de- 15 Itut 6.8.3.9-201 but wilh l>taA:emen.tl>may be nuted .to fined in (1J. It is up to the implementor of the EM-1 machine a depth 06 11 (tut 6.8.3.10-1). whether errors like integer overflow, undefined operand and range Tuu 6.6.6.2-6, 6.6.6.2-1, 6.6.62-8, 6 6.6.2-9 a.td 6.6.6.2-10 bound error are recognized or not. Therefore it depends on the tuted the l>qJr.t, a.ta11, exp, l>.iIl/co" and In 6unc.t:.ionl> and a~-1 machine implementation whether these errors are r~cognized in aU t:U:t6 WelLe compfe-ted l>UCCUl>6ully. IThe :tuu had t.o Pascal programs or not. The validation suite results of all known be mocU6-(ed .to avold the li.mU ptaced an pJr.ocedwLe l>.ize) . implem~ntations are given. Tut. 6.1.2.2-4 l>hoWl>thaA: cUvu.i.on.i.nto nega.Uve ope.-Jr.andi> There does not (yet) exist a hardware machine. Therefore, U .incal1l.>ut.ent. but d.i.vu.ion by nega.t.<.ve opeJr.and/> U C.Onl>u" EM-1 EM-1 programs must be interpreted, or translated into instructions (A/B) t.e-n. Thequoue..t u .tJr.unc 6oJr.aU ope.-Jr.andi>.madla.,b) for iItaiget machine. The following implementations clJrr~ntly ex- Uu .i.n (O,b-I). ist: Tut. 6.8.3.5-2 l>haWl>tlULt no Le COnl>tan./: wMelt c.annot be Jr.Melted. Implementation 1: an interpreter running on a POP-11 (using Tut 6.8.3.9-)8 l>hoWl>t.haA: no Jr.ange c.hec./li>Me .&1l>wed on UNIX). The normal .ode of operation for this interpreter is a 60Jr.con.tJr.ol vaJr..iable a6:teIL a 60Jr.loop. to check for undefined integers, overflow, range errors etc. ~ Tut. 6.9.4-10 l>hoWl>t.W t.he 6de, output, u 6lul>he-daA: Implementation 2: a translator into poP-11 instructions (using ,...,en end 06 job and tut 6.9.4-14 l>how"that. Jr.ecWll>.i.veI/O ul>.u19 UkIX). Less checks arv performed than in the interpreter, be- the- l>ame6de u a£!owe-d. cause the translator is intended to speed up the execution of well-d~bugged programs. Test COnditions Test 6.6.3.3-3: Test 6.8.2.2-2 : referring to Tester: J.Y.Stevenson Several pointer type del1nilions ("rekord) 19, 1979 type are incompatible. Date: December thesame record Validation Suite version: 2.0, dated June 19, 1979

    Test 6.6.3.4-2: The final test run is made Only a sin~le procedure identifier is allowed in a formal with a sl igh:ly modit i ed validation suite. The changes made can be divided into the following procedure parameter section. categories:

    Test 6.9.4-4: Typing errors Reals printed in scientific notation always contains an e~ponent part, even for e~ponent equal to zero. Test 6.4.3.5-1: Latest standard proposal the identifier 'ptrtoi' must be a type-identifier, not a variable-identifier. A newer version of the proposal is received in '~vember 1979. Because of the differences between these versions the follow- Test 6.6.3.3-1: ing tests are changed: The type of 'colone' should probably be 'subrange', not 'colour', because the types of actual and formal variable Tnt 6.1.5-6: parameters should be identical. The case of any letter occurring anywhere outside of a character-string shall be insignificant in that oc- Test 6.6.3.1-5: curren~'t JO the, meaninl! o(~,Q! progra",. In passinga pro~~e as actual parameter the parameters must not be specified. So line 29 must be changed to Test 6.4.3.3-3: conform(alsocQnforms) Test 6.4.3.3-11: Test 6.4.3.3-12: Test 6.6.5.3-1: Definition of an empty record is not allowed. This test is incorrectly terminated by 'END.'instead of lend. I. Test 6.4.3.3-10: The case-constants introducing the variants shall be of Test 6.6.1-7: ordinal-type that is compatible with the tag-type. The terminating 'end.' is incorrectly preceded by a [ space. Tes 6.5.1-1: The type of the component of a file-type shall be neither Test 6.9.4-14: a file-type nor a structured-type with a file component. The program parameter 'f' must be removed. ~ Test 6.9.4-4: Portability problems lO Tes t 6.9.4-5: 00 The character indicating the e~ponent part of a real as o or written in scientific notation is either 'e' 'E'. Test 6.6.3.1-2: A set of integer sub range containing more than 16 ele- Test 6.9.4-4: ments may give problems for some implementations. A spe- The representation of a positive real in fi.ed point for- cial option must be provided to the Pascal-VU compiler, mat does not include a space if it does not fit in the specifying the number of elements. specified field width. Test 6.6.6.2-3: Test 6.9.4-7: I~t all implementations support reals with 9 decimals of The case of each of the characters written as representa- precision. The precision supported by Pascal-VU is about tion for a Boolean is implementation-defined. 7 decimals (24 bits). Test 6.9.4-9: Erroneous programs Zero or negative field width is allowed in write- parameters. Some tests did not conform to the standard proposal of Febru- Conformance tests ary 1\79. It is this version of the standard proposal that is used by the authors of the validation suite. t~mber 01 tests passed = 138 Number 01 tests failed = 1 Test 6.3-1 : Test 6.6.3.1-4: Details of tailed tests Test 6.4.5-5: The meaning of these test program is altered by the trun- cation of their identifiers to ~ight characters. Test 6.1.2-3: , 'pro- Character sequences starting wlth t he 8 chara~ t~r s classlfled as the Test 6.4.3.3-1: cedur' or 'function' are e~roneo~sl~ A record definition consisting of a single semicolon is word-symbols 'procedure' and functlon. illegal. Test 6.4.3.3-7: Test 6.4.3.3-8: implemented, not Deviance tests The notion of 'current variant' is not even if a tagfield is present. Number of deviations correctly detected = 81 Number of tests not detecting deviations = 12 Test 6.4.6-4: Test 6.4.6-5: DetaIls of devIations Imple.entation 2: Subrange bounds are not checked.

    The following tests fail because the Pascal-YU compiler only Test 6.4.6-7: generates a warning that does not prevent to run the tests. Test 6.4.6-8: Test 6.7.2.4-2: Test 6.2.1-5: If the base-type of a set is a subrange, then the set A declaredlabelthat is neverdefinedproduces a warn- elements are not checked against the bounds of the ing. subrange. Only the host-type of this sub range-type is relevant for Pascal-YU. Test 6.6.2-5: A warning is produced if there is no assignaent to a Test 6.5.3.2-1: function-identifier. Implementation 2: Array bounds are not checked.

    The following tests are compiled without any errors while they Test 6.5.4-1 : 'donot conform to the standard. Test 6.5.4-2: Implementation 2: Nil or undefine~ pointers are not Te ,t 6.2.2-4: detected. Test 6.3-6: Test 6.4.1-3: Test 6.6.2-6: Undetected scope error. The scope of an identifier should An undefined function result is not Jetected, because it start at the beginning of the block in which it is de- is never usvd in an e.presslon. clared. In the Pascal-YU compiler the scope starts just after the declaration, however. Test 6.6.5.2-6: T;,st 6.6.5.2-7: Test 6.8.2.4-2: Ch.,nJi"ll the file position while the window is in use as ::1>0=- .... hst 6.8.2.4-3: actual variable parameter or as an element of the record "" Test 6.8.2.4-4: vdriable list of a with-statement is not detected. .:>: compiler does not restrict the places from The Pasc al-YU ...... where you may jump to a label by a goto-statement. 6.6.5.3-3 : o.D 00 6.6.5.3-4: C> Test 6.8.3.9-2: Implementation 2: Disposing nil or an undefined pointer Test 6.8.3.9-3: is not detected. Test 6.8.3.9-4: fest 6.6.5.3-5: Test 6.8.3.9-16: vari- There are no errors produced for assi.nments to a Test 6.6.5.3-6: Disposing a variable while it is in use as actual vari- able in use as control-variable of a jar-statement. .~le parameter or as an element of the record variabla list of a with-statement is not detected.

    Tnt 6.6.5.3-7: Error handl ing Test 6.6.5.3-8: Test 6.6.5.1-9: It is not detectedthat a record variable, created with The results depend on the EM-1 iM~lementation. tha variant formof new, is used as an operand in an e.- pressionor as the variable in an assignment or as an ac- Number of errors correctly oetected Implementation 1: 26 tual value parameter. Impleaentation 2: 12 Number of errors not detected Test 6.6.6.4-4: Implementation 1: 19 Test 6.6.6.4-5: ...entation 2: 33 Test 6.6.6.4-7: Imp' Implamentation 2: There are no range checks for pred, Details of errors not detected succ and chr. o.D Test 6.7.2.2-3: en Test 6.2.1-7: spe- Tut 6.7.2.2-6: It is allowed to print all integer values, even the Test 6.7.2.2-7: cial 'undefined' value. Test 6.7.2.2-8: overf lc.w is Implementation 2: Division by 0 or integer Tnt 6.4.3.3-5: not detected. Test 6.4.3.3-6:

    _ i' .. J. t' ~~ ~'"4"__'_.''...A''' L ~ ~ -- -- - Imple~entation dependence Test 6.1.8-4: y 80th ';' and '{' cause a warning message "f the are Ij..",berof test run = 15 found inside comments. ~u@b~r of tests incorrectly handled = 0 Test 6.2.1-8: Tes. Detail& of imple.~ntation dependence 6.2.1-9: Test 6.5.1-2: Large lists of declarations are possible in each b l oc k. Test 6.4.2.2-7: Test 6.4.3.2-4: r~axint =32767 An 'array[integerJ of' is not allowed. Test 6.4.3.4-2: Test 6.4.3.3-9: 'set of char' allowed. Variant fields of a record occupy the same space, using Test 6.4.3.4-4: the declared order. Up to 256 elements in the ran~e 0..255 in a set. Test 6.4.3.4-5: Test 6.6.6.1-1: Size and speed of Yarshall's algorithm depends on the im- Standard procedures and functions are not allowed as plementation of EM-1 parameter. Implementation 1: Test 6.6.6.2-11: size: 31 bytes Details of the machine characteristics regarding real speed: 4.20 seconds numbers. Implementation 2: Test 6.7.2.3-2: size: 204 bytes Test 6.7.2.3-3: speed: 0.62 seconds Boolean expressions fully evaluated. Test 6.6.1.7: At least 15 levels of nested procedures allowed. Test 6.8.2.2.-1 : Test 6.8.2.2-2: Test 6.7.2.2-4: :10 The expression in an assi~nment statement is evaluated 'div' is correctly implemented for negative operands. >- before the variable selection if this involves pointer n :z:"" dereferencing or array indexing. Test 6.8.3.5-2: Test 6.9.4-5: The compiler requires case constants to be compatible ..... with the case selector. 1.0 Number of digits for the exponent is 2. 00 <::> Test 6;8.3.5-8: Test 6.9.4.11: The default field widths for integer, Boolean and real Large case statements are possible. are 6, 5 and 13. fast 6.8.3.9-13: Test 6.10-2: The value of the control variable of a normally terminat- Rewrite(output) is a no-op. ed for-statement is equal to the final value. Test 6.8.3.9-20: Test 6.11-1 : At least 20 nested for-statements allowed. Test 6.1'1-2 : Test 6.'11-3: Test 6.8.3.10-7: Alternate comment delimiters implemented, but not the At least 15 nested with-statements allowed. other equivalent symbols. Test 6.9.4-10: Quality m..surement Line marker appended at end of job if the last character written is not a line marker. ~u",ber of tests run = 23 Test 6.9.4-14: Number of tests incorrectly handled o Recursive I/o using the same file allowed. Result& of tests The following 5 tests test the mathematical functions. For each the following three quality measures are extracted fro~ Test 5.2.2-1: the test results: Test 6.1.3-3: Only 8 characters are significant in identifiers. meanRE: mean relative error. maxRE: maximum relative error rmsRE: root-mean-square relative error

    . ------CDC-600D RELEASE 3

    ~ VALIDATION SUITE REPORT Test 6.6.6.2-6: Test sqrt{~): no errors and ~orrect results. ~ Processor Identification Computer: Control Data Corp. CYBER 74, running NOS 1.3 Test 6.6.6.2-7: Test arctan(~): may cause underflow or underflow errors. Proce8S0r: CDC-6000 Relea.a 3 (Zurich Compiler) of January, meanRE: Z .. -30.46 1979 ma~RE: Z.. -22.80 rmsRE: 2" -24.33 Test Conditions Test 6.6.6.2-8: errors.I Test e~p(x): may c.use underflow or overflow Tester: Rick L. Marcus meanRE: 2 .. '.25.37 mu~RE: 2 .. .17.62 Date: Janus ry, 1980 rmsRE: Z .. '.19.56 Validation Suite Veraion: 2.2 Test 6.6.6.2-9: Test sin(~): may cause unded low errors. meanRE: 2" -22.98 Conformance ma~RE: 2 .. -10.43 rmsRE: 2 .. -15.59 ~Number of tests pasaed: 128 Test cos{~): may cause underflow error ~. Number of tests failed: 11 meanRE: Z.. -21.69 lIIaxRi:: 2 .. - 8.23 rmsRE: 2 .. -13.37

    Test 6.6.6.2-10: Test 6.1.8-3 1s not relevant; only one form of comment errors Test In{x): no .. -25.12 is allowed...... meanRE: 2 00 maxRE: 2 .. -21.97 Test ~ faila because the compiler thinks that the o'" rmsRE: 2 .. -23.75 scope of node - real covers procedure ouch. Teat 6.2.2-8 fsils becauae assignment to a function ia allowed only within the functIon body. Extensions Test 6.4.3.3-1 faila becauae the declaration for an empty ~ (D) is not allowed. If the semi-colon is t'u~.oer of test run o removed from the record definitionthen there1s no error. whichcanbe seenin the nexttest.6.4.3.3-3.

    References Test 6.4.3.3-4 fails because the tag-field in a ~ may not redefine an existing type declared elsewhere. [1J A.S.Tanenbaum, J.\I.Stevenson, J.I..van Staveren, "Oescription of an ex~erimental machine architecture for use of block structured Test ~ fails becauae the compiler does not allow a .. where the =.II. lloniluailes", Informatica rapport lR-54. t.U&.2f.=W. contains a f11e aa a [2J ~h~ field. I believe the leteat version of the stenderd ISC standard proposal ISO/TC97/SC5-N462, duted Februarybe 1979.found s.~. prup~5al, in slightly modified form, ~an n: changes thia. Our c08piler will paaa the teat if filea pruc of filea are not allowed. A.M.Addym6n e.a., "A draft description of Pascal ',Software, ti-e and experience Hay 1979. An improved verS10n, received No- vc;ber 1979, is follo~ed as much as possible for the current Teat 6.6.3.1-1 fails in procedure Testtvo because of 'strict' type checking. Passing a vsriable of ~ P~scol-VU. colour 8S 8 parameter of ~ subrangecausestheerror. Passing 8S a value paramter is allowed(i.e.t orocedure Testone passes the teat).

    Test 6.8.3.~-4 fails because the range of ~ labels ia too large. Test 6.9.1-1 fsils because eoln is not necessarily true after the last character written on 8 line. The ~ .2ierrors!!Qi detected operating system pads to an'even number of characters on a line with blanka. Test 6.2.1-7 shows that the value of I is that which is left over from orocedure q (Is3). Test 6.9.4-4 fails because the test assumes only two places in the exponent field while there are three on our CDC syatems. Tests 6.4.3.3-5/6/7/8 indicste that no checking Is done on the tag field of variant records. Test ~.9.4-7 falls because 800leans are right justified Test 6.4.3.3-12 shows thet en empty ~ csn be on CDC 6000 Pascsl, not left as In the teat. I believe assigned sn undefined empty value. the lstest stsndsrd sssumes right justification, so thet the compiler would pass the test in that case. Test 6.4.6-8 shows that atrict type compatibility is not enforced for sets psssed by vslue. Deviance fua Test 6.6.2-6: The error was not detected. The value of the vsriable CIRCLEAREA was zero after the sssignment. Number of deviations correctly detected: 76 It seemsthat s function 1s assigned the value zero if no assignment is made in its body. Number of tests not detecting erroneous deviations: 18 Test 6.6.5.2-2 fsl1s to catch the error because of ~ Qf devistions systempaddingof blanksto an evennumberof blanka.

    Test 6.1.2-1 shows thst n!l is not a reserved word. Test 6.6.5.2-6/7 shows that I/O is not implemented according to the stsndard. T..ts ~ i. not relevant .. only upper case 1. allowed anywhere 1n a Pa.cal program. Teat 6.6.5.3-5 fail. becauae no check ia made by the runtime system to see if the vsriable being disposed of Test 6.2.1-5 ahows thst s !!R£l may be declared without 1s & parameter to the procedure which calls dispose. being used anywhere in a program. Tests 6.6.5.3-6/7/8/9 all fail. Tests bl:.l::i, 6.3-6, 6.4.1-3 show that a coanon scope error was not detected by the compiler. Testa 6.7.2.2-6/7 fail because an integer variable does not causean overflowerrorwhenit is overthevalueof Test 6.6.2-5 shows that a function need not be assigned maxint. a value inside ita body. The value of A after the ( ) asaignment A :- ILLEGAL(A) is zero. Tests 6.8.3.9-5/6 show that the value of an integer control variable is set to -576460752303423487after the Test 6.6.3.5-2 showa that strict type compatibilityof for loop. functions passed as parameters is not required. Test 6.8.3.9-17shows that two nested ~ loops may have Tests 6.8.2.4-2, 6.8.2.4-3, 6.8.2.4-4 show that a &QiQ the same control variable. between branches of a statement is permitted.

    Testa 6.8.3.9-2, 6.8.3.9-3, 6.8.3.9-4, and 6.8.3.9-16 ~ 2i .at.ll.incorrectIv ~ show that an aasignment may be made to a ~ atatement Teat 6.6.6.3-3: An overflow of the real variable reel control variable. caused terminationof the program. Test 6.8.3.9-14 ahows that a f2L loop control variable may be a variable global to the whole program. Imolementationdefined Number of tests run: 15 Test 6.8.3.9-19shows that in nested for loopa, if both have the same control variable, then the value gets Number of teats incorrectlyhandled: 0 changed by the inner loop and falls out of the outer loop after 1 iteration. ~ ~ imolementatlon-deoendence Teat shows that charactersmay be written even 6.9.4-9 T~st 6.4.2.2-7 shows maxint to be 281474976710655. if the field width ia too small. "'0 Tests 6.4.3.4-2/4 show that aet bounds must be positive, en> Ha nd 11 nil !n:2I. have no element whose ordinal is greater than 58, and f'T\ Number of errora correctly detected: 24 that ~ of char ia not legal.

    Number of errors not detected: 21 Teat 6.6.6.1-1 indicates that standard procedures and functions are not allowed to be passed as parameters to functions. Number of testa incorrectly handled: procedures and be of the same type as the ~ index, if the ~ index is a subrange, but the conatanta must be compatiblewith Test 6.6.6.2-11 detsils some machine characteriatics the £II$.index. regsrdingnumber formats. Teat 6.8.3.5-8 ahowa that a large ~ statement is Teata 6.7.2.3.2/3 show Boolean expreaaiona are fully permissible( >256 selections ). evaluated. Test 6.8.3.9-18shows that the use of a control variable Tests 6.8.2.2-1/2 show that a variable is selected ia allowed after the 1£[ loop. The run-time system beforean expressionIs evaluated in an assignment catches the use of the control vari.able this time statement. because after exiting the loop the varisble is set to the value found 1n Test 6.8.3.5.9-5, and the .-.u..c. Test 6.9.4-5 shows that the number of digits in an variable is out of rsnge. exponent is 3. Testa 6.8.3.9-20 and 6.8.3.10-7 indicate that L2t and Test 6.9.4-11 details the default field width specific- ~ statementsmay be nested to a depth greater than ations: 10 for integers and Boolesns and 22 for reals. 15.

    Test ~ shows that a rewrite is allowed on the file Teat 6.9.4-10 shows that file buffers are fluahed at the output. but that it has no effect (i.e-, output 18 not end of a the program. rewritten) unle88 there is an actual local file of . different nsme which replaces output on the control Teat 6.9.4-14 indicatea that recursive I/O ia permitted, statementto executethe program. using the same file.

    Test 6.11-1/2/3 show that alternate comment delimiters Extension and other slternate symbols have not been implemented. Number of tests run:

    Number of testa incorrectlyhandled: 0

    Number of tests run: 23 ~ ~ extensions Number of tests incorrectlyhsndled: 0 Test 6.8.3.5-14 shows that the 'OTHERWISE'clause hes been implemented in a ~ statement. !!Dill!.Jli.~ meesurements Teats 5.2.2-1 snd 6.1.3-3 show that iSentifiersare not first 10 ..... distinguishedover~whole length; only the \0 charactersare significant- 0> DODD C> Test ~ shows thst no wsrning is given if a valid statement or semicolon Is embedded in a comment.

    Tests 6.2.1-8/9 and 6.5.1-2 indicate that large lists of declarationsmay be made in each block.

    Test 6.4.3.2-4 shows that an arrav with an indextype of INTEGER is not permitted. At this site the use of INTEGER for an indextype is permitted only in the current implementationof dynamic arrays.

    Test 6.4.3.3-9 shows that the variant fields of a record occupy the same space, using the declared order.

    Test 6.4.3.4-5 (WarshaU'a algorithm) took 0.236 seconds CPU time and 171 worda (10260bita) on the CDC CYBER 74.

    Test ~ showa that procedures cannot be neated to a level greater than 9.

    Tests 6.6.6.2-6/7/8/9/10 tested the sqrt, atan, exp, sin/cDs, and 1n functions and all tests showed there were no significanterrors In their values...... C> C' Test 6.7.2.2-4 shows that div and mod have been imple- mented consistently. !24 returns the remainderof div.

    Test 6.8.3.5-2 shows that ~ constants do not hsve to

    / TI PASCAL 6. MAINTENANCE POLICY ------TI Pascal is a fully supported product. Bug reports are welcomed and maintainence and further development work are in O. DATE/VERSION progress.

    Release 1. 6.0', January 1980. 7. STANDARD

    1. IMPLEMENTOR/MAINTAINER/DISTRIBUTER TI Pascal conforms to "standard" Pascal, with the following principal exceptions: Implemented Texas Instruments. Information is available by A GOTO cannot be used to jump out of a procedure. * from TI sales offices, or write to The control variable of a FOR statement is local * to the loop. Texas Instruments The precedance of Boolean operators has been Digital Systems Group, MS784 * modified to be the same as in Algol and Fortran. P. O. Box 1444 The standard procedures GET and PUT have been * Houston, Texas 77001 replaced by generalized READ and WRITE procedures. or call (512) 250-7305. Problems should be reported to TI Pascal has a number of extensions to standard Pascal, including random access files, dynamic arrays, ESCAPE and ASSERT Texas Instruments statements, optional OTHERWISE clause on CASE statements, and Software Sustaining, MS2l88 formatted READ. P. O. Box 2909 Austin, Texas 78769 8 . MEASUREMENTS

    or call (512) 250-7407. The compiler occupies a 64K byte memory region. Compilation speeds are comparable to the 990 Fortran compiler. 2. MACHINE 9. RELIABILITY The compiler runs on a TI 990/10 or 990/12. The compiled object code can be linked for execution member of the 990 on any The system has been used by several different groups within computer family. TI since October of 1977, and by a number of outside customers since May of 1978. updates have been released in January 1979 3. SYSTEM CONFIGURATION and January 1980. This long history of extensive use and maintainance makes this a reasonably stable and reliable The compiler runs under the DXlO operating system (release product. 3) and requires at least a TI DS990 Model 4 system, which includes a 990/10 with 128K bytes of memory and a 10 megabyte 10. DEVELOPMENT METHOD disk. (More than 128K of memory may be required, depending on the size of the operating system.) Compiled programs can be The compiler produces object code which is link-edited with executed on any FS990 or DS990 system, using the TX5, TX990, or run-time support routines to form a directly executable program. DXlO operating systems. The compiler is written in Pascal and is self-compiling. 4. DISTRIBUTION 11. LIB~RY SUPPORT

    Available on magnetic tape or disk pack. Contact a TI TI Pascal supports separate compilation of routines and salesman for a price quotation and further details. allows linking with routines written in Fortran or assembly 5. DOCUMENTATION language.

    Complete user-level documentation is given in the "TI Pascal User's Manual", TI part number 946290-9701.

    ...... C'

    ,. Intel Specializing In Innovative Intoz=Mation Proc...lnq IBM 370-165 (Weizmann) Palcal/!o!T Imol nt.tlon Sp.ci~1c.t1on ( ~~ Ga..EI'IB (~Iz..."n) -0- Cac.: ~ov_er 8. 1979 Virilon ~ a.l 2.5 -1- Distributed. Imolementad 4ftd Maintainedby: Motorola 6800

    Mat.Tach ~ 8672-1 Via MalIore., La Jolla. Ca. 92037 "HI 22J-5566 x289 or 17141 455-66l8 This Is . COllpII~r for . c...~U~-b.ud syst~"'; and nlls for 135. ~I Int.l 8080/8085 and Ziloq no -2- I),jnasoft 5wst~1II8 -J- POB S1 :~:~~/~n~~:~~~:;O~~d.r the CP/M operating 'Yltem lor and equivalent .yatem such .. COOS, IMDOS, etc.) in a minimumat J2K byt.. ot mamory. Windsor Junction, North Saskatch~..." Caneda Tbe pacx&qa conliatsot .. compilerand ,ymbolicdebu9gar and qan.rat.. 8080/Z80 object c04e directly trOll the p..cal program source. Tit. symbolicdabuqqinq packaqa is optionally copi.d into the out;>ut obj.ct tU. by tha compU.",

    -4- Distribution I Mot.oroJa The p..cal/NT pacjcage 1a distributedon & 81n91e de.na1ty I-lnch tloppY' d.t.kett. which contain. I 68Q~~ TIt. compiler tor hscal/H'I' Tha symbolic d.buqqinq p"ckaq. The t8Xt tor the compiler error m q.. MOTOROLA 6809 PASCAL CHECKLIST FOR PASCAL NEWS Two utility prO'lraml writt.n in Pascal/~ to illultrate chI tac:ilit.!... at the lanquaqe - Cost ot . alnqla system lican.a tor Pucal/M'!' (includ.s "",nu.l) is $99.95 Manual available tor $ JO, 00 Q~[RS.~~. Sourc. tor the run-time packa'le i. $50.00 :!II Malt.r Charqe, Vi.a, UPS COD, and Purcha.. Or4er. 12 December 1979 ::- VersiO:l 1.0 ,.el~ased September 1979 n -5- Standard: Version 1.1 to be released February 1980 :r"" fiiCi'I'7R'r implements(In 2.5) a .ub..tot the full Pale.l languAge. Thi. wa. don. to ienerate both .pace &n4 time'etticien~ co4. tor I-bit microcomputer.. - J. IMPLlWNTORjOI STRIBIJTORjl.1AINTAINER '..cal/MT al80 contains a numberof "built-in" procedur... Tbis all::l'" soure. cod. uling- the.. procedural :to be..pcrtable to oth8r syltam.providiniappropriataroutin.. are impluented Motorola Microsystems other on the .y.t.... P.O. Box 20906 'a.c.al/Ml" omit. the following t.atur.. trom the '..e.l .tandard (J.ns.n , Wirth2n4 Ed.) : Phoenix, Arizona B5036 -No LAlEL declarationand therefore no G01'O. (602) 831-4108 ~on-standard tile support tor CP/M til.s 8Enwa.eration and Record type. not implement.d PACKED i. iqnored on boolean arrays b..21.~ All vari&.bl.. and parameter.areallocatadst.tically It... mark.d with .a - are bein'l implemented in the .ub..quent 1'.1 of 'a.cal/MT. Motorola 6809 EXORciser -6- Ext.natona: 'a.call MT contain. the tollowinq .~t.naion' (in r.l Z.5) I 1,-.lli11~Cill.MIl.Q!i 're-d.claredarray. "INPUT-ant! "OtrrPUT" tor manipulat!;\9I/O porta directly. &XTE'RNA1....ambly lanquaqe proc.dured.claration.for u.inq pre embl.d MDOS0903.~~ running on 6809 EXORciser with 56K I:'outine. ('l.inq PL/:ot parameter pall1ftq) bytes and floppy~disk drive. OPEN, CI.OSE. DILETE, CREATE, BLOCXR£AD. BLOCKWRITI routine. ~or acee..ine; CP/M til... Logical operator. (,) l8-diqitu.n-typedBCDarit:"..t1cboolean packaqa. tor -and or- {!I and -noe tNl 4. DISTRIBUTION -7- ~..ure.mant., On floppy diskette (M6809PASCLI) for $1500 from ompl1ac;.on .p..d 18 approximately 600 lin.'ilun, 6k ~yt.. .ymbol tabla .pace i. ava1labl. in Motorolil Microsystems a J:lK .y.t-1I1ft and J81t byte. table .pace 18 aV&l:'able in . 6o&K .y.tem. Run-time code hli:hout debu9gerl 1,. 5 to lO tim.. taster than "-code Ij'.teml. an~ 18 l, S :0 J time. larq.r ~h.n ?"COti8 P.O. Box 20906 .Yltera. (but '..c.l/:-tT r8quJ.re. no int8r;:rat.er), Phoenix, Arizona 85036 Orders should be placed throu9h local (602) 962-3226 Motorola Sales Office or Distributor -8- ~~:~;~~~ii~i :Z.!5 1.. ;lv4i1ab.L8 unIll8d.1&tely, periodically t.nrouqhout ~h. next :ear. .... Snh.nC8d :e1 will b. ~.de oN Also available from: FMG Corp (817) 294-2510 for TRS-80 Lifeboat Assoc. (212) 580-0082 for all formats RCA 1802 Golden Riv r

    The InforMtlon on thl' co~l1~r II uncle It appe...s to be all or 5. OOCUMENTATION p...t Iy In Ra1, end u II, for ( 40.

    'Motorola Pascal Langu~ge 1'1anual (M68PLM(OI)) describing The Golden River Co.. Ltd. Motorola implementation (56 pages). 6809 Pascal Interpreter Telford Road. User's Guide (H6B~9PASCLI(Dl)) describing operation of BIC~lter. o..ford,h Ire 0X6 IU.. interpreter (48 pages). Englend 6. MAIN'LENIINCE POLICY Bugs should be reported to software support. Subsequent releases will include corrections. Zilog Z-80 (D~

    ( ) ~e Zllog Z-8I! !Digital Harketlng)

    Ih.\~tl"ic1"i(m~; M~JY nut specify fnn'ktl rJilran.~ll:rs \':hirh tH'l' IH';jr.edt1i"e or 1WH' j!jii itl{'lItificj'~,. rld.iI.ill~'J [Ioint IHII.lill'r~, (11',\ liCit il!:plt:Ii:\,'ntL:d. rack~d dU,';I>",( hi" no (,flf'd. 1111 1'1i1l I>~ in:pleH,entet!in future fp.lcascs. Lnh.1l1cPPJsnts: I\cdress specificatioH for \'ari~blest Zilog Z-80 (lihaca Intersystems) alphitl'urn::.:r'ic lnh21:.; ~'n exit stJlt!:I:'nl, c;tetn.:tl ..H'OC/~UU!t.~ arid fUlictioH d(>clari1t'il,!',$~ no~n:"licc:il\!i\l itllpqcr~; otl1f:'\'Ii~e <.:l?iUse in Cd~,£ stCttf'nil..:nt; furd-in.e file (\ss-jgnr:1C"nts; .str'uct'IJI"'ed funcl;on Thll cOllpller runl under CP/M end producel lllacro-asseml~r code. The vdlli;;s"; stl'ing varidldc$ (lnd string functions. pr Ice II S2'1"S. Ithaca InterIYlt~.. (forMerly Ithaca Audio) 1650 Henlhaw Road Compiles in ~6!( bytes. Hunt ime SUPPOt't requires 3,.4K byte P.O. Box 91 in terprl'tel' 1,Iodul(). Ithaca, NY 14850

    Very good--first releaseu in September 1979 with few major problems repol'ted.

    ( ) ~~ Zilog Z-ee (I1etaT~ch) One pass recUI'sive descent compl1er generates variable length P-code. One pass P-,1ssembler (secont! releilse) generates a compact, position-independent code for interpreter. Code and interpreter both ROi~able for use in non-EXORcisel' environment.

    II. LIBRARY SUPTORT Stdndad Pascal procedlJl'es and functions, plus the ability to link dssenIDly langudge routines. ,..-0 ,,..,a>

    f . m~TOO 6. Maintenance Policy: Bug reports receive prompt attention and replies. rnG \VEJZMANN INsrmrre OF SOENCE Various optimizationprograms will be announced as available. ".HOVOT ' L 7. Standard.

    DI,...IfM.I"' 01' ",,'lItO IU.JHtM""CS Extensions to P4 (Standard)' Multiple globsl text files permitted and "FILE OF CHAR" properly processed, Procedure/Function may be declared as formal parameter (no run-time check Pascal User's Group for argument match), C/o J. Miner PACK,UNPACK,ROUND,REWRITE,RE5ET implemented, University Computer Center. 227 EX 208 SE Union St. September 5, 1979 e:el:e2 implemented for real e in WRITE-list; University of Minnesota MAXINT accessible as standard constant. Minneapolis, MN 55455 Non-Standard Extensions; FORTRAN, EXTERN and independent compilation option (*$E+*),

    Dear Mr. HiDer, Additional digraphs and operator codes (e.g. 11(.",".)",""")' 8. Measurements: Compilation speed: 1300 characters/second(measuredcompiling itself, I have transported the Zurich P4 Compiler to the GOLEM B computer of the >=- wei&mann Institute. Following is a checklist for Implementation Notes. 4442 lines x 80 characters per line in 280 seconds - 300 seconds with listing). '"C">::c . O. oat./V.rsion. 79/09/03 Compilation space. 288000 8-bit bytes (this can be reduced somewhat ...... from the actual IlB6416 4-byte words of storage, by reducing the stack/ 1. Distributor/Implementor/Maintainer. 00

    ~ o V'I

    / String conatants may be up to one line in length. GAMMA TECHNOl.OGY Pascnl for Data General ADS Systems Format control of real output is as defined by the standard. TEXT and MAXINT are predeclared. GOTOs must be to a line within enclosing scope (standard Pascal). ImpJeaentation Checkllst Stack frame allocation ia improved. Language enhancements: External procedures (Pascal or assembly code). 0) DATE/VERSION: HALT (or HALT(n» abnormal termination feature. AOS Pascal Revision 2 - Septembl'r 1979 Random access to sll files. Checklist date: November 16, 1979 AOS features: eo.pile command options (selecting e.g. cross-reference listing. IMPLEMENTOR /MAINTA !NER: 1) DISTRIBUTOR: binary only, syntsx check only, etc.). Pete Goodeve Gamma Technology, Ine. .~x stack/heap space allocated can be specified at both compil. 3012 Deakin Street 2452 Embarcadero Way and execution time. Palo Al to. CA 94303 Berkeley, CA 94705 (415) 856-7421 External files may be specified in execution command. TWX: 910-373-1296 8) MEASUREMENTS: No real timing testa have yet been made, but compiler compiles 3) SYSTEM CONFIGURATION: itself (on a quiet system) in 10 or 11 ..inutes. 2) MACHINE/SYSTEM CONFIGURATION: The interpreteroccupies 9 Kbytes. In addition and the Data General Eclipae and M600 Seriea AOS R.v 2.00 or later run-time about to this, Floating point hardware spsce needed for the progra..'s P-code, a default of 4K bytes is allocated for run- time stack and heap space; this can be increased or decreased by the user at 4) DISTRIBUTION: $500 packag. compri.es a 9-track, 800 bpi magnetic tape and compile and/or run time the range is from 2K bytes up to the limits of the documentation (package price is $50 if it is an upgrade to a previously purchaaed machine. release-l 8ystea. Tape ia In AOS dump format, containing a complete system. documentatton. and 9) RELIABILITY: Excellent, over the two months it has been running at the aourcea. Included at no charge are 80me public domain Pascal utilitie8 based on development site. No Pascal program has yet managed to cause a system crash those supplied by the University of Hinnesota. (unlike other languages runing under AOS). Revision 1 is now in use at abut 20 sites, with a good relisbility record. A 5) DOCUHENTATION: An instruction manual gives details of uBaae under AOS; a current few alight problems (..ainly with atsck overflow) found in that revision have been textbook should be referred to for knowledge of the P.acal lanaual8 ite.If. fixed in the new one. D1fferences frOll the (draft) standard (and from prevloua versiona) are described in reference sections of the manual. 10) DEVELOPMENT METHOD: Thia ia a fsat P-code interpreter syste... The compiler An AOS "HELP" file 18 supplied. and a180 documentation for the utilities. generates an extended, machine-independent symbolic P-code, which 10 then All doc:ullwntation is a180 in machine-retrievable form. translated and assembled into a compsct binary form; this ia bound with the An up-to-dotp list of bugs and notes will be maintained. interpreter to create an executable program file. The sequence from source to program file is ..snaged automatically by a aingle U8er command. 6) MAINTENANCE POLICY: Bug reports (in writing) are encouraged; pleue aand the.. to This "p_S" compiler has been developed directly from the Lancaster version of the distributor (Gamma Technology). The .Y8tem i8 expected to be atable; no incremental upgrades ore planned, but fixes will be distributed. Any future major P-4. It should be completely transportable.except that it assumes the character development will depend on demand. aet is ASCII. Aside from its use of HALT(n), the compiler is written entirely in standard Pascal. It was necessary. however. to split the compiler P-code into 7) STANDARD: 'lbe compiler is a considerably enhanced derivative of P-4 (christened overlay segments. so that large programs can be compiled (the overlay scheme is "P-5") wi th many major restrictions of the original removed. not available to uscr programs). The P-code translator is written 1n Pascal. And the run-time .ystem in Eclipse Reatr ic tions: aasemblY,language. PACKED 10 ignor.d; PACK and UNPACK are not i..pl nted. DISPOSE is not impl.m.nted; heap manage..ent ia by MARK and RELEASE. II) LIBRARY SUPPORT: Pascal cannot be linked to other languagea for the Eclipae Parameters may not be Procedural or Functional. (except assembly language), because each haa its own stack format. Subrange set constructors are not recognized. External procedure modulea may be compiled separately and linked to a main There are reetrictions on READ and WRITE (but not on GET and PUT) for (pascsl) progra... External procedures msy also be written in asse..bly lsnguage. filea either p8ssed a8 parameters or coded 88 non-text. One or two library procedures are supplied with the system (for exaaple, for Only four .l!!l files may be 1n UBe at one time (no reltriction on extra file management functions), but no general library is envisaged sside from other typee). the utllitiea alresdy supplied. Enhancement» over earlier verelllne (P-4); File. may be of any type (except FILE). Any (global level) files may be specified ext.rnal in program header. Full ASCII is supported; lower and upper case alphabetics are equiva- lent identifters. Braces may be used as comment delimfters. IMPLEMENTATION NOTES ONE PURPOSE COUPON

    o. DATE

    1. IMPLEMENTOR/MAINTAINER/DISTRIBUTOR ,. Give a ".,son, add,... and phone numHr. .}

    2. MACHI NE/SYSTEM CONFIGURATION ,. Any known Hmitson the confirlu,.uon «.uppon .oftw.,. required,e.g. ..,«I"f/$)'stMJ. .}

    3. DISTRIBUTION (. Who to nit, how it come., In what option., and at whllt pm:.. .)

    4. DOCUMENTATION(. Whllt /$ W.Mb/.,,,,d 'IIfh .)

    5. MAINTENANCE ,. I. it unmalnt8ined, fully maint.;"ed, ate7 .}

    6. STANDARD ,. How". it me..uIW up to stand8'd Pac'" I. it. $UIn.,7 Extended? How..}

    7. MEASUREMENTS ,. Of/t$$pHd tN.".ce. .)

    8. REUABIUTY ,. Any Infonn8tlon about field UN tN $/ta/nstlllled. .}

    .} 9. DEVELOPMENT METHOD r How wu it developed and what 'III" it wl'itten 1n7

    10. LIBRARYSUPPORT r Any oth", $UpfIOI't ftH compIIwln the fonn to othtN lengu8f/ft, $OfIn:e , err:. *) 01""""