<<

$10.00

PASCAL USERS GROUP Pascal News Communications about the Pascal by Pascalers

• APL Scanner • Computer Generated Population Pyramids • Path Pascal • Introduction to Modula-2 • Validation Suite Reports • Announcements

Number 26 JULY 83 POLICY: PASCAL NEWS (Jan. 83)

• Pascal News is the official but informal publication of the User's Group.

Purpose: The Pascal User's Group (PUG) promotes the use of the programming language Pascal as well as the ideas behind Pascal through the vehicle of Pascal News. PUG is intentionally de­ signed to be non political, and as such, it is not an "entity" which takes stands on issues or support causes or other efforts however well-intentioned. Informality is our guiding principle; there are no officers or meetings 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, main­ tainer, implementor, distributor, or just plain fan. Memberships from libraries are also encouraged. See the COUPON for details.

• Pascal News is produced 4 times during a year; January, April, July October.

• ALL THE NEWS THAT'S FIT, WE PRINT. Please send material (brevity is a virtue) for Pascal News single­ spaced and camera-ready (use dark ribbon and 15.5 cm lines!)

• Remember: ALL LETTERS TO US WILL BE PRINTED UNLESS THEY CONTAIN A REQUEST TO THE CONTRARY.

• Pascal News is divided into flexible sections:

POLICY - explains the way we do things (ALL-PURPOSE COUPON, etc.)

EDITOR'S CONTRIBUTION - passes along the opinion and point of view of the editor together with changes in the mechanics of PUG operation, etc.

APPLICATIONS - presents and documents source programs written in Pascal for various algorithms, and software tools for a Pascal environment; news of significant applications programs. Also critiques regarding program/algorithm certification, performance, standards conformance, style, output convenience, and general design.

ARTICLES - contains formal, submitted 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, informal correspondence among members which is of interest to the readership of Pascal News.

IMPLEMENTATION NOTES - reports news of Pascal implementations: contacts for maintainers, implemen­ tors, distributors, and documentors of various implementations as well as where to send bug reports. Qualitative and quantitative descriptions and comparisons of various implementations are publicized. Sections contain information about Portable Pascals, Pascal Variants, Feature-Implementation Notes, and Machine-Dependent Implementations. VALIDATION SUITE REPORTS - reports performance of various against standard Pascal ISO 7185. Pascal News Communications about the Programming Language Pascal b~ Pascalers

JULY 1983 NUMBER 26

2 EDITOR'S NOTES

5 OPEN FORUM

SOFTWARE TOOLS 11 Program APL Scanner By Vincent Dichristofano, Alan Kaniss, Thomas Robinson and John Santini

ARTICLES 26 "Don't Fail Me Now" By Srully Blotnick 27 Computer Generated Population Pyramids Using Pascal By Gerald R. Pitzl 32 Path Pascal - A Language for Concurrent Algorithms By W. Joseph Berman 37 An Introduction to Modula-2 for Pascal Programmers By Lee Jacobson and Bebo White

BOOK REPORT 41 Data Structures Using Pascal

ANNOUNCEMENTS 42 SBB Announces Pascal for IBM PC 42 Sage Opens Boston Division 42 New 16 Bit Sage IV 43 New Modula-2 Manual 44 USUS Fall Meeting 44 Text Editor Interest Group 44 Modula-2 Users Group 45 USUS San Diego Meeting 46 Volitions Modula-2 for IBM PC Charles Gaffney Publisher and Editor 47 IMPLEMENTATION REPORT The Pascal Newsletter is published by the Pascal Users Group, 2903 Huntington Rd., Cleveland, Ohio 44120. The Pascal Newsletter VALIDATION SUITE REPORT is a direct benefit of membership in PUG. Membership dues in PUG are $25.00 US 48 OmegaSoft Pascal Version 2 regular, other forms of membership please in­ quire. Inquiries regarding membership should 51 SUBSCRIPTION COUPON be sent to the above address. Newsletter cor­ respondence and advertising should be sent to the editor at the aforementioned address. 53 VALIDATION SUITE COUPON Advertising Rates: $300.00 Full Page. Please give your preference of magazine location: front, center, or back. 55 USUS MEMBERSHIP COUPON Hello, Board may lead to the establishment of Pascal as Well, this is the third issue I am involved with and a defacto standard for high school teaching and there have been many changes. I would like to write of spawn an entire mini industry of curriculum to Pascal first. meet the new requirements. It may also offer sig­ Pascal has enjoyed a jump in attention in the last nificant school marketing advantages to micro­ year. One reason is that there are Pascal compilers computer companies that already support Pascal available for many machines and, I am tempted to say, - such as Apple, IBM and Texas Instruments." they are available for any machine. Most of the major main frames have Pascal either directly or from a third I would like to see comments from you regarding party. this use of Pascal in a rite of passage. One step down in size, I know of only one machine, In this issue, you will find a reprint of Dr. Srully the Tandem computer which is without a Pascal imple­ Blotnick's column from Forbes magazine. I like this mentation. A Tandem representative here in Cleveland column because of the clever way he has made our informed me they have a language called "TAL" and economy dependent on you learning Pascal. in many cases will execute a Pascal program with no I enjoy Forbes magazine. They- emphasize com­ changes. mon sense and illustrate proven business practices. A couple more steps down in size are the small Dig­ Forbes also takes a pulse of industries, and small com­ ital Equipment machines and compilers are available puters is a fast growing industry. In a column called from about four sources. IBM has the Display writer "Technology", edited by Stephen Kindel, on March and Datamaster. These were released without our lan­ 28, 1983, he noted that 2% of the households in the guage, but in the last year, UCSD Pascal has been made U.S.A. own computers of one form or another. There available through IBM. Apple Computer has been a had been predicitions of 40% of households by 1990. strong and long supporter of Pascal. TRS 80 has UCSD This has been reduced to 20% in 1990 because there Pascal. doesn't seem to be software that is useful in households. The smallest machine with Pascal is the TI 99/4A. Mr. Kindel ends this article with a quote from Sey­ In this size, Commodore has promised Pascal for this mour Papert, an MIT professor: summer on the "64" and" 128" machines. "The real purpose of learning how com­ The small computer, that is, the home computers puters work should be to improve human logic and and small business computers, have exceeded $10 mil­ thought processes, to make people more creative, lion in sales. This is according to Future Computing, a not simply more dependent on machines." Richardson, Texas research firm. With a guess, I would say that Pascal is imple­ Maybe this would be a good issue to review the mented on at least 25% of these machines. If only 1% tools available in our back issues. This issue contains of these were being used to learn and program Pascal, the APL scanner. I am embarrassed to print this, not then 25,000 people are presently involved. This is a lot because of the program's quality, but becauS'e it was of people looking for the best books from which to learn. submitted four years ago. Well, no time like the present. I am making an appeal to our members to submit In issue #17 (yellow), Arthur Sale submitted "Re­ comments and reviews of text books so that we all may ferencer", a procedural cross reference. This program benefit from your experience. I get calls from authors provides a printout of the heading of each procedure requesting information on Pascal. To these people, the and function with indentation showing nesting. In issue best I can do is to send complete sets of Pascal News! #25, Mr. Yavner has improved on this program with With your comments and criticism, perhaps we could "A Better Referencer" . Mr. Yavner claims that Pascal influence future text books. News has been his sole source of instruction in Pascal. Herb Rubenstein of Budget Computer in Golden, I believe this is a compliment to Andy Mickel and Rick Colorado has sent a small article from Popular Com­ Shaw for their efforts to maintain this newsletter. We puting. It seems that advanced placement test in com­ should also thank our contributors, Mr. Sale for in­ puter science will use structure programming and the stance, for outstanding generosity. These people will Pascal language. These tests allow up to one year of appreciate your complements, criticisms and gifts of college level credits in computer science. The author of money. (Ho! Ho!) this article, Dan Watt, believes that the choice of Pascal Andrew Tandenbaum, in issues 21 and 22/23, pro­ in the testing may lead to Pascal as a <.lefacto standard vided us with" The EM 1 Compiler' '. This is a good look in high schools preparing students for college. Let me at all that is necessary for a pseudo 32-bit machine pas­ quote the last paragraph: cal compiler. "This situation illustrates the power of the The UCSD Pascal Project started with a 16-bit testing establishment to influence the lives of stu­ pseudo machine portable compiler. It was called P4 out dents and teachers. Although the vast majority of of Zurich, Switzerland by Vrs Ammann, Kesav Nori high schools now offer Basic as the standard com­ and Christian Jacobi. I mentioned this because it has puter language for most programming and com­ been published with critical commentary by S. Pem­ puter science classes, this action by the College berton and M.C. Daniels in 1982. It is presented as a 2 Editor's Notes case study of compiler design and is very interesting to Our PUG (EUR) has performed very nicely and I read. thank Helmut Weber and friends for their good work. Pascal Implementation But they have a problem concerning money. They have S. Pemberton and M.C. Daniels not charged enough for subscriptions and were pressed Ellis Horwood Limited Publishers to send our #24. As a result, I will mail all issues di­ Distributed by: rectly and I hope you will not be inconvenienced. Please John Wiley & Sons keep in touch with them as they are a strong group. 605 Third A venue I have saved the worst for last. In November, 1982, NY, NY 10016 I sent 300 copies of issue #24 to Nick Hughes in care USA of PUG (UK), Post Office Box 52, Pinnen, Middlesex HA5 3FE, United Kingdom. Using the phone number In #21 you will find Jeff Pepper's fine implemen­ 866-3816, the air express shipper delivered these issues tation of extended precision arithmetic. by mid-November. All well and good. The issues ar­ Nicklaus Wirth, Pascal's creator, wrote Pascal S rived before the cover date with plenty of time to post and we have it in # 19 (mislabeled # 17). This is a subset them to our English members. I called Nick at this num­ of Pascal and was intended as a teaching aid. ber many times, but spoke to him only after many Also in # 19 is a Lisp written in Pascal. months. It was late April and I asked ifl should use the "MAP", a Pascal macro preprocessor for large same procedure in shipping #25 to him. program development, is published in # 17. Nick said that the issues arrived properly and that Issue # 16 contains the Validation Suite version 2.2. method was efficient but wanted to know what was in This is the compiler checker that Arthur Sale and Brian #25. He told me that he did not like issue #24 and from Wickman have now revised to version 3. This new ver­ the sound of it, did not like issue #25. He had disliked sion is available by using the Validation Suite coupon #24 so much, he decided not to send any of them out. in the rear of this issue. Need I say more? "Prose", a text formatter, by John Strait is the ma­ Nick will not supply his mailing list so I am sending jor program available in # 15. A disclaimer in the in­ this issue and #25 directly to the members ofrecord in structions manual admits that it doesn't do everything, the United Kingdom as of 1979. If you feel a need to but I must say, it has a lot of capability. find out why Nick Hughes did not like issue #24 or In # 13, two programs were printed that performed would like to see it yourself, please call or write Nick the same work. A sort of "Battle of Algorithms". at the above address and ask for your copy. He has 300 "Pretty Print" and "Format" used any Pascal pro­ and I am sure he can spare one. grams as input and printed it in a consistent style. As a result of these difficulties, I will receive and For those of you looking for other Pascal periodi­ service all subscriptions from here in Cleveland, Ohio. cals, there are four of which I know. "Pascal Market From now on, there will be only one person to blame News", 30 Mowry Street, Mt. Carmel, CT. 06518. This if you have a complaint. is a nice quarterly for $9. As of this issue, a year's subscription is raised in Another quarterly for Oregon Software users is the price to $25 a year and $50 for three years. These rep­ "Pascal Newsletter". Maybe this is too narrow in con­ resent two sets of costs; production and organization. tent, but you will know what Oregon Software is up to. Production costs are typesetting, printing and mailing. Their address is 2340 SW Canyon Rd., Portland, OR. Other activities of production are editing, reviewing, 97201. quality assurance and formatting. These tasks are per­ A very slick magazine with good design is" Journal formed by "yours truly" and presently I do them for of Pascal and Ada. " You can contact them at West Pu b­ free. (I'm real smart!) lishing Company, 898 South State Street, Orem, UT. Organization is a cOst of servicing you and other 84057. The cost is $14 for six issues. members satisfactorily. This includes collecting and re­ The USUS News and Report is more a system viewing the mail, depositing checks, updating the mail­ user's journal, but the system is based on Pascal. They ing list, sending back issues to fill new subscriptions and also have a software library, seventeen floppy disks full, sending sets of previous years back issues. In order to and all in source code and written in Pascal. do this correctly, and in a timely fashion, I don't do it. Now to the business of Pascal News. Pascal News, I pay a firm to perform "fulfillment" and it takes one as the Pascal periodical granddaddy published since or two days per week. This cost is small compared to January 1974, has had its ups and downs. In 1979 our the bad feelings generated if not done correctly and circulation was 7,000; now it is 3,600. Our biggest prob­ quickly. lem has been irregular pUblication. I am committed to These are costs of which you are totally respon­ four issues this year and I am considering six issues next sible. This newsletter has been a beneficiary of volun­ year. I believe that regularity will supply us with growth teerism. There are no volunteers now (save me). In many and members and more software tools. magazines, advertisements will pay for all production As I mentioned in the last issue, PUG (AUS) has and organizational costs plus provide profits, some­ stopped and I, in the USA, have taken over their area. times large profits. Unfortunately, they have not sent me their mailing list The costofafullpage adinByte or PC or PC World and I fear that I have lost touch with our members there. is over $2,000 and these are publications with 500 pages! This issue will be sent to those members listed as of Now we may be able to keep our costs down and 1979 and I hope they will "spread the word" and the publish more often if we accept advertising. Three subscription coupons! hundred dollars per page is not expensive. I will pursue Open Forum 3 advertisers and I am asking for your help. If you are be taught - but not in the abstract. Students must writing a book, have your publisher advertise with Pas­ be exposed to the precision and detail required in cal News. If you are making software packages, influ­ actually implementing their algorithms in a real ence your boss in the virtues of an ad in Pascal News. programming language. Because of its structured If you manufacture or sell computers, sell your product nature, Pascal provides an effective vehicle for from the pages of Pascal News. This is the oldest Pascal combining these two approaches. This book publication and, I proudly say, the most influential. teaches problem-solving heuristics, algorithm de­ This newsletter help spread Pascal and our mem­ velopment using top-down design, and good pro­ bers were most influential in the standard efforts. gramming style concurrently with the syntax and I believe Pascal News' new mission is to enable semantics of the Pascal language. " Pascal to be taught in the easiest way. This is in many One of the letters mentions high resolution graph­ forms. For instance, reviews of books and texts, dis­ ics. I know of two texts that use Pascal as the illustra­ cussion of what features to teach first as a foundation, tive language of their algorithms. They are "Principles how to teach advanced courses, discussions of exten­ ofInteractive Computer Graphics" by Williams New­ sions or standard program tools to include in every well man and Robert Sproull, 1979 McGraw-Hill and "Fun­ written program as it is appropriate. damentals ofInteractive Computer Graphics" by James By the way, Andy Mickel tells me that the "Pascal Foley and Andries Van Dam, 1982 Addison-Wesley. User's Manual and Report" by Jensen and Wirth has Two notes from members: sold 150,000 copies in 1982. This is interesting consid­ Steven Hull of Campbell, California, received a ering that in the previous seven years, it sold 175,000 notice from me that # 22/23 had been returned to us be­ copies. A very sharp jump in interest. cause the postal service will not forward bulk mail. His A new text book has been sent to me, "Pascal" by reply: Dale/Orshalik, 1983 DC Heath. A nice title, short and to the point. The preface states a philosophy that I would "I guess this will teach me to move from like you to comment on. Lakewood (a suburb of Cleveland, Ohio). Didn't "In the past there have been two distinct ap­ know bulk mail wasn't forwardable. The Postal proaches used in introductory computer science Diservice has been re-routing every piece of junk texts. One approach focused on problem solving mail for a full year ... I might have to file suit to and algorithm design in the abstract, leaving the stop it all! learning of a particular language to a supplemental manual or a subsequent course. The second ap­ And from Eric Eldred of New Hampshire who re­ proach focused on the syntax of a particular pro­ warded Pascal News with a three year subscription and gramming language, and assumed that the dutifully filled the coupon with name and address and problem-solving skills would be learned later arrived at a request for "Date". Eric filled in "No! through practice. Married!". Thanks Eric, I needed that! We believe that neither approach is ade­ quate. Problem solving is a skill that can and should Charlie

4 Open Forum To Charlie Gaffney, Pascal compiler. What makes it surprising is that to the best of my knowledge I have never sent in an entry, and I'm glad you have taken on Pascal News. I hope the information provided is about a year and a half out it works. of date. Perhaps, I should say what I would like to see pub­ In case you would like to provide your readers with lished in Pascal News. The most valuable things are valid information, I have enclosed an implementation 1) Tools, and 2) Info on the various implementations. note for the currently available compiler. I have also In my job we are using many computers. It is very help­ enclosed a copy of the ISO validation suite report from ful to know which compilers work well, meet stand­ our language manual. ards, and produce efficient code. is nearly Work is currently being done on moving this com­ bug free, and works as specified (with UCSD quirks). piler to the 68000 family of processors and should be IBM Pascal VS is good - extensions are large pre­ available by the end of 1983. senting conversion problems if they are used. It has a On another note, I have received issues number 21, good interface to . VAX Pascal is plain va­ 22/23, and 25, but not issue 24. I am also enclosing a nilla, appears to work well but we have not tested it in check for a 3 year membership - please see if you can difficult situations. HP PascallOOO works fine but does determine what happened to number 24. not have a stack architecture and seems to compile slowly. Recent tests on HP Pascal 1.0 for the HP 200 Sincerely, computers seem to indicate it derives from UCSD al­ Robert Reimiller though it is a native code 68000 compiler. It seems to Owner, OmegaSoft work very well. We are interested in Pascal for the Data 5787 Brandywine Ct. General Eclipse. Camarillo, CA 93010

Good luck, Dennis Ehn December 1, 1982 215 Cypress Street Newton Centre, MA 02159 I hope the letter referring to the possible end of the P.U.G. is wrong! I can be of some help if needed.

Gentlemen: Allen Duberstein Pine Instrument Co. Would you be so kind as to send information on 3345 Industrial Blvd. the Pascal User's Group (PUG) and its official publi­ Bethel Park, PA 15102 cation Pascal News. Recently we have acquired a mi­ crocomputer Pascal compiler and are very much interested in keeping up with current developments in January lO, 1983 Pascal. Our system is based upon a SouthWest Technical Dear Mr. Gaffney: Products Corporation S/09 computer, running the Enclosed is a check covering both the remailing UniFLEX (similar to UNIX). If spe­ cost of Pascal News #24 ($5) plus my membership re­ cific information is available for this unit, please let us newal for two years ($18). know. My apologies for getting out of synchronization with Additionally, the college has several (approxi­ the Pascal Users Group. As the post office informed mately 18) Apple computers which are capable of run­ you, I recently moved to the address noted. Frankly, I ning the UCSD Pascal System. Once again, any special hadn't received aPascal News in so long that I simply information here would be very helpful. forgot about it. It appears that I won't miss any issues We look forward to hearing from you and hope that - the enclosed All-Purpose Coupon is from issue #23. we can make a positive contribution to the Pascal User's Interestingly, after a long period (3 years) of not Group. using Pascal, it looks like I will be using it once again. Yours Truly, We have a couple of Convergent Technologies work­ Lawrence F. Strickland stations in my office. These are very nice 8086-based Dept. of Engineering Technology machines; Burroughs sells them as the B-20s, and NCR St. Petersburg Jr. College sells them as WorkSavers. We will probably be getting P.O. Box 13489 a Pascal compiler, and I am looking forward to getting St. Petersburg, FL 33733 back into Pascaling in the near future.

Dear Sir, Sincerely, Read T. Fleming Ijust received issue number 25 of Pascal News and 144 Irving Avenue # B-3 was surprised to find an implementation note for our Providence, RI02906 Open Forum 5 November 30, 1982 March 3, 1983 I was surprised and pleased to receive issue num­ Dear Mr. Gaffney: ber 24 of Pascal News. Thanks for taking it over. I do I'm writing to let you know why I am not renewing have one question, however, which you might be able my subscription to Pascal News. The main reason is to help me with. What year is it? My address label in­ that the price is now too high for the utility of the prod­ cludes [82] on it but the previous issue I received was uct (at least to me). I appreciate your efforts to keep dated September, 1981. I notice that this issue is dated PUG and Pascal News going, but I'm afraid they may January, 1983. Should I send in another year's sub­ have outlived their usefulness. Pascal is not really in scription money now? What happened to 1982? I never need of promotion as it was when PUG was formed. have managed to figure our Pascal News' SUbscription The Journal of Pascal & Ada may be an appropriate scheme. Maybe a note in the issues towards the end of successor. a year saying "if your address label says [82] it's time As a long-time subscriber and occasional contrib­ to send in a renewal" would help. utor, I wish you luck in your efforts. Thanks for your help. Richard Leklanc Richard Furuta Assistant Professor Computer Science, FR-35 Georgia Institute of Technology University of Washington Atlanta, GA 30332 Seattle, WA 98195

January 7, 1983 8 February 1983 Hang in there, Charlie! Dear Sir, I received your notification of renewal in the mail Andy Mickel yesterday. I am slightly concerned that you may not 106 SE Arthur Avenue have received the check which I mailed to you in De­ Minneapolis, MN 55414 cember. I hope that it has only been a slight mix-up, and in fact, my subscription has been renewed for 3 years, as I requested. December 9, 1982 I am currently using the Pascal implemented by Dear Sirs: Microsoft for the IBM Personal Computer. It has some non-standard features which were provided in order to Could you provide us with information on mem­ allow programmers to access the full capabilities of the bership in your organization, both personal and insti­ machine. This implementation is quite flexible, and was tutional, as well as the subscription cost of your journal. designed to allow users to produce systems programs, We are also interested in a rigorous comparison of as well as application programs. the various PASCAL versions implemented by mini and The greatest shortcoming to this product, how­ vendors. Do you know of any such ever, is its lack of usable documentation. Even some­ comparative research? We are making plans to offer one like myself, who has been programming in Pascal Advanced Placement Computer Science in the fall term for 8 years, has difficulty in trying to locate the appro­ of 1983, and wish to select an effective computer. priate material in the 'reference manual'. Once this is overcome, the user is able to use this version for the Very truly yours, production of some very powerful software. Charles McCambridge I continue to look forward to the delivery of your Director fine newsletter. I enjoy tht1 articles, and realize how dif­ Instructional Materials Services ficult a task you have. Keep up the good work. Niskayuna High School 1626 Balltown Rd. Regards, Schenectady, NY 12309 Robert A. Gibson 1609 Lake Park Dr. Raleigh, NC 27612 December 25, 1982 Merry Xmas! Good luck, Charlie! Is your "acqui­ sition" of PUG a sign that PUG and USUS will some­ day merge? I'm not sure I'd like that, but let's see. November 30, 1982 Pascal is being used for process control of laser Jim Merritt trimming systems. We use Oregon Software Pascal. P.O. Box 1087 Morro Bay, CA 93442 Barbara Huseby, Training Dept. Electro Scientific Industries 13900 N. W. Science Park Drive December 24, 1982 Portland, OR 97229 Please send me information on joining the Pascal 6 Open Forum User's Group, I am a software project engineer at Gen­ Process Controls Division (Mater's of the controls for eral Electric in Syracuse. I am currently in the process the T3 Industrial Robot). of selecting a high level language for internal program­ I am interested in any literature you have to send ming of a 1024 x 1280 resolution raster display. Pascal me. In particular, I would like the titles of the books is the leading candidate, therefore, I am very interested you consider best for teaching Pascal - either on the in the latest information regarding the language which Apple II or on computers in general. Apple, Inc., sent I feel a user's group could provide. me the Pascal Reference Manual (just a bit or a nibble My interest does transcend my work however as I over my head). I've also read copies of the DOS 3.2 do own a Commodore SuperPET which includes the Reference Manual and their Basic Programming Man­ University of Waterloo software package consisting of ual. I covered all these before classes started and wound Pascal, APL, Fortran, Basic and a 6809 Assembler. up tutoring two other student/inmates.

Sincerely, Sincerely, Douglas W. MacDonald Brian Appleman 166-767 4303 Luna Course 15802 St. Rt. 104 Liverpool, NY 13088 P.O. Box 5500 Chillicothe, OH 45601

2/5/83 P.S. If you need more on my background, just ask. To Whom It May Concern: I just received your notice to inform me that my 83-02-24 membership is about to expire and that I should renew Dear Charlie: now. I am a member of PUG (AUS) which hasjustfolded, I would like to tell you that I would consider re­ and I would like to re-enroll through PUG (US). newing if I could be assured of getting my money's worth - this time! I don't share Arthur Sales view that PUG and PN have no purpose now that there is an ISO standard. The When I first joined in 1981, I didn't hear from Pas­ world still needs cheap, good software and PN (in a cal News for almost a year. Then a few months ago, I received a second issue, but that's been it. modest way) supplies some of it. Also, some organi­ zation is needed to defend and develop good program­ Now I am a convicted Pascaler. I understand the ming language and style. difficulties of operating a non centralized club, but $20 PUG (AUS) says I have a credit of 12 (old) issues should buy some kind of organization for things I feel. and that the funds have been sent to you. Please will Can you assure me of a better value this time around? you accept my re-enrollment and advise me how many (new) issues I am now entitled to? Finally, I, and I'm sure, many others appreciate Cordially, your offer to keep PUG/PN going. David Abate Thanks again. Micro People 116 S. Bowdion St. Yours sincerely, Lawrence, MA 01843 Peter Edwards 40 Davison St. P.S. Question: Do you intend anything on UCSD-Pas­ Mitcham, Vic. cal? This is my greatest interest. Australia 3132 7 January 1983 December 3, 1982 Hi, Best wishes in this venture, Charlie. I agree that This is a note in a bottle to: 1) find out if you're still Pascal News and P. U.G. are worth saving. out there, and 2) what's happening with Pascal. It doesn't seem to be taking the bite (or is that byte) out John W. Baxter of Basic I thought it would. 750 State Street, Apt. #224 We will start covering Pascal as soon as we have San Diego, California 92101 finished Basic programming - about five weeks from now. The extension program from Hocking Technical College in Nelsonville has provided seven Apple II and Apple III computers and two printers. By the end of the February, 1983 year, they will have installed a winchester disc and either You people have ripped me off for the last time! a modem or a microwave link to their main campus By your own back order form (attached) you show computer. We'll need it by then to cover the Cobol and that my renewal in 1981 paid for 3 issues mailed in 1982. Fortran IV programs we'll be writing. But then, WHAT OF MY RENEWAL PAID IN 1982? Most of my practical computer experience is in as­ ONLY ONE ISSUE #24 COUNTS??? AND THAT sembler language. I used it at Cincinnati Milacron's HAD TWO PREVIOUSLY PUBLISHED PRO- Open Forum 7 GRAMS!! (That is, programs I had ALREADY re­ Wirth's follow on to Pascal and Ada in parallel. To me, ceived.) If you ran a decent organization, you'd make this would seem a way of keeping PUG alive as well as my 1982 renewal count for 1983 also. providing a growth path to these languages for Pascal programmers. David S. Bakin I use PascaliVS extensively at work and I have Softech Inc. found its extensions the best of any other Pascal com­ 360 Totten Pond Road piler for S/370 compatible machines. Almost all of its Waltham, MA 02154 extensions are within the "spirit" of Pascal and uses a very good extension to STRING data. Of particular convenience is its READSTR and WRITESTR func­ December 24, 1982 tions (they are procedures actually -unfortunately). I force the concept of function upon them by embedding We're indebted to you, Charlie! their invocation within a function when required. I never received issues 20 and 21 of Pascal News Wayne N. Overman during the confusion, although I did mention this at 3522 Rockdale Ct. times. I would certainly purchase them separately, but Baltimore, MD 21207 I am not prepared to purchase two sets to get them. Please advise.

February 17, 1983 Thanks for your work, Dear Mr. Gaffney, Bob Dinah I am one of those folks who does not have a cur­ 630 Alvarado St. #207 rently correct address with Pascal News. San Francisco, CA 94114 Enclosed is a check for $5 for a copy of issue 19 which was returned to you. Thank you on behalf of all the members of the user's November 12, 1982 group for the effort you are putting out. It is very much Dear Pascal User's Group: appreciated. The only source of information that I have on the Tom Bishop Pascal User's Group came from "The BYTE Book of P.O. Box A Pascal", according to an article written by Kenneth Kenmore, WA 98028 Bowles. An editor's note of July 1, 1979 listed the an­ nual newsletter as $6.00 per year. I am enclosing $12.00 in case things have increased since that date. If this March 14, 1983 amount is insufficient, please make it up on back issues. I am currently using an Apple III with Apple com­ Dear Sir or Ms.: puter's version of UCSD Pascal. There does not seem We plan to offer Pascal at our school. I would ap­ to be more than a dozen books written on Pascal, and preciate receiving information on your group and, if just a few on UCSD. possible, a sample copy of Pascal News. I am an ex-electrical engineer, turned to building Any suggestions or information you could send construction. Previously, I worked for Westinghouse would be appreciated. We are particularly concerned Research Center in Pittsburgh, and used the Burroughs that the new Apple 2- E does not support Pascal with B6500 main frame computer with ALGOL language. one disk drive. We had hoped tht UCSD Pascal with The B6500 used a number of formats and types that I one drive would work on the Apple 2-E. miss; the Fixed Format was especially useful since it Thanks for your help. allowed the user to specify the number of total digits and the number of decimal digits combined. I would like Sincerely, to use this format in UCSD Pascal. Thanks for taking the time to help me. Harold Baker Director, Computer Science Very truly yours, Litchfield High School Litchfield, CT 06759 Larry J. Moorhead 5207 - 32nd Street East Bradenton, Florida 33508 February 11, 1983 Hi! 18 March 1983 Here's my renewal. I really enjoy Pascal News and Dear Sirs, have been upset about what has happened with it the For the first time we have received a copy of Pas­ past 18 months or so. It has been of substantive value cal News, and it has been read with great interest. to me, partiCUlarly in the area of the style of Pascal cod­ We would like tojoin your User Group but cannot ing among the community that have submitted articles. find either a price or contact address for our region. I would like to see more articles on Modula 2, Please send us this information as soon as possible, 8 Open Forum so that we can become members and start receiving your me introduce myself first. I am a student pursuing a journal on a regular basis. computer course in the Hong Kong Polytechnic - a We have taken note of your abhorrance of paper­ licensed user of your OMSI-PASCAL-2 V1.2. I don't work (and endorse the sentiment) and will send the nec­ know what your definition of user may be. May it be essary prepayment once we receive the information. my Polytechnic or any student or programmer who use your OMSI PASCAL-l under the Polytechnic, I ven­ Yours sincerely, ture to call myself a user in this letter, and would like Bette Kun to join the Pascal Users' Group and receive the Librarian newsletter. Control Data In the past few months, I have been doing exten­ P.O. Box 78105 sive programming using PASCAL, and find it very Sandton, South Africa 2146 handy, especially in writing structured programs. How­ ever, until recently when I develop some system pro­ grams, I find problems. I discover that there is no source 20 April 1983 listing or documentation on the OMSI PASCAL-l run Dear Mr. Shaw: time system (possibly in file FPP.RTS) and its relation­ ship with RSTS/E, and I cannot interface with the low Enclosed is a check for $10.00 for a one-year sub­ level 110 trap handlers without knowing their details. I scription to the PASCAL Users' Group Newsletter. We find some problems on the RESET ODT mode, but I have just recently acquired PASCAL-2 here at Villa­ cannot deal with it in assembly level. nova and our students are using it on LSI-II systems All in all, my problem is highly personal and does running RT-ll V4.0 for applications involving real-time not in any way bear relation with the Hong Kong Po­ control, data acquisition, and computer communica­ lytechnic. However, as a student on computing, I don't tions. want to leave problem unsolved. So, please send me any informational help, if possible. Sincerely yours, Included please find a bank draft of $6 for Richard J. Perry, Ph.D. subscription. Villanova University May I state once more my request. I need infor­ Dept. of Electrical Engineering mation on OMSI PASCAL-l run time system espe­ Villanova, PA 19085 cially the EMT trap handling. Thank you very much in advance.

15th February, 1983 Yours faithfully, Dear Mr Gaffney, Mr Kam Man-Kai Flat 8 As a long PUG user the demise of PUG-AUS is a 3/F Ting Yin House blow. Anyhow, as you can see from the attached letter Siu On Court I would love to continue and thus need your help. Tuen Mun - N.T. Could you please detail the fees for 1983 for us Hong Kong "down under" for surface mail and air mail and as you can see I'm afraid I've not got issue number 21. Can you help? For interest I use: UCSD Pascal/p-System ERA-50 Computer 6th November, 1982. (8-bit. 8085 base) Pascal MT+ under CP/M ERA-50 Computer Dear Mr. Mickel, (8-bit, 8085 base) I am a student of computing studies in the H.K. and MP/M ERA-50 Computer (8-bit, 8085 base) Polytechnic. Recently, I got a chance to buy a Chinese Pascal MT+86 under CP/M-86 ERA-80 Computer version of ' A Practical Introduction to Pascal' by Wil­ (16 bit, 8086/8087 based) son & Addyman from which I was informed that there and MP/M-86 ERA-80 Computer is a PUG in States. (16 bit, 8086/8087 based) Briefly understanding the objectives ofthe PUG, I find myself in great interest in joining the group. Would Regards, youb be so kind as to provide me with further infor­ Dr. William J. Caelli, F.A.C.S. mation as far as the PUG is concerned. I am eagerly President looking forward to your reply. ERACOM Group of Companies P.O. Box 5488, G.C.M.C. Yours sincerely, Qld. 4217, Australia Alan Kwong 1-8-82 12, Boundary St. Po Hing Bldg. Dear Sir/Madam, 8/F, Block 'c' This is the first letter I write to contact you. Let Kin., H.K. Open Forum 9 December 23, 1982 February 3, 1983 We have been using Oregon Software's RT-ll Pas­ Good job, Charlie! and good luck to the renewed cal implementations for over three years with excellent Pascal News! results and complete satisfaction; Pascal is used for sci­ entific "number crunching" , program development, al­ Norman W. Molhant gorithm testing, etc. 320 Principale Tres-Saint-Redempteur, P.Q. Bob Schor Canada JOP lPO The Rockefeller University 1230 York A venue New York, NY 10021 May 1,1983 A professor in Ithaca, NY told me there exists a December 30, 1982 public domain UCSD Pascal available for micro's. I have a 60K Z-80 which uses memory map video, A worthwhile journal. and a 63K 8085/8088 (both machines S-100 bus) which uses a TVI 950. I also have a H-29 terminal (like Z-19 George Williams but with a detached keyboard). Union College Is there really any way of getting this UCSD Pascal Schenectady, NY 12308 running on one of my systems? (I have UCSD on the Sage also Modula-2. Good stuff.)

March 22, 1983 Thanks, Dear Mr. Gaffney: J. E. Pournelle, Ph.D. 12051 Laurel Terrace ~have previously received Pascal News through Studio City, CA 91604 Universit}j of Tasmania. Is it still published? If so, do I have anycredit on my subscription dues? I would also be interested in information about USUS.

Yours sincerely, M.J. Palmer CSIRO Private Bag P.O. Wembley, W.A. 6014

10 Open Forum ~ .r~ y~ .r~ y~ .r~ y~ .r~ y~ .r~ y~ .r~ Y~.r~ .9 Program APLscanner

By Vincent Dichristofano, Alan Kaniss, Thomas Robinson, and John Santini NADC, Philadelphia, PA

), 1 program APLscanner(;nput { + TERMINAL }, output , APLflle 84 RightArg: PackedString ( f6 ); 2 85 Fi rstStatement: Avfunc; 3 86 NextFuncTabPtr: "FuncTab; 4 • Purpose: 87 NumOfStatements: integer 5 This program is an implernentation of APL in Pascal. 88 end; 6 89 FParmTab record 7 • Authors: 90 -----pt,:VaL: "VaL Tab ( sdl and sd2 ); 8 Vincent Dichristofano 91 LastParm: '"FParmTab { link to last 9 Alan Kaniss 92 ( sd 1 or sd 2 ) 10 Thorn as Rob i n son 93 end; 11 John Santini 94 Dimenlnfo record '"Dimenlnfo; 12 authors ' affiliation - NADC 95 ~Dimen: dimenlength: integer 13 96 14 Phll. PA. USA 97 end; 15 98 OpRecord record ---opTildex: integer; 16 project leader: Dr. Joseprl ~tezzarobd 99 DpSymboL: integer 17 100 18 This program was written as part of an :ndependent study 101 end; 19 course at Villanova University. 102 OperandTab ~ecord 20 103 --ope;:-Ptr: "VaLTab ( sval ); 21 • Submitted and accepted for Pascal News. C'EC 197c. 104 LastOper: '"OperandTab link to last sval 22 105 end; 23 ) 106 SubrTab record { sf 24 LabeL 107 ---carredSubr: "FuncTab ( s 1 ); TokenCaLLingSubr: "TokenTabLe ( 32 ) ; 25 ----;00; 108 26 109 StatemCaLLingSubr: "vfunc ( s3 ); 27 const 110 LastSubrPtr: "SubrTab { link to last sf 28 ---prefix1 ;;; 60; 111 29 prefix2 = 62 ( prefix for CDC ASCII 12-ht codes ); 112 OpTable = array [1 •• 16J 9..!. OpRecord; 30 MaxVa rNameLeng th ;;; 10; 113 VarTabPtrType = AVarTab; 31 MaxINputLine = 132; 114 TypeVa LTabPt r = AVa LTab; 32 InputArraySize;;; 134; 115 TokenPtr = "'TokenTable; 33 NumberOfMessages = 100; 116 PtrFuncTab = "'FuncTab; 34 MessageLength = 80; 117 TypeValuesPtr = "'values; 35 118 APLcharSet = 36 type 119 Casymbol, BsymboL, CSymboL, DSymboL, ESymboL, FSymbol, GSymbol, ---packedString = packed array [1 •• MaxVarNameLengthJ of 0 •• 8191; 120 HSymbol, ISymboL, JSymbol, KSymbol, LSymbol, MSymbol, NSymboL, 37 TokenNoum = ------38 121 OSymboL, PSymbol, QSymbol, RSymbol, SSymbol, TSymbol, USymbol, (FormRes, FormArg, GlobVa r, MonadOper, ReductOper, DyadOper, 39 122 VSymbol, INSymbol, XSymbol, YSymbol, lSymbol, OneSymbol, TwoSymbol, SpecOper, constant, StatEnd); 40 123 Th ree Symbo l, Fa ur Symbo l, F i veSymbo l, Six Symbo L, SevenSymbo L, vaL ues = record 41 124 EightSymbol, NineSymbol, ZeroSymboL, colon, RightArrow, LeftArrow, ~Val: real; 42 125 SmallCircle, period, LeftParen, RightParen, LeftBracket, NextValue: Avalues 43 126 RightBracket, semicolon, quadrangle, space, plus, minus, times, end; 44 127 divide, asterisk, iota, rho, comma, tilde, equals, NotEqual, 45 VarTab record 128 LessThne, LessOrEquaL, GreaterOrEqual, GreaterThan, AndSymbol, 46 ----var-Name: PackedString { v1 }; 129 OrSymboL, ceiling, floor, LargeCircle, ForwardSlash, DoubLeQuote, 47 FuncTabPtr: ~ FuncTab { v2 - ftab ;; 130 negative, QuestionMark, omega, epsiLon, UpArrokoJ, DownArrow, alpha, 48 VaLTabPtr: "ValTab { v3 - vtab ); 131 UnderScore, del, delta, SinqLeQuote, EastCap, WestCap, SouthCap, 49 OeferedVa LTabPt r: - FPa rmTab; 132 NorthCap, ibeam, TBeam, VerticalStroke, BackwardSlash); 50 en~~xtVarTabPtr: "VarTab 133 134 text = file of char; ~~ Va LTab record 135 S3 ---rnt"'ermedResuLt: Boolean; 136 var 54 dimensions: integer; 137XCoLonSym, XRightArrokoJ, XLeftArrokoJ, XLittLeCircte, XPeriod, XLeftPar, 55 FirstDimen: "Dimenlnfo; 138 XRightPar, XLeftBracket, XRightBracket, XSemicolon, XQuadSym: ForwardOrder: Boolean; 139 integer; ;~ FirstVaLue: "vaLues; 140 character: array [APLcharSetJ of integer;

58 en~;xtValTabLink: "VaLTab 141 APLstatement: array [1 a. InputArraySi zeJ of integer; 142 digits: array [OneSymbol •• ZeroSymbotJ ofinteger; 59 TokenTabLe = record 60 143 ErrorMsgs: packed array [1 •• NumberOfMessages, 1 aa MessageLengthJ of ~Token: ATokenTable; 61 144 char; case noun: TokenNoum ~ p 62 145 APLfile: text; ~rmRes, FormArg, GlobVar: { vtab 146 MOpTab, DOpTab, RedTab, CharTab, SpecTab: OpTabLe; 63 (Va rTabPt r: AVa rTab); 64 147 SaveLabel: PackedSt ring; MonadOper: (Monlndex: integer); 148 name: PackedString; 65 ReductOper: CRedlndx: integer); 66 149 NekoJTokenPtr, OldTokenPtr, HoldTokenPtr, SaveTokenPtr: "'TokenTable; DyadOper: (DOplndx: integer); 150 Test FuncPt r, NekoJFuncTabPt r, OLdFuncTabPt r: '" FuncTab; 67 SpecOper: (Charlndx: integer); 68 151 NekoJVarTabPtr, OldVarTabPtr: "'VarTab; constant: (ValTabPtr: AValTab); 152 LeftValPtr, RightVaLPtr, VaLPtr: "'values; 69 StatEnd: (EndAdj: integer) 70 153 NekoJValues, NekoJValPtr: "'values; end; 154 NekoJDim: "'Dimenlnfo; ~~ vfun c record 155 DimPtr, NekoJPtr, LeftDimPtr, RigthDimPtr: "'Dimenlnfo; ~Stmnt: ATokenTable; 73 156 VarPointer: "VarTab; NextVFunPrt: Avfunc; 157 OldVFuncPtr, NekoJVFuncPtr: "'vfunc; 74 StatLabel: PackedString 75 158 NekoJVaLTabLink, OLdValTabLink: "'VaLTab; end; 159 position: integer; 76 OperatorTypr;;; (niladic, monadic, dyadic); 77 160 LineLength: integer; FuncTab ;;; record 161 code, CoLCnt: integer; 78 ----rw;cName: PackedString f1 ); 162 FuncStatements: integer; 79 arity: OperatorType { f2 }; 163 TokenError, Fi-rstFunction: Boolean; 80 result: Boolean { f3 true explicit }; 81 164 LineTooLong, HasLabeL: Boolean; ResultName: PackedString f4 }; 165 switch, FunctionMode, TokenSkoJitch, ItsAnldentifier: Boolean; 82 LeftArg: PackedString ( f5 }; 83 166 OperTabPt r: "OperandTab { sv };

Software Tools 11 167 Pt rLastOper: "OperandTab; 270 DOpTab[8].OpIndex := 89; DOpTab[9].OpSymbol:= character[equaLs]; 168 SubrTabPtr: "SubrTab; 271 DOpTab[9].Oplndex := 71; 169 RParmPtr: "FParmTab I pl ); 272 DOpTab[10].OpSymboL := character[NotEqual]; 170 LParmPtr: "FParmTab I p2 ); 273 DOpTab[10].OpIndex := 72; 171 VFuncPtr: "vfunc [ n1 }i 274 DOpTab[11J.OpSymbol := character[LessThne]; 172 hold: "TokenTable I holds last symbol ); 275 DOpTab[11J.OpIndex := 73; 173 276 DOpTab[12].OpSymboL := character[LessOrEqual]; 174 277 DOpTab[12].OpIndex := 74; 175 procedure InitParseri 278 DOpTab[13]. OpSymbo l := cha racter[GreaterOr Equa l]; 176 279 DOpTab[13].0p.Index := 75; 177 begin 280 DOpTab[14].OpSymbol := character[GreaterThan]; 178 OperTabPtr := niL; SubrTabPtr:= nil; LParmPtr:= nil; 281 DOpTab[14].OpIndex := 76; 179 RParmPtr := nil; VFuncPtr := ..~ .. :! .. ~)-hold := nil; XColonSym:= 1; 282 DOpTab[15].OpSymboL := character[AndSymboLJ; 180, XRightArrow := 2; XLeftArrow:= 3; XLittlefucLe:= 4; 283 DOpTab[15].OpIndex := 77; 181 XPeriod := 5; XLeftPar:= 6; XRightPar:= 7; 284 DOpTab[16].OpSymbol := character[OrSymbol]; 182 XLeftBracket := 8; XRightBracket:= 9; XSemicoLon:= 10; 285 DOpTab[16].OpIndex := 78; 183 XQuadSym := 11; new(OperTabPt r); OperTabPt r'" • LastOper := ni Li 286 184 PtrLastOper ::;: OperTabPtr; 287 special character 185 end { initparser }; 288 186 289 CharTab[1].OpSymboL := character[colon]; 187 290 CharTab[2].OpSymbol := ch.racter[RightArrow]; 188 procedure Initial izeCharacterSet 291 CharTab[3].OpSymboL := character[LeftArrow]; 189 { read installation character set from file}; 292 CharTab[4]. OpSymbo l := cha racter[Smal LCi rele]; 190 293 CharTab[5].OpSymbol := character[period]; 191 var 294 CharTab[6].OpSymbol := character[LeftParen]; 192 TestForPrefix: integer; 295 CharTab[7].OpSymbol := character[RightParen]; 193 Fi leC~aracter: char; 296 CharTab[8].OpSymbol := character[LeftBracket]; 194 SymbolIndex: APLcharSet; 297 CharTab[9]. OpSymbo L := cha racter[Ri ghtBracket]; 195 298 CharTab[1OJ.OpSymboL := character[semicolon]; 196 begin 299 CharTab[11].OpSymboL := character[quadrangle]; 197 ----;;Set (APL f i l e); 300 CharTab[12].OpSymbol := character[space]; 198 for SymbolIndex := asymbol !2. BackwardSlash do 301 SpecTab[1 ].OpSymbol := character[colon]; 199 begin 302 SpecTab[2].OpSymboL := character[RightArrow]; 200 read(APLf i le, Fi leCharacter>; 303 SpecTab[3].OpSymbol := character[LeftArrow]; 201 304 SpecTab[4].OpSymboL := character[LeftParen]; 202 The following code would be removed for non-CDC installations 305 SpecTab[5].OpSymboL := character[semicolon]; 203 306 SpecTab[6].OpSymboL := character[LeftBracket]; 204 Test ForPrefix := ord( Fi leCharacter); 307 205 if (TestForPrefix = prefix1) or (TestForPrefix prefixZ) 308 reduction operator 206 then 309 207 ~gin 310 RedTab[1J. OpSymbo l := cha racter[p lus]; RedTab[1 ].OpIndex := 2; 208 --read (APLf i le, Fi leCharacter); 311 RedTab[2].OpSymbol := character[minus]; RedTab[2].OpIndex := 3; 209 character[SymboLIndex] := 100 • TestForPrefix + ordC 312 RedTab[3].OpSymbol := character[times]; RedTab[3].OpIndex := 4; 210 Fi leCharacter); 313 RedTab[4].OpSymbol := character[divide]; RedT.b[4].OpIndex := 5; 211 end 314 RedTab[5].OpSymboL := character[asterisk]; RedTab[5].OpIndex := 6; 212 else 315 RedTab[6].OpSymbol := character[equaLs]; RedTab[6].OpIndex := 21; 213 316 RedTab[7].OpSymbol := character[NotEqual]; 214 317 RedTab[7].Oplndex := 22; 215 character[SymboLIndex] := ordCFi leCharacter) 318 RedTab[8].OpSymbol := character[LessThne]; 216 319 RedTab[8].Oplndex := 23; 217 end 320 RedTab[9].OpSymboL := character[LessOrEquaLJ; 218 end {initializecharacterset }; 321 RedTab[9].Oplndex := 24; RedTab[10]. OpSymbo L := cha racter[GreaterOrEqua LJ; 221 procedure ReadInErrorMsgs; 322 323 RedTab[10].OpIndex := 25; 222 324 RedTab[11].OpSymboL := character[GreaterThan]; 223 var 325 RedTab[11].OpIndex := 26; 224 MsgRow, MsgCol: integer; RedTab[12].OpSymbol := character[AndSymboL]; 225 326 327 RedTab[12].Oplndex := 27; 226 begin RedTab[13]. OpSymboL := character[OrSymbol]; 227 read LnCAPL file); 328 329 RedTab[13].Oplndex := 28; 228 for MsgRow := 1 to NumberOfMessages do RedTab[14].OpSymboL := character[cei Ling]; --ror MsgCoL := 1to MessageLength do J'O 229 331 RedTab[14].OpIndex := 29; RedTab[15].OpSymbol:= char.cter[floor]; := I r-{ ); 230 ErrorMsgs(MsgRow, MsgCoLJ blank out error messages RedTab[15].OpIndex := 30; for MsgRow := 1 to NumberOfMessages do 332 231 333 RedTab[16]. OpSymbo l := c haracter[La rgeCi rele]; 232 begin { read error messages file Tn fr~ 334 RedTab[16].OpIndex := 31; digits[OneSymbol]:= 1· ~Col := 0; 233 digits[TwoSymboLJ := 2; digits[ThreeSymbol] = 3; 234 while not eoln(APLfile) do 335 begin - 336 digits[FourSymbol] := 4; digits[FiveSymbol] = 5; 235 digits[SixSymboLJ := 6; digits[SevenSymbol] = 7; MsgCol := MsgCol + 1; 337 236 338 digits[EightSymbol] := 8; digits[NineSymbol] := 9; 237 readCAPLfiLe, ErrorMsgs[MsgRow, MsgCol]); 339 digits[ZeroSymbol] := 0; 238 end; readlnC APL file); 340 end { filluptables ); 239 341 240 end end {read inerrormsgs }; 342 241 343 Irocedure Pr; nt APLSt atement; 242 344--- 243 procedure Fi llUpTables; 345 var 244 346 prefix, nurn: integer; 245 347 index: integer; 246 348 247 349 begin monadic operators 248 350 for ; ndex := 1 to Li neLength do 249 begin - - MOpT.b[1]. OpSymbo l character[plus]; MOpTab[1]. OpIndex 351 250 := := 2; ---;T""APLstaternent[index] > 6000 MOpTab[2]. OpSymbo l := cha racter(minus]; MOpTab[2l. Op Index := 3; 352 251 353 then 252 MOpTab[3]. OpSymbo l := cha ract erCt ; mes]; MOpTab[3]. Op Index := 4; begin MOpTab[4]. OpIndex 354 253 MOpTab[4]. OpSymbo l := cha racter[div ide]; := 5; prefix := APLstatement[index] div 100; write(chr(~refix»; MOpTab[5]. OpSymbo l := cha racter(asteri skJ; MOpTab[5]. OpIndex := 6; 355 254 356 num := APLstatement[index] - 1ffij-* prefix; 255 MOpTab[6]. OpSymbo l := cha racter( iota]; MOpTab[6]. OpIndex := 21; write(chr(nun» MOpTab[7J. OpSymbo l := cha racter( rho]; MOpTab[7]. OpIndex := 22; 357 256 358 end 257 MOpTab[8]. OpSymbo l := cha racter( comma]; MOpTab[8]. OpIndex := 23; e lsewr; t e( chr (APLs tatement [i ndex]» MOpTab[9]. OpSymbo l := character[ti lde]; MOpTab[9]. Op Index := 1; 359 258 360 en~ 259 writeln dyad ic operators 361 260 362 end { pr in tapl statemen t }; 261 363 262 DOpTab[1]. OpSymbo l := character(plus]; DOpTab[1 ].OpIndex := 52; DOpTab[2]. OpSymbo l := character(minus]; DOpTab[2].OpIndex := 53; 364 263 365 )rocedure SError(ErrorIndex: integer) ; 264 DOpTab[3]. OpSymbo L := character[times]; DOpTab[3].OpIndex := 54; DOp Tab[4]. OpSymbo l := character(divide]; DOpTab[4].OpIndex := 55; 366 265 367 var 266 DOpTab[5]. OpSymbo L := character[asterisk]; 368 MsgCo l: integer; 267 DOpTab[5]. OpIndex = 56; DOpTab[6]. OpSymbo l character[iota]; DOpTab[6]. OpIndex 87; DOpTab[7].OpSymbol character[rho]; 369 268 370 begin 269 DOpTab[7]. OpIndex = 88; DOpTab[8].OpSymboL cha racter(comma]; 12 Software Tools 371 TokenError := true; 473 var 372 for MsgCoL := 1 to MessageLength do 474 index: integer; 373 wr i te (Er rorMsg ScE r ror Index, MsgCOLJ); 475 374 writeln; PrintAPLStatement, echo statement to user }; 476 begin [ see if two names (identifiers) are the same 375 for MsgCol := 1 to(position - 1) do write(' I); 477 NamesMatch := true; 376 rnteLn(chr(character(UpArrowJ») {print pointer to user error }; 478 for index := 1 to MaxVarNameLength do 377 end { error } ; 479 if NameOne[index] <> NameToo[indeXJ then NamesMatch := faLse 378 480 end r namesmatch }; 379 481 380 procedure Sk i pSpaces; 482 381 483 procedure TableLooklJp(TestCh.ar, TableLength: integer; tabLe: OpTabLe; 382 begin 484 var TableIndex: integer); 383 whi le (APLstatement(positionJ character(spaceJ) and (position <= 485 384 -----cTneLength) do 486 var 385 position := position + 1 487 lndex: integer; 386 end { ski pspaces }; 488 387 489 begin [ check for membership in a given table 388 490 ----raDlelndex := 0; 389 procedure GetAPLstatement; 491 for ; ndex := 1 to Tab LeLeng th do 390 492 ,f TestChar =tabLe(indexJ.O,:)S·ymboL ~ TabLeIndex := index 391 var 493 end r tablelookup }; 392 --rnputChar: char; 494 393 TestForPrefix: integer; 495 Fl rstTry: Boolean; 394 496 procedure identifier(var name: PackedString; var ItsAnldentifier: 395 497 BooLean); - begi n 396 498 for LineLength := 1 to MaxINputLine do 397 499 var APLstatement[LineLengthJ := character[space], blank out line }; ----riameLength: integer; 398 500 399 LineLength := 0; FirstTry:= true; position:= 1; NameTooLong: Boolean; LineTooLong := faLse; 501 400 502 APLstatementClnputArrayS; zeJ := character[omega]; 401 503 begin APLstatement[lnputArraySize - 1J := character[space] 402 504 ItSAnldentifier := false; SkipSpaces; , set end-of-line }; 403 505 if It sALett er (APLs tatement Cpos i t i onJ) repeat 404 506 tilen 405 ~n 507 ~gin ~not FirstTry then getseg(1nput) { test for *cr* only}; 406 508 ~eTooLong := faLse; ItsAnldenti fier := true; ITr"'S""tTry := false; 407 509 for NameLength := 1 to MaxVarNameLength do { blank out name while (not eoln(;nput)) and (not LineTooLong) do 408 510 name[NameLeng th] :?c ha ract ere spaceJ; -,-'f-LineLength < MaxINp'U"tLine NameLength := 0; 409 511 whiLe (ItsALetter(APLstatement[positionJ) or (ItsADigit( 410 then 512 --;\;j5'Lstatement[pos it i onJ)) do 411 ~g;n 513 Lfr1eLength := LineLength + 1; read (Input Cha r); begin { build identifier }" 412 514 th : = NameLeng th + 1; 413 515 ~eLeng The following code would be removed for non-CDC installations if NameLength <= MaxVarNameLength 414 516 TestForPrefix := ord(InputChar); "tFlen name[NameLengthJ := APLstatement[position] 415 517 if (TestForPrefix = prefix1> or (TestForPrefix = prefix2) 416 518 erse NameTooLong := true; then position := position + 1 417 519 ~g;n end; 418 520 --read(InputChar) ; i fNameTooLong 419 521 APLstatement[LineLengthJ := 100 TestForPrefix + ord( t'fi"en SError(70) name greater than max length 420 * 522 InputChar); en-d- 421 523 end end tidenti fier }; 422 524 eLse 423 525 424 526 procedure MakeNumber(var RealNumber: real; var ItsANumber: Boolean); 425 527 426 APLstatement[LineLengthJ := ordCInputChar) 528 var 427 529 end sign, DigitCount: integer; 428 530 else LineTooLong := true 429 531 end begin { convert character input string to numerical representation 430 532 until LineLength <> 0 reject null lines }; ItSANumber := faLse; SkipSpaces; sign:= 1; DigitCount:= 0; 533 431 if L;neTooLong then SError(71) ReaLNumber := 0.0; 534 432 end' getapl statemeri't }; if (APLstatement[posi t ion] = character[negat ive]) or (It sAOi 9 it ( 433 535 - APLstatement[position]) 434 536 then 537 435 function ItsADigitCTestChar: integer): Boolean; ""tiegin 436 538 ItSANumber := true; 437 var 539 if APlstatement[positionJ = character(negative] 438 ' Digitlndex: APLcharSet; 540 tFien begin sign := - 1; position:= position + 1 end; q" 541 "iT""no~AOi 9 it (APLstatement[posi t ion]) 441 begin' test to see if input character is a digit 542 442 ----rtSADigit := false; tilen 543 ---neg in 443 for Oigitlndex := OneSymboL to ZeroSymbol do 544 444 if TestChar = character[OivtlndexJ then ItsADigit := true ----sE'rror(1) { digit must follow a minus sign I; 545 ItsANumber := false; 445 end t itsadigit }; 546 end 446 547 447 else 548 begin form whole number portion 448 function ItsALetter(TestChar: integer): Boolean; 5~ 449 551 whiLe ItsADigit(APLstatement(posit;on]) do 450 var 552 beg i n 451 Letterlndex: APLcharSet; 553 RealNumber := 10.0 * RealNumber + CharToNum(APLstatement 452 554 [position]); 453 begin' test to see if input character 1S a letter 555 position := position + 1 454 ---rtsALetter:= faLse; 556 end; 455 for LetterIndex := asymboL to ZSymbol do 557 if""""APLstatement[p'ositionJ = character[periodJ 456 if TestChar = character[Letterlndex] then ItsALetter := true 558 then 457 end {itsaletter }; 559 begin 458 560 position := position + 1; 459 561 while ItsAOigit(APLstatement[position]) do 460 function CharToNum{TestChar: integer): integer; 562 begin { form fractional portion } 461 563 ReaLNumber := ReaLNumber + CharToNum(APLstatement[ 462 var 564 position]) * exp«- 1.0 - DigitCount) * 2.3025851 463 Digitlndex: APLcharSet; 565 ). 464 566 DigitCount := DigitCount + 1; 465 begin { chage a character to a number 567 position := position + 1; 466 ---ror Digitlndex := OneSymbol to ZeroSymboL do 568 end" -;-f TestChar = character[OigltlndexJ 467 569 i.!..D;~itCount 0 then then CharToNum := digits[OigitlndexJ 468 570 begin end {Chartonurn }; 469 571 ----sE"'rror(2) digits must follow a decimal point I; 470 572 ItsANumber := false; 471 573 end 472' function NamesMatch(NameOne, NameToo: PackedString): BooLean; 574 end;-

Software Tools 13 676 else 575 RealNumber := RealNumber * sign 677 not MonadicReference 576 end --rr 577 end 676 tnen SError(73) { dyadic reduction reference 679 else 578 end {make an umber }; 680 begin { operator is valid reduction operator 579 681 NewTokenPtr" .noun := ReductOper; 580 682 NewTokenPtr" oRedl~dx := Tablelndex; 581 function MonadicReference: Boolean: 683 end; 582 684 position := Chklndex + 1; 583 var 685 end 584 SubPosi t ion, Tablelndex: integer; 686 else 585 687 "tiegin 586 begin { see if operator is monadic within context of input line MonadicReference := false; 688 ----ra6'leLookUp(APLstatementCpositionJ, 9, MOpTab, Tablelndex); 587 689 if TableIndex = a then DyadicOpCheck 588 if NewToken?t r" .NextToken'" .noun StatEnd then MonadicReference := true 690 else -- 589 691 iT not MonadicReference then DyadicOpCheck 590 eLSe' 692 else 591 begin 693 begin { operator is monadic J 592 SubPosition := position - 1: while (SubPosition > 0) and (APLstatemenHSubPosition] 694 NewTo kenPt r" .noun : = MonadOpe r; 593 695 NewTokenPtr" .Monlndex := Tablelndex; 594 ----character(space) do - SubPosition := SubPosition - 1 { get last non-blank }: 696 end; 595 697 position := position + 1; 596 if SubPosition <> 0 then -Tabl eLookUp (APLstateiiienHSubPo sit ion], 6, Spec Tab, TableIndex) 698 end 597 699 end {checkothertables }; 598 700 599 if

0) or (SubPosition = 0) ttlen MonadicReference:= true 701 600 702 procedure TryToGetANumbe r; 601 eTse FormRes) and (NewTokenPt r 703 602 -rr - ... NextToken" .noun <> FormArg) and (NewTokenPtr'" .NextToken .. 704 var 603 .noun <> GLobVar) and (NewTokenPtr" .NextToken" .noun <> 705 NumberCot..rlt: integer; 604 constant) and (APLmtement[SubPositionJ <> character[ 706 RealNumber: reaL; 605 periodJ) ari'd"(APLstatemenHSubPositionJ <> characterC 707 ItsANumber: Boolean; 606 RightPareill and (APLstatement[SubPositionJ <> character[ 708 607 Ri ghtBracketJ) 709 begin 608 ~erCot..rlt := 0; MakeNumber(RealNumber, ItsANumber); ~ MonadicReference := true 710 609 if not ItsANumber then CheckOtherTables end 711 610 end imonad icreference }; 712 else 611 713 --regin { store values in value table 612 714 ne;j(NewVal TabLi nk); 613 procedure DyadicOpCheck; 715 NewValTabLink"oNextValTabLink := OldValTabLink; 614 716 OldValTabLink := NewValTabLink; 615 var 717 NewVal TabLink" .ForwardOrder := true; 616 TabLelndex: integer; 718 if FunctionMode then NewVaLTabLinkR.lntermedResult := faLse 617 719 else NewVal TabLink"'"":TritermedResult := true; 618 begin 720 "S'WTtch := true; 619 TableLookUp(APLstatementCpositionJ, 16, DOpTab, TableIndex); 721 whi le ItsANumber do 620 begin - if TableIndex = a 722 621 new(NewVa lues); tilen 723 NumberCount := NumberCount + 1; 622 begin 724 if switch 623 TableLookUp(APLstatement[positionJ, 12, CharTab, TabLelndex); 725 tilen 624 if TableIndex = a 726 ~gin 625 then 727 ----sw:itch := false; 626 .i.:!.. APLstatement[positionJ = character[SouthCapJ 728 NewVal TabLink" .FirstValue := NewValues 627 then 729 end 628 else-NewValPtr" .NextVaLue := NewVaLues; begin 730 629 NewValues".RealVaL := RealNumber; NewVaLPtr:= NewValues; OLdTokenPtr := SaveTokenPtr; dispose(NewTokenptr); 731 630 Make'"-'mbe r( Rea l Number, It sANumber) NewTokenPtr := SaveTokenPtr; position:= LineLength + 1; 732 631 end; end { this was a comment - ignore remainder of line 733 632 NewValues" .NextValue := ~; else SError(4) { invalid character encountered } 734 633 if NumberCount > 1 else 735 634 be~in { special character encountered tilen 635 736 "t;igin ewTokenPtr" .noun := SpecOper; 737 636 Ne"WValTabLink".dimensions := 1 { number is a vector }: NewTokenPtr" .Charlndx := TabLelndex 738 637 new(NewDim); NewVaLTabLink".FirstDimen:= NewDim; end 739 638 NewDim" .dimenLength := NumberCount; end 740 639 else NewDim" .NextDimen := ni L 640 741 end - ~ MonadicReference 742 641 else tii"en SError(74) { monadic reference to dyadic operator} 743 642 "t;igin eLSe 744 643 Ne"WVal TabLink" .dimensions := 0 { number is a scalar }; begin { operator is dyadic } 745 644 NewVal TabLink'" .Fi rstDimen := ~ NewTokenPt r" .noun := DyadOper; 746 645 NewTokenPtr" oDOplndx := TableIndex end; 747 646 end NewTokenPtr" .noun := constant; 748 647 end { dyadicopcheck }; NewTokenPtr" .Val TabPtr := NewVal TabLink; 648 749 end 649 750 end (trytogetanumber ); 751 650 procedure Chee kOt herTabl es; 651 752 652 var ~~! flllction NamelnVarTable(name: PackedString; var VarPointer: 653 Tablelndex: integer; 755 --vai'TabPt rType; TestFuncPt r: Pt rFuncTab): Boolean; 654 Chklndex: integer; 756 655 656 757 :!!found: 800 Lean; 758 657 function NextNonBlank: integer; 658 759 begin .5'1 begin 760 found := false; VarPointer:= OldVarTabPtr; ",,0 761 whi le (VarPointer <> ni LJ and (not found) do 661 Chklndex := position + 1; 762 begin --- - while (ChkIndex LineLength) and (APLstatemenHChklndexJ 662 < 763 if (NamesMatch(name, VarPointer".VarName» and (VarPointer". 663 -cli"aracter[spaceJ) do 764 - FuncTabPt r = Test FuncPt r) { test for global var 664 ChkIndex := ChkIndex+ 1; 765 then found := true 665 NextNonBlank := APLstatemenHChklndexJ; 766 'iTii VarPointer := VarPointer".NextVarTabPtr 666 end { nextnonblank }; 767 encr;-- 667 768 NameInVarTable := found; 668 769 end { nameinvartable }; 669 begin { checkothertables } 770 670 --:rr-NextNonBlank = character[ForwardSlash] 773 procedure AddNameToVarTable(name: PackedString); 671 tilen 774 672 "tiegin 775 begin { new variable name encountered 673 ----ra6'leLookUp (APLs taternent[pos it; on], 16, RedTab, Tab Lelndex); 776 ne;j(NewVarTabPtr); NewVarTabPtr".NextVarTabptr:= OLdVarTabptr; 674 if TableIndex = a 777 OLdVarTabPtr := NewVarTabPtr; NewVarTabPtr".VarName:= name; 675 t'Fien SError(72) { invalid reduction operator 778 NewVarTabPtr".VaLTabPtr := ~;

14 Software Tools 779 if NewTokenPtr <> niL eeo if (position (; LineLength) and (not FuncHeadError) then 780 then - 881 beg in 781 --:rf (NewTokenPt rA .noun = FormRes) ~ (NewTokenPt rA .noun FormArg 882 ----sError (3) 782 - ) 883 { extraneous characters to right of function header l; 783 then NewVarTabPt rA. FuncTabPt r NewFuncTabPt r 884 FuncHead:::rror := true 784 eLSe NewVarTabPt rA. FuncTabPt r := ni L 885 end; 785 end {"';ddnametovartable }; 886 case-Ar i Ty Index of 786 887 -1-; 787 888 begin 788 function FunctionALreadyDefined(var NewFuncName: PackedString; var 889 ~FuncTabPtr".arity := niladic; 789 ~ndex: Pt rFuncTab): BooLean; 890 NewFuncTabPt rA. FuncName := name1; 790 891 end; 791 var 892 2;- 792 found: BooLean; 893 begin 793 894 ~FuncTabPtr".ar;ty := monadic; 794 begin 895 NewFuncTabPtr A.FuncName := name1; 795 ----:rOund:= faLse; FuncIndex:= OLdFuncTabPtr; 896 NewFuncTabPtr A.RightArg := name2; 796 whiLe (FuncIndex <>~) and (not found) and (NewFuncTabPtr <> 897 AddNameTova rTab l e (nameZ); 797 -----rilL) do 898 NewVarTabPtr A.FuncTabPtr := NewFuncTabPtr; A 798 iTNamesMatch(FuncIndex .FuncName, NewFuncName) 899 end; 799 th'"en found : = true 900 3;- 800 eTS"e Funclndex := FuncIndex".NextFuncTabPtr; 901 begin 801 FunctlonALreadyDefined := found 902 ~FuncTabPtrA.arity := dyadic; 802 end ( functionalreeadydefined ); 903 NewFuncTabPtr A.LeftArg := name1; 804 904 NewFuncTabPt rA. FuncName :; name2; 803 905 NewFuncTabPtr A.RightArg := name3; 805 procedure Ma keTokenL i rrk; 906 AddNarneToVa rTab Le (name1); 806 907 NewVarTabPt rA • FuncTabPt r := NewFuncTabPt r; 807 begin 908 AddNameToVa rTab Le (name3); A 808 new(NewTokenPt r); NewTokenPt r .NextToken := OLdTokenPt r; 909 NewVarTabPtr A.FuncTabPtr := NewFuncTabPtr; 809 SaveTokenPtr := OldTokenPtr; OldTokenPtr:= NewTokenPtr 910 end 810 end ( maketokenl ink l; 911 end ~case }; 811 912 lfFunc t ionAL ready De f; ned (Ne wFunc TabPt rA • Func Name I DummyPt r) 812 913 then 813 procedu re Proce ss Funt i onHeader; 914 begin 814 915 SError(S) function already defined l; 815 var 916 FuncHeadError := true; 816 DummyPt r: AFuncTab; 917 end; 817 name1, name2, name3: PackedString; 918 ifFuncHeadError then 818 ItsAnldentifier, FuncHeadError: Boolean; 919 -begin -- 819 AriTylndex: integer; 920 ----c.IT'Spose(NewFuncTabPtr) header no good l; 820 921 FunctionMode := false ( exit function Mode l; 821 beg in 922 NewFuncTabPtr :; OldFuncTabPtr; 822 ~cHeadError := false; FunctionMode := true; 923 end 823 FuncStatements := - 1; 924 end 824 if Fi rst Funct ion 925 end r-processfuncheader }; 825 then begin FuncStatements := 0; Fi rstFunction := false; end; 926 826 ~ylndex := 1; position:= position + 1; 927 827 identifier(name1, ItsAnldentifier); 928 procedure DestroyStatement; 828 if not ItsAnldentifier 929 829 then 930 var 830 beg in 931 -oumTokenPtr: "'TokenTable; 831 SError(7) I unrecognizable function'argument name ); 932 AuxSubrTabPt r: ASubrTab; 832 FunctionMode := false { exit function mode ); 933 833 FuncHeadError := true 934 begin 834 end 935 -----rTSubrTabPt r <> ni L 835 else 936 tIlen 836 beg i n 937 ~gin 837 ~(NewFuncTabPt r); Sk i pSpaces; 938 ~Le SubrTabPtrA.LastSubrPtr <> nil do if APLstatement[positionJ = character[LeftArrow] 838 939 ~in then 839 940 ~SubrTabPtr :; SubrTabPtr; beg i n 840 941 SubrTabPtr :; SubrTabPtr A.LastSubrPtr; ~FuncTabPtrA.resuLt := true { explicit result }; 841 942 di spo se (Aux Subr TabPt r); NewFuncTabPtrA.ResuLtName := name1; 842 943 end; 843 position := position + 1; 944 di spose (SubrTabPt r); identifier(name1, ItsAnldentifier); 844 945 end; ~ ItsAnldentifier ~ 845 .if. 946 DumTokenPtr := OldTokenPtr; begin 846 947 whi Le DumTokenPtr <> HoldTokenPtr do ~ror(6) 847 948 begin 848 { unrecognizable name to right of explicit res}; 949 OLdTokenPtr :; OLdTokenPtrA.NextToken; dispose(DumTokenPtr); FuncHeadError := true 849 950 DurnTokenPtr :; OldTokenPtr end 850 951 end; end 851 952 NewTokenPtr := HOLdTokfnPtr; eLS'e'"NewFuncTabPtrA.result :; faLse { no explicit result }; 852 953 OldTokenPt r ;= Ho LdTokenPt r Sk i pSpaces; 853 954 { return pointer to end of last good line if (position <= LineLength) and (not FuncHeadError) 955 end { destroystatement }; 854 then -- 956 855 --oegin 957 856 identifier nil do 864 encr:--- --o.gin -- 865 966 Sk i ps~aces; 967 ~d :; TemPtr" .NextValue; TemPtr".NextVaLue := ValPtr; 866 if (position <; LineLength) and (not FuncHeadError) 968 ValPtr :; TemPtr; TemPtr ;= ho Ld 867 then 969 end· 868 beg in 869 970 Argpt;" .Fi rstValue" .NextValue := ~; identifier(name3, ItsAnldentifier); ArgPtr".FirstValue :; VaLPtr; 870 971 if not ItsAnIdentifier if ArgPtr".ForwardOrder 871 972 then- tlen ArgPtr A.. ForwardOrder :; faLse 872 973 begin ArgPtr".ForwardOrder :; true { toggle list order switch 873 974 erse SError(9) invalid function right argument name }; encr--r- reverselinklist }; 874 FuncHeadError := true 975 976 875 end 977 876 el~AriTylndex := 3 978 procedure parser<~ TokenTabPtr: TokenPtr; var PtrToDa: TypeVal TabPtr); 877 en-a;- 979 878 SkipSpaces; 879 980

Software Tools 15 981 VFuncHold: "vfunc { hold while searching I; 1082 var 982 Au.OperTabPt r: "OperandTab; 1083 PtrToVarTab: "VarTab; 983 Au.SubrTabPt r: "SubrTab; 1084 984 Au.RParmPtr: "FParmTab; 1085 begin { callsubr I 985 Au.LParmPtr: "FParmTab; 1086 if SubrTabPtr" .CalledSubr" .arity <> niladic 986 Val idE.p: Boolean { true if valid expression I; 1087 tilen 987 cnt: ; nteger; 1088 begin 988 npv: integer { number of indices I; 1089 i.!. not NamelnVa rTableCSubrTabPt r" • Ca lledSubr" • Ri ghtArg, 989 assign, assign1: Boolean assign.in progress ); 1090 Pt rToVa rTab, SubrTabPt r" • Ca lledSubr) 990 DoneSuccessor: BooLean; 1091 then error(32); 991 DoneParse: Boolean; 1092 TT'Pt rToVa rTab". FuncTabPt r <> SubrTabPt r" .Ca lledSubr 992 1093 then error(32) { program logic error, variable name of }; 993 1094 function argument not found in symbol table } 994 procedure error SubrTabPt r" • Ca lledSubr 1005 1106 then error(33) { same as error(32) I; AuxLPa rmPt r : = LPa rmPt r; new(LPa rmPt r); 1006 1107 LParmPtrA.LastParm := AuxLParrnPtr; 1007 procedure release; 1108 PtrToVarTab" .0eferedVal TabPtr := LParmPtr; 1008 1109 LParmPtr".PtrVal := OperTabPtr".OperPtr; 1009 begin { releaseopertab 1110 AuxOperTabPtr := OperTabPtr; 1010 OperTabPtr := PtrLastOper; 1111 OperTabPtr := OperTabPtr" .LastOper; 1011 while OperTabPtr" .LastOper <> ~ ~ 1112 dispose(AuxOperTabPtr); PtrLastOper:= OperTabPtr; 1012 ~;n 1113 end; 1013 -ruxOperTabPt r := OperTabPt r; 1114 RParmPtr".PtrVal := OperTabPtr".OperPtr; 1014 OperTabPt r := OperTabPt r" .LastOper; dispose CAuxOperTabPt r); 1115 AuxOperTabPt r := OperTabPt r; 1015 end; 1116 OperTabPt r := OperTabPt r" • Last Oper; d i spo se CAuxOperTabPt r); 1016 end treleaseopertab }; 1117 PtrLastOper := OperTabPtr; 1017 1118 1018 end; 1119 TokenTabPt r := SubrTabPt r" • Ca lledSubr" • Fi rs t Stat ement" • Nex tStmnt; 1019 procedure express;on(var VaLidExp: Boolean); 1120 1020 forward; - VFuncPtr := SubrTabPtr".CalledSubr".FirstStatement; 1121 end { callsubr }; 1021 1122 1022 1123 1023 procedure ReturnToCa II ; ng Subr; 1124 function FunctCall: BooLean; 1024 1125 1025 var 1126 1026 Name?tr: "VarTab; var 1127 ---p't rToFuncTab: "FuncTab; 1027 1128 1028 begin { returntocallingsubr NameOfFunc: PaekedString; 1129 ValidFn: Boolean; 1029 if SubrTabPt r" .Ca lledSubr" .resul t 1130 1030 then 1131 beg in { functcall 1031 begin { place explicit result in opertab } 1132 ----vaTidFn := faLse; 1032 i.!. .'l2.!. NamelnVa rTableCSubrTabPt r" • Ca lledSubr" • Resu l tName, 1133 NamePt r, SubrTabPt r" • Ca lledSubr) if TokenTabPtr" .noun GlobVar 1033 1134 then errod11) { 'symbol not found' tilen 1034 erse 1135 begin 1035 1136 NameOfFunc := TokenTabPtr" .VarTabPtr'" .VarName; 1036 ~gin 1137 -ruxOperTabPt r := OperTabPt r; new(OperTabPt r); if Funct ionAL readyDef i ned(NameOf Func, Pt rTo FuneTab) 1037 1138 tilen 1038 OperTabPtr" .LastOper := AuxOperTabPtr; 1139 PtrLastOper := OperTabPtr; ~gin 1039 1140 OperTabPtr".OperPtr := NamePtr".ValTabPtr; -ruxSubrTabPtr := SubrTabPtr; new(SubrTabPtr); 1040 1141 SubrTabPt r" . Last SubrPt r := AuxSubrTabPt r; 1041 end" end;-' 1142 SubrTabPtr" .CalledSubr := PtrToFuncTab; 1042 1143 SubrTabPtr".TokenCallingSubr := TokenTabPtr; 1043 return to calling function 1144 SubrTabPtr".StatemCallingSubr := VFuncPtr; 1044 VFuncPt r := SubrTabPt r" • StatemCa II ingSubr; 1145 hold := TokenTabPtr; 1045 To kenTabPt r : = SubrTabPt r" • TokenCa II i ngSubr" • NextToken; if SubrTabPtr" .CalledSubr" .arity <> niladic 1146 TokenTabPtr := TokenTabPtr" .NextToken; VaL idFn := true; 1046 1147 then end; 1047 1148 beg i n { monad ic or dyad ic end;- 1048 1149 AuxRP&rmPtr := RParmPtr; RParmPtr:= RParmPtr".LastParm; FunctCall := ValidFn; 1049 1150 di spose (Aux RPa rmPt r); end { functcall I; 1050 if SubrTabPtr".CalledSubr".arity = dyadic then 1151 1051 -begin { dyadic only I -- 1152 1052 AuxLParmPtr := LParmPtr; 1153 procedure NunWrite(ReaLNo: reaL>; 1053 1154 LParmPtr := LParmPtr".LastParm; dispose(AuxLParmPtr); 1054 1155 end; var 1055 end;- 1156 prefix, root: integer; 1056 1157 AuxSubrTabPtr := SubrTabPtr; SigDig, CoLCnt: integer; 1057 SubrTabPtr := SubrTabPtr .... LastSubrPtr; 1158 1058 di sposeCAuxSubrTabPt r); end { returntocallingsubr }; 1159 begin { output a number 1059 1160 ---rr-RealNo >= 0.0 1060 1161 tlen write(' I, RealNo: 12: 2) { output positive number 1061 function SpecSymbol(sym: integer): Boolean; 1162 erse 1062 1163 --,;egin { output negative nlll1ber 1063 var 1164 ~lNo := - 1.0 • RealNo; 1064 ValidSym: BooLean; 1165 SigOig := trunc((lnCRealNo» I ClnC10.0»); 1065 1166 for ColCnt := 1 toC7 - SigOig) do writeC' '); 1066 beg i n { specsymbol 1167 Fcharacter[negativeJ < 6000 1067 ----vaL"idSym := false; 1168 then wri tee ehr (cha rae ter[negat; ve]» 1068 if TokenTabPt r" .noun = SpecOper 1169 erse 1069 then 1170 begin 1070 --rr TokenTabPt r" .Charlndx = sym then 1171 prefix := character[negat;ve] div 100; 1071 -begin 1172 root := character[negative] - ""(";00 * prefix); 1072 hold := TokenTabPtr; 1173 wri te(chr (pref ix), e hr (root»; 1073 TokenTabPtr := TokenTabPtr".NextToken; ValidSym:= true; 1174 end; 1074 end; 1175 SigOig := SigOig + 5; writeCRealNo: SigOig: 2); 1075 Spec"SYmbol := Va l idSym; 1176 end 1076 end { spec symbol I; 1177 end r-numwri te }; 1077 1178 1078 1179 1079 procedure CaLlSubr; 1180 procedure OUtPutVa l; 1080 1181 1081

16 Software Tools 1182 var 1283 ~ ccntr := 1 ~ MessageLength £'.£. write(ErrorMsgs[63, ccntr]); 1183 ----Cnt: integer; 1284 writeLn; readLn: GetAPLstatement: 1184 AuxValuesPtr: "values; 1285 repeat 1185 DimHold, dimen1, dimen2, dimen3: integer; 1286 Mai<'eNumber LineLength; 1204 then 1305 d;spose(Aux2VaLuesPtr); AuxValuesPtr".NextValue·= nil· 1205 ~gin 1306 PtrToDa" .IntermedResuLt := faLse; PtrToDa" .dimen~ions-~= 1; 1206 ~ CalCnt := 1 to MessageLength da 1307 Pt rToDa" .ForwardOrder := true; 1207 write(ErrorMsgs[61, Calent]); 1308 PtrToDa"'.NextVaLTabLink := nil; new(AuxDimenFoPtr)i 1208 writeln; 1309 PtrToDa"'.FirstDimen := AuxDimenFoPtr; 1209 end 1310 AuxDimenFoPtr" .dimenLength := cnt; 1210 else 1311 AuxDimenFoPtr" .NextDimen := nil; 1211 if idimens ::::; 0 1312 end ( inputval }; - 1212 then begin NunWrite(AuxVaLuesPtr" .RealVaL); writeln; end 1313 1213 eLse 1314 1214 begin 1315 procedure GetArrayPosition(.!'.!.!: VaLuesPtr: TypeValuesPtr); 1215 dimen1 : = OperTabPt r". OperPt r". Fi rstDi men'"' .d imenLength; 1316 1216 if idimens >= 2 1317 var 1217 then 1318 lndice: real; 1218 ----cITmen2 := OperTabPtr~ .OperPtr" .Fi rstDimen'" .NextDimen 1319 kcnt: ; nteger; 1219 "'.dimenlength 1320 sl: integer; 1220 else dimen2 .= 1· 1321 AuxDimenFoPtr: "'Dimenlnfo; 1221 iTld ;m.ens ='3 ' 1322 1222 then 1323 begin { getarrayposition 1223 ~men3 : = OperTabPt r"'. OperPt r" • Fi rstOi men'" .NextDi men 1324 ---:;-fnpv <> ParmPtr".dimensions then error(3S); 1224 '" .NextDimen~ .dimenlength 1325 t 'wrong man. of subscr~pts' }-- 1225 else dimen3 := 1: 1326 sl := 0; AuxOperTabPtr:= OperTabPtr; 1226 Tfidimens = 3 then 1327 AuxDimenFoPtr := ParmPtr" .FirstDimen; 1227 -begin ( rotate dimensions 1328 for kcnt := 1 to npv do 1228 DimHold := dimen1; dimen1:= dimen2; 1329 begin -- 1229 dimen2 := dimen3: dimen3:= DimHold: 1330 -i-f-AuxOperTabPtr'" .OperPtr'" .dimensions <> a 1230 end; 1331 t"hen error(3S) ( 'non-scaler indices' ); 1231 foroutCnt3 := 1 to dimen3 do 1332 1nd1ce : = AuxOperTabPt r" • Ope r Pt r" • Fi rs t Va Lue" • Real Va L: 1232 begin - - 1333 if indice - 1.0 * trunc(indice) <> 0.0 1233 for OUtCnt2 := 1 to dimen1 do 1334 then error(37) { 'non-integer indices' }; 1234 begin - 1335 i"'f"""not (trunc(indice) in [1 •• AuxDimenFoPtr".dimenLength -J)" - 1235 ~ Outent1:= to dimen2 do 1336 1236 begin 1337 then error(38) { 'out of range index' J; 1237 cnt := cnt + 1; 1338 S"l!= (sL * AuxOimenFoPtr'" .dimenLength) + trunc(indice) - 1238 if «(cnt - 1) mod 5) = 0) and (cnt <> 1) 1339 1 ; 1239 then begin writeIfi"; write~ I); end; 1340 AuxOperTabPt r := AuxOperTabPt r" .LastOper; 1240 NunWr i te( AuxVa l uesPt r" • Rea LVa l): 1341 dispose(OperTabPtr); OperTabPtr:;;;:; AuxOperTabPtr; 1241 AuxValuesPtr := AuxVaLuesPtr"'.NextValue; 1342 AuxDimenFoPtr := AuxDimenFoPtr".NextDimen; 1242 end: 1343 end; 1243 ; fidimens >= 2 1344 VaTUe"sPtr := ParmPtr'" .FirstVaLue; 1244 then begin writeLn; cnt := O' end; 1345 while sl <> 0 do ( determine which value in 1245 en~-- 1346 --{- ptE sval(sv) ][ sval (sv-1 ) J ••• [sval( sv-npv+ 1) J 1246 wrheLn; writeLn; 1347 { := sval(sv-npv) } 1247 end; 1348 begin ValuesPtr := VaLuesPtr".NextValue; sL:= sL - 1; end; 1248 writeln; } 1349 end {getarraypo si tion }; 1249 end; 1350 1250 end outputval }; 1351 1251 1352 procedure LinkResuLts; 1252 1353 1253 function variabLe: BooLean: 1354 var 1254 1355 PtrTovaLues: "'vaLues; 1255 var 1356 1256 gLobOrDummy: Boo Lean ( gord ); 1357 begin { linkresults 1257 PassedAdj: "VarTab I k ); 1358 if npv 0 1258 rarg: BooLean { rd }; 1359 then 1259 ParmPtr: "ValTab I pt ); 1360 --segin 1260 VaLidVar: BooLean; 1361 ifnot gLobOrDummy 1261 Va Lid Index: 800 Lean; 1362 then 1262 1363 -rr rarg then RParmPtr".PtrVaL := OperTabPtr" .OperPtr 1263 1364 else LParm~.PtrVaL := OperTabPtr".OperPtr 1264 procedure InputVa L: 1365 el"S"e"'PassedAdj'" .Val TabPtr := OperTabPtr'" .OperPtr en-d- 1265 1366 1266 var 1367 eLse 1267 AuxPt rToDa: "Va LTab; 1368 --""beg in 1268 AuxValuesPtr: "vaLues; 1369 -rr-globOrDummy then ParmPtr := PassedAdj" .VaLTabPtr else ParmPtr := PassedAdj'" .DeferedVaLTabPtr'" .PtrVaL; 1269 Aux2VaLuesPtr: ~values; 1370 GetAr rayPos it ion (Pt rToVa lues); 1270 ReaLV: reaL; 1371 1271 booLv: BooLean; 1372 if OperTabPtr" .OperPtr" .dimensions <> 0 then errod36) { 'assigned expression not a scalar' }. 1272 ccntr, cnt: integer; 1373 1273 AuxOimenFoPtr: "DimenInfo; 1374 PtrToVaLues".RealVaL := OperTabPtr"'.OperPtr".FirstVaLue .. 1274 1375 .RealVaL; end; 1275 begin ( inputval 1376 AuxOperTabPt r := OperTabPt r; 1276 cnt := 0; position:= 1; AuxPtrToDa:= PtrToDa; 1377 1277 new(Pt rToDa); AuxPt rToDa" .NextVa l TabLi nk := Pt rToDa; 1378 OperTabPtr := OperTabPt r'" .LastOper; di spo se (Aux Oper TabPt r): 1278 AuxOperTabPtr := OperTabPtr; new(OperTabPtr); 1379 PtrLastOper := OperTabPtr: end { linkresults }; 1279 PtrLastOper := OperTabPtr: 1380 1280 OperTabPtr".LastOper := AuxOperTabPtr; 1381 1281 OperTabPt r'" • OperPt r := Pt rToDa; new(Aux2Va LuesPt r); 1382 procedure StackPointers; 1282 PtrToDa'" .FirstVaLue := Aux2VaLuesPtr; 1383

Software Tools 17 1384 1385 var 1486 begin { index 1386 AuxPt rToOa: "VaL Tab; 1487 ValidI := false; expression(ValidE1); 1387 PtrToVaLues, AuxValuesPtr: "values; 1488 if VaLidE1 1388 1489 then 1389 begin { stackpointers 1490 begin 1390 , 1491 npv := 1 { no. of index expressions }; 1391 if npv 0 1492 while SpecSymboL(XSemicoLon) do 1392 ITen 1493 begin - 1393 "l>e"gin 1494 npv := npv + 1; expression(Val idEZ); 1394 ~OperTabPt r := OperTabPt r; new(OperTabPt r); 1495 if not VaLidE2 then error(39); 1395 OperTabPt r" oLastOper := AuxOperTabPt r; 1496 ----r-inval id index expression ' } 1396 OperTabPtr"oOperPtr := ParmPtr; 1497 end' 1397 Pt rLastOper := OperTabPt r 1498 Valid! := true; 1398 end 1499 end; 1399 else­ 1500 end {index }; 1400 "l>e"gin 1501 1401 ~PtrToDa := PtrToDa; new(PtrToDa): 1502 1402 PtrToDa" oNextVaLTabLink := AuxPtrToDa; 1503 begin { variable 1403 PtrToDa- .IntermedResult := true: 1504 ValidVar := false; npv:= 0; 1404 PtrToOa".dimensions := 0; PtrToDa".FirstO;men:=~; 1505 if not assign 1405 PtrToDa".ForwardOrder := true: newCAuxValuesPtr); 1506 tilen 1406 PtrToDa".FirstValue := AuxValuesPtr: 1507 --rr SpecSymbo L(XQuadSym) 1407 GetArrayPosi t ion CPt rloVa lues); 1508 then begin InputVal; ValidVar:= true end 1408 PtrToDa"oFirstVaLue"oReaLVaL := PtrToVaLues"oReaLVaL; 1509 else 1409 PtrToDa".FirstValue".NextValue := nil: 1510 ~gin 1410 AuxOperTabPtr := OperTabPt r; new(OperTabPt r); 1511 ----rf"SpecSy~bo L(XRi ghtBrac ket) 1411 OperTabPt r" • LastOper := AuxOperTabPt r; 1512 t'fien 1412 OperTabPt r" oOperPt r := Pt rToOa; 1513 begin 1413 Pt rLastOper := OperTabPt r; 1514 index (Va l idIndex); 1414 ~ 1515 if (not VaL idlndex) or (not SpecSymboL(XLeftBracket)) 1415 end { stackpointers }; 1516 tFi"en-error(34) { innlidlndex expression }i 1416 1517 end; 1417 1518 i f---simp leVa ri ab le 1418 function SimpleVariable: Boolean: 1519 then begin StackPointers; ValidVar:= true end 1419 1520 end else- 1420 var 1521 1421 VaLidSv: BooLean; 1522 --rr SpecSymboL(XQuadSym) then begin OutPutVal; ValidVar:= true end 1422 1523 e1Se-- 1423 begin ( simplevariable 1524 1424 ValidSv := false; rarg:= false: gLobOrDummy := faLse; 1525 ~gin ----rf"SpecSymbo L(XRi ghtBrac ket) 1425 if assign 1526 tilen 1426 1527 tilen 1427 ~gin 1528 begin ----rf"(TokenTabPt r" onoun FormRes) or (TokenTabPtr" .noun 1428 1529 index (Va l id Index); - GLobVar) if (not VaL idlndex) or (not SpecSymboL(XLeftBracket)) 1429 1530 then thenerror(34) { in;alidindex expression }; 1430 1531 1431 begin 1532 encr:-- 1432 gLobOrDummy := true: 1533 i fST~pleva riab le 1433 PassedAdj := TokenTabPt r'"' • VarTabPt r; 1534 then begin LinkResults; ValidVar:= true; end; 1434 hoLd := TokenTabPtr; 1535 end; 1435 TokenTabPt r := TokenTabPt r'"' .NextToken; 1536 variable := VaLidVar; 1436 Va LidSv := true 1537 end { variable }; 1437 end 1538 1438 eL~ 1539 1439 --:rr TokenTabPt r" .noun = FormArg 1540 procedure primaryC~ valid: Boolean) { recursive entry}; 1440 then 1542 var 1441 begin 1543 ValidX: Boolean; assign: Boolean; 1442 ii. NamesMa tc h e"gin 1455 if ParmPtr <> nil then 1557 ----;;;UXOperTabPt r := OperTabPt r; newCOperTabPt r>; PtrLastOper := OperTabPtr; 1456 -begin 1558 OperTabPt r" • Las tOper := AuxOperTabPt r; 1457 hoLd := TokenTabPtr; 1559 OperTabPtr" oOperPtr := TokenTabPtr" oVaLTabPtr; 1458 TokenTabPtr := TokenTabPtr" .NextToken; 1560 1459 ValidSv := true 1561 hoLd := TokenTabPtr; 1460 end 1562 TokenTabPtr := TokenTabPtr" .NextToken; vec:= true; 1461 end 1563 end; el~ 1564 vector := vee; 1462 end { vector }; 1463 begi~ 1565 1464 if TokenTabPt r" .noun = FormArg 1566 tilen 1567 1465 beg in { primary 1466 begin 1568 if NamesMatch(TokenTabPtr"oVarTabPtr"oFuncTabPtr " 1569 ----vaT"id := true; 1467 if not vector 1468 - 0 LeftArg, TokenTabPt r" 0 Va rTabPt r" 0 Va rName) 1570 then Pa rmPt r : = LPa rmPt r" • Pt rVa l 1571 tilen 1469 "l>e"g in 1470 erse ParmPtr := RParmPtr".PtrVal; 1572 iiOTd := TokenTabPtr; 1573 ---assign := false; 1471 if not variable 1472 TokenTabPtr := TokenTabptr" .NextToken; 1574 ValidSv := true; 1575 ITen 1473 --;-r SpecSymbol(XRightPar) 1474 end; 1576 end;­ 1577 tilen 1475 begin end;- 1578 1476 express;onCVal idX); SimpleVariabLe := ValidSv; 1579 1477 if not VaLidX 1478 end { simple variable }; 1580 then-error(14) { 'non-valid exp within parens I 1479 1581 1582 erse 1480 not SpecSymboL(XLeftPar) procedure index(var ValidI: BooLean); 1583 --rr 1481 tilen 1482 1584 var -';:-ror(15) 1483 1585 validE1, ValidE2: Boolean; 1586 { I right paren not bal anced wi th 1 eft paren I 1484 else val id := true 1485 1587

18 Software Tools 1588 end 1689 end ( dop ); 1589 else- 1690 159C ---n- not FunctCall then valid := false 1691 15~1 else begin CallSubr-;-primary(val id); end; 1692 funct ion It sBooleanC test: reaL): BooLean; 1592 end; 1693 1593 end tpr imary }; 1694 begin 1594 1695 if (test = 1.0) or (test 0.0) then ItsBoolean := true 1595 1696 eTse ItsBoolean ~ false 1596 procedure expression recursive }; 1697 end! i tsboolean } ; 1597 1698 1598 var 1699 1599 DoneExp, ValidPri, ValidFunc, ValidAssn: BooLean: 1700 procedure DyadComp(var SFLoat: reaL; value: reaL; code: integer); 1600 code: integer: 1701 compute resul t onyadic operation } 1601 1702 1602 1703 begin 1603 procedure assignment (~ vaL ida: Boolean); 1704 case code of 1604 1705 --{ left codes - reduction ops I right codes - dyad ic ops } 1605 beg in { assignment 1706 2, 52: SFloat := value + SHoat { addi tion }; 1606 valida := false: 1707 3, 53: SFloat := value - SHoat { subtraction}; 1607 if SpecSymbol(XLeftArrow) 1708 4, 54: SFloat := value * SFloat { multiplication}; 1608 then 1709 5, 55: 1609 begin 1710 if SFloat = 0.0 1610 assign := true: assign1:= true: 1711 then error(20) { attempted division by zero 1611 if variabLe then vaLida := true 1712 erse SFLoat := value I SFLoat { division}; 1612 eTse error(S) r-r:-esul t of an assn not a valid variable I; 1713 6,56:' 1613 valida := true; assign:= false; 1714 ; f value> 0.0 1614 end: 1715 then 1615 end tassignment }. 1716 ---sFloat := exp(SFloat • In(value)) 1616 1717 { nL.lTlber raised to a power} 1617 1718 else SFloat := 1.0./ (exp(SFloat • In(abs(value)))); 1618 ~ mop: Boolean: 1719 21~: 1619 1720 if value = SFloat ( equality) then SFloat := 1.0 1620 var else SFloat := 0.0; Val idM: Boolean; 1721 1621 1722 22-;72: 1622 if value <> SFLoat { inequality then SFloat := 1.0 begi ( mop ) 1723 1623 e 1724 else SFloat := 0.0; 1624 Va idM := false; 1725 23~: 1625 if (TokenTabptr" "noun MonadOper) or (TokenTabPt r" .noun if value < SFloat ( less than) then SFloat := 1.0 - ReductOper) 1726 1626 else SFloat := 0.0; 1627 then 1727 1728 24-;74: 1628 be~~n if value <= SFLoat { less than or equal to } 1629 , TokenTabPtr" .noun = MonadOper 1729 tnen code := MOpTab[To kenTabPt r" .Monlndex]. Op Index 1730 then SFloat := 1.0 1630 SFloat := 0.0; code := RedTab[TokenTabPt r" • Red Indx]. Op Index; 1731 erse 1631 erse 25;75': hold := TokenTabPtr; 1732 1632 if vaLue >= SFloat { greater than or equal to } 1633 TokenTabPtr := TokenTabPtr".NextToken; ValidM:= true: 1733 1734 ITen SFloat := 1.0 1634 SFloat ~ . 1735 erse := 0.0; 1635 mop := Va l,dM; 26;-7'6: 1736 1636, ~ ( mop ); if vaLue> SFLoat { greater than} then SFloat := 1.0 1737 1637 1738 else SFloat := 0.0; 27;77: 1638 1739 ~ dop: Boolean: if (ItsBoolean(value)) and 80l then ValidO := true 1752 29-:- 1753 1653 else if value> SHoat { maximum or ceiling 1754 1654 -n TokenTabPt r" .noun = SpecOper then SHoat := value; 1655 then 1755 30-:- 1756 1656 ---n- Sp.ecSymbol(XPeriod) if value < SHoat { minimum or floor} 1757 1657 then then SHoat := value; 1658 begin 1758 31-:- 1659 if TokenTabPt r" .noun ;: DyadOper 1759 if (value. SFloat) < 0.0 1660 then 1760 1761 then error(SO) { number and base of different sign 1661 begin if OOpTab[TokenTabPt r" • OOp Indx]. Op Index <= 80 1762 erse 1662 1763 --snoat := (In(abs(SFloatJ)) I (In(abs(value))) then 1663 1764 ( log to a base ) begin 1664 1765 end ( case ) code := code + (100 • OOpTab[TokenTabptr-. 1665 1766 enn dyad camp }; OOplndxJ. Oplndex); 1666 1767 hold := TokenTabPtr; 1667 1768 TokenTabPtr := TokenTabPtr" .NextToken; 1668 1769 procedure IndexGenerator(arg: TypeVa l TabPt r); ValidD := true 1669 { monadic iota operator } end 1770 1670 1771 1671 el~error(27) 'invalid inner product exp en-d- 1772 var 1672 1773 iotalndex, TopValue: integer; 1673 else TokenTabPt r" .noun = SpecOper 1774 1674 ---:rt begin then 1775 1675 ----:rtarg" .dimensions <> a begin 1776 1676 tnen error(21) { argument not a scalar if SpecSymbo l (XL itt leCi rc le) 1777 1677 1778 erse 1678 then ---:rr arg" .Fi rstValue" .RealVal < 0.0 begin code := 10 * code; VaLidD:= true 1779 1679 then error(22) { argument is negative end 1780 1680 1781 eLSe 1681 e Lse-error(26) { 'inval outer prod exp' en-d- 1782 ---n- (arg" .Fi rstValue" .RealVall - (1.0 • trundarg". 1682 - FirstValue".RealVal)) <> 0.0 eLse error(26) same as above 1783 1683 1784 then error(23) { argument is not an integer} 1684 end 1785 erse 1685 elS;-ValidD := true 1786 ~gin 1686 elSeValidD := true; 1787 --ne;(NewVa l TabL ink); 1687 end; 1788 OldVal TabLink- .NextVal TabLink := NewVal TabLink; 1688 dop:= ValidO;

Software Tools 19 1789 NewVaLTablink".NElxtVaLTablink := nil; 1891 procedure reduction(arg: TypeVal TabPtr); 1790 NewVal TabLink" .ForwardOrder := true; 1892 1791 NewVaLTabLink" .IntermedResult := true; 1893 var 1792 NewVaLTablink".dimensions := 1 { result is a vector}; 1894 counter, RowLength: integer; 1793 new(NewDim); NewVaLTabLink".FirstDimen:= NewDim; 1895 SFLoat: real; 1794 TopVaLue := trunc(arg".FirstValue".ReaLVaL) 1896 1795 { last index generd }; 1897 begin 1796 NewDim'" .dimenLength := TopValue; 1898 -i-f-(arg" .dimensions = 0) ~ (arg'" .Fi rstValue == ~) 1797 NewDim".NextDimen := nil; iotalndex:= 1" 1899 then 1798 switch := true; - 1900 ---error (24) { argument is a scalar or vector of length zero} 1799 while iotalndex <= TopValue do 1901 eLse 1800 begin 1902 -rr (arg~.dimensions = 1) and (arg".FirstDimen".dimenLength 1801 new(NewValues); NewVaLues".RealVal:= ;otalndex; 1903 -=1) - 1802 if switch 1904 then error(S1) { argument is a vector of length one} 1803 then 1905 et:'S"e 1804 ~g;n 1906 begin 1805 --switch := false; 1907 new(NewVa LTabLi nkJ; 1806 NewVaLTabLink".FirstVaLue := NewVaLues 1908 OldValTabLink".NextValTabLink := NewValTabLink; 1807 end 1909 NewValTabLink".NextVaLTabLink := niL; 1808 else-NewValPtr" .NextValue := Ne\o/Valuesi 1910 NewVal TabLink" .IntermedResuLt := true; 1809 NewValPtr := NewValues; 1911 if arg".ForwardOrder then ReverseLinkList(arg); 1810 iotalndex := iotalndex + 1 1912 NewVal TabLink" .ForwardOrder := false; 1811 end" 1913 NewVa LTabL ink" .d imens ions := arg"'.d ;mens ions - 1; 1812 i(·switch 1914 OimPtr := arg~.FirstDimen; switch:= true; 1813 then 1915 while DimPtr".NextD;men <> nil do 1814 ""N"'ewValTabLink".FirstVaLue := nil 1916 begin { build dimensions ~result } 1815 { result is vector of leng~O 1917 new(NewOi m); 1816 eLse NewVaLues~.NextVaLue := niL 1918 if switch 1817 en-d- 1919 then 1818 end index generator } ; 1920 beg in 1819 1921 ----swi"tch := faLse; 1820 1922 NewVaLTabLink" .Fi rstDimen := NewDim 1821 rrocedure raveL(arg: TypeValTabPtr); 1923 end 1822 monadic comma operator } 1924 e Lse-NewPt r'" • Nex tDi men := NewDi m; 1823 1925 N"eWDim" .dimenlength := DimPtr".dimenlength; 1824 var 1926 NewPtr := NewDim; OimPtr:= OimPtr"'.NextDimen 1825 elements: integer; 1927 end; 1826 1928 if--S;i tch 1827 begin 1929 then 1828 new(NewVaLTablink); 1930 ----r:iewVaLTabLink".FirstDimen := nil 1829 OLdVaLTablink".NElxtVaLTablink := NewVaLTablink; 1931 I arg is vector,result is scalar 1830 NewVaLTablink" .NElxtVaLTablink :=!!2.l; 1932 else NewDim~ .NextOimen := ni L; 1831 NewVaLTabLink".IntermedResuLt := true; 1933 RowLength := DimPtr" .dimenTe'ngth; 1832 NewVaL TabLink" .ForwardOrder := arg~ .ForwardOrder; 1934 VaLPtr := arg"'.FirstValue; switch:= true; 1833 NewVaLTabLink".dimensions := 1 { result is a vector}· 1935 while ValPtr <> nil do 1834 new(NewDim); NewVaLTabLink" .FirstDimen := NewDim; 1936 ~in { performredUction } 1835 NewDim" .NextDimen := niL; switch:== true; 1937 --sTloat := VaLPtr".ReaLVaL 1836 VaLPtr := arg".FirstVaLUe; elements:= 0; 1938 { sfloat gets last value in row}; 1837 while VaLPtr <> nil do 1939 ValPtr := VaLPtr~ .NextValue; 1838 begin { duplicate values into result} 1940 for counter := 2 to RowLength do "begin - - 1839 --;;ew(NewValues); NewVaLues".ReaLVaL:= ValPtr"'.RealVal; 1941 1840 eLements := elements + 1; 1942 DyadComp(SFLoat, ValPtr'" .ReaLVal, code); 1841 if switch 1943 VaLPtr := VaLPtr".NextValue 1842 then 1944 end; 1843 ~gin 1945 neW 20 1864 1966 NewVaLTabLink".dimensions := 1 { result is a vector }; then 1865 1967 new(NewDim); NewDim" .dimenLength := arg'" .dimensions; ---case code of 1866 1968 NewVal TabLink'" .FirstDimen := NewDim; Inde-;Generator(arg); 1867 1969 --zT: NewDim".NextDimen := nil; switch:= true; 22: ShapeOf(arg); 1868 1970 DimPtr := arg".FirstDimen; 23: raveL (arg) 1869 1971 while DimPtr <> end { case } 1870 !!2.l it? 1972 eLse- 1871 begin { argument dimensions become resul t values 1973 "begin 1872 new(NewVa Lues); 1974 --;;e;;(NewVa l TabL ink); 1873 NewValues".ReaLVal := DimPtr".dimenlength; 1975 OLdVaLTablink".NextVaLTablink := NewVaLTablink; 1976 1874 if switch NewValTabLink".NextValTabLink := nil; 1977 1875 then NewValTabLink".IntermedResult := trUe; 1978 1876 ~gin NewVa l TabL; nk" • ForwardOrder := arg" .ForwardOrder; 1877 ----swi"tch := false; 1979 NewValTabLink"'.dimensions := arg".dimensions; 1878 NewValTabLink"'.FirstValue := NewValues 1980 switch := true; DimPtr:= arg".FirstDimen; 1981 1879 end while DimPtr <> nil do 1982 1880 else-NewValPtr".NextVaLue := NewValues; begin [ dupl icate dimensions of arg into resul t 1983 1881 NewVaLPtr := NewValues; DimPtr:= DimPt·r'" .NextDimen --;;e;;(NewDim) ; 1984 1882 end; NtwD;m".dimenLength := DimPtr".dimenLength; 1883 ifswitch 1985 1986 if switch 1884 then then 1987 1885 --riewValTabLink~.FirstValue := nil begin 1988 1886 { result is a vector of length 0 ) switch := false; 1989 1887 else NewValues".NextValue := nil NeW'VaLTabLink".FirstDimen := NewDim 1990 1888 end{ shapeof j; end 1991

20 Software Tools 1992 else NewPtr" .NextDimen := NewDim; 2093 begin 1993 NewPtr := NewDim: DimPtr:= DimPtr" .NextOimen 2094 switch := false; 1994 end' 2095 NewVa l TabLi nk'". Fi rstVa lue := NewVa lues 1995 ifswi tch 2096 end 1996 tiien 2097 elSeNewValPtr".Ne)(tValue := NewValues; 1997 ~wVaLTabLink".FirstDimen := nil { result l5 a scalar} 2098 NewValues".RealVal := LeftValPtr".RealVal; 1998 else NewDim".NextOimen := nil; 2099 NewVa lPt r := NewVa lues; 1999 switch := true; ValPtr := arg".FirstVaLue; 2100 LeftVa lPt r := LeftVa lPt r" • NextVa lue 2000 while ValPtr <> nil do 2101 end; 2001 ~in -- 2102 RigiitvalPtr := RightArg".FirstValue; 2002 ----;;-ewCNewVa lues); 2103 while RightValPtr <> nil do 2003 if switch = true 2104 begin { transfer right ;rg values (if any) 2004 tiien 2105 new(NewVa Lues); 2005 begin 2106 if swi tc h 2006 sW1tch := faLse; 2107 then 2007 NewVal TabLink" .FirstValue := NewValues 2108 --segin 2008 end 2109 ---swTtch := false; 2009 el-s-e-NewValPtr".NextValue := NewValues: 2110 NewVal TabLink" .Fi rstValue := NewValues 2010 NewValPtr := NewValues; 2111 end 2011 case code of 2112 elSeNewVaLPtr".Ne)(tValue := NewValues; 2012 --;-: - 2113 NewValues".RealVal := RightValptr".RealVal; 2013 if ItsBoolean(ValPtr" "RealVal) 2114 NewValPtr := NewVaLues; 2014 - { logical negation } 2115 RightValPtr := RightValPtr".NextValue 2015 then 2116 end; 2016 ~wValues""RealVal := 1"0 - ValPtr""RealVal 2117 NewValues .... Ne)(tValue := nil 2017 ~ error(19) { value not boolean }; 2118 end { transfer of values }­ 2018 2: 2119 end 2019 NewValues""RealVal := ValPtr" "RealVal 2120 end {catenate }; 2020 no-op }; 2121 2021 3: 2122 2022 NewValues""RealVal := 0"0 - ValPtr""RealVal 2123 procedure IndexOf(LeftArg, RightArg: TypeValTabPtr); 2023 { negation }; 2124 dyad ic iota operator } 2024 4: 2125 2025 if ValPtr""RealVal > 0.0 { signum 2126 var 2026 tii"en NewValues" .RealVaL := 1.0 2127 ~aplnde)(, icount, TestLength, OneMore: integer; 2027 erse 2128 2028 --:rr ValPtr" .RealVal < 0.0 2129 begin { index of } 2029 then NewValues".RealVal := - 1.0; 2130 if LeftArg" .dimensions <> 1 2030 5: 2131 ITen error(29} { left argument is not a vector 2031 if ValPtr" .RealVal = 0.0 { reciprocal 2132 erse 2032 then error(54) { attempted inverse of zero 2133 begin 2033 else 2134 new(NewVa l TabL ink); 2034 ~wValues".ReaLVal := 1.0 / ValPtr" .RealVal: 2135 OldValTabLink".NextValTabLink := NewValTabLink; 2035 6: NewValues" .RealVal := exp(ValPtr" .RealVal) 2136 NewValTabLink".NextValTabLink := nil; 2036 end { case }; 2137 NewVaLTabLink'".IntermedResult := "t"rUe; 2037 ValPtr := ValPtr".NextValue 2138 if not LeftArg". ForwardOrder 2038 end; 2139 "'t"'heri""ReverseL i nkL i st (Left Arg); 2039 it"switch then NewValTabLink" .FirstValue := nil 2140 NewVa l TabL ink" • Forwa rdOrder := Ri ghtArg" • Fo rwa rdOrder; 2040 el"se NewVaLues=-:-Ne)(tVaLue := niL 2141 NewVa l TabLi nk" .d imens ; ons := Ri ghtArg" .d imens ions; 2041 enr- 2142 if RightArg" .dimensions = 0 2042 end {monadic }; 2143 ITen 2043 2144 ~wValTabLink".FirstDimen := nil 2044 2145 { right argument is a sca!"a;:-} procedure catenate(LeftArg, Ri ghtArg: TypeVa l TabPt r); 2045 2146 else 2046 { dyadic comma operator - joins 2 arguments } 2147 ~gin { build dimensions of resul t 2047 ----swTtch := true; DimPtr:= RightArg".FirstDimen; var 2148 2048 2149 whi le Di mPt r <> nil do ResuLtLength: integer; begin -- 2049 2150 2050 new(NewDi m); begin { catenate} 2151 2051 2152 if switch 1T(RightArg".dimensions> 1) or (LeftArg".dimensions > 1) 2052 2153 then "tilen error(53) { argument(s} with rank greater than 1 2053 2154 begin 2054 eLSe 2155 switch := false; 2055 "tJegin 2156 NewVaLTabLink".FirstDimen := NewDim 2056 ----;;-ew(NewVa LTabL ink); 2157 end OldValTabLink".NextValTabLink := NewValTabLink; 2057 2158 eL~NewPtr" .Ne)(tDimen := NewDim; 2058 NewVal TabLink" .NextVal TabLink := nil; NewDi m" .d imen length := Di mPt r" .d imen length; NewVal TabLink" .IntermedResult := trUe; 2159 2059 2160 NewPtr := NewDim; DimPtr:= DimPtr" .Ne)(tDimen 2060 if not LeftArg" .ForwardOrder end- thenR"everseL i nkL i st (LeftArg); 2161 2061 2162 NewDi;" .Ne)(tDimen := ~ iT"not RightArg" .ForwardOrder end; 2062 2163 tiienR"everseL i nkL i st (Ri ghtArg); swT"t'Ch := true; RightValPtr:= RightArg".FirstValue; 2063 2164 NewVal TabLink" .ForwardOrder := true; while RightValPtr ~ ~ 2064 2165 <> NewVal TabLink" .dimensions := 1 { result is a vector }; begin 2065 2166 new(NewDim); NewValTabLink".FirstDimen:= NewDimi new(NewVa lues); 2066 2167 NewDim" .Ne)(tDimen := nil; ResultLength:= 0; if switch 2067 2168 if LeftArg" .dimensions = 0 tiien 2068 2169 tiien begin 2069 2170 2070 --"ResultLength := ResultLength + 1 { left arg is a scalar switch := false; else 2171 2071 NewValTabLink".FirstValue := NewValues --"ResultLength := ResultLength + LeftArg".FirstDimen". 2172 2072 end dimenlength; 2173 2073 else-NewValPtr" .Ne)(tValue := NewValues; if RightArg" .dimensions = 0 2174 2074 icount := 1; LeftValPtr:= LeftArg".FirstValue; then 2175 TestLeng th : = LeftArg". Fi rstDi men'" .d imenlength 2075 2176 2076 --"ResultLength := ResultLength + 1 { right arg is a scalar { length of left arg }; else 2177 2077 OneMore := TestLength + 1 --"Resul tLength := Resul tLength + R;ghtArg". Fi rstDimen". 2178 2078 { length of left arg plus one}; dimenlength; 2179 2079 Maplnde)( := OneMore; NewDim" .dimenlength := ResultLength; switch:= true; 2180 2080 while (icount <= TestLength) and (Maplndex = OneMore) ~ if Resul tLength = 0 2181 2081 begin then 2182 2082 try to match value in right arg with one in left arg ~wValTabLink".FirstVaLue := nil 2183 if LeftValPtr".RealVal = RightValptr".RealVal 2083 { resul t is vector of lengthO 2184 then Maplnde)( := icount { value match}; 2084 2185 else icount := icount + 1; 2085 2186 ~gin { transfer values to resul t } LeftVa lPt r := LeftVa lPt r" • NextVa lue 2086 --c.!ftValptr := LeftArg".FirstValue; 2187 end' 2087 while LeftValPtr <> nil do 2188 NewValues'" .RealVal := Maplnde)(; 2088 ~in { transfer left arg values (if any) 2189 2089 NewVaLPtr := NewValues; --ne;(NewVa lues); 2190 RightValPtr := RightValPtr".NextValue 2090 2191 2091 if switch end 2192 2092 then if no match. index becomes one more than length of left arg } 2193 2194 Software Tools 21 2195 NewVaLues".NextVaLue := nil 2297 new(NewVal TabLi nk); 2196 end 2298 OldValTablink".NextValTablink :; Ne.ValTablink; 2197 end {indexof }; 2299 NewVaLTabLink'" .NextVaLTabLink :=~; 2198 2300 NewVaLTabLink".lntermedResult := true; 2199 2301 if not LeftArg" .ForwardOrder 2200 procedure reshape(leftArg, Ri ghtArg: TypeVa l TabPt r); 2302 'FFierl'"ReverseL i nkL i st (LeftArg); 2201 dyadic rho operator - change dimensions of 2303 iT"not RightArg". ForwardOrder 2202 2304 therl'"ReverseL i nkL i st (RightArg); 2203 var 2305 NewVaL TabLi nk'". ForwardOrder := true; 2204 ResultLength, elements: integer; 2306 NewVaL TabLink" .dimensions := LeftArg" .dimensions + 2205 DimPtr: "Dimenlnfo; 2307 RightArg'" .dimensions - 2; 2206 NewPtr: "vaLues; 2308 if NewVaLTabLink" .dimensions < 0 2207 2309 then NewVal TabLink" .dimensions := 0; 2208 begin { reshape 2310 SWitch := true; LastLeftDim:= 0; 2209 -i-f-LeftArg" .dimensions > 1 2311 if LeftArg" .F; rstDimen <> ni t 2210 then error(S6) { left argument not a vector or a seal ar 2312 then - 2211 else 2313 begin { copy all but last of left arg dims into result 2212 ----seg; n 2314 LeftSkip := 1; DimPtr:= LeftArgA.FirstDimen; 2213 ---rieW(NewVa L TabL i ok); 2315 koIhiLe DimPtrA.NextDimen <> nil do 2214 OLdVal TabLink" .NextVal TabLink := NewVaLTabLink; 2316 begin { copy left arg dimensiZ;:;-s } 2215 NewVaLTabLink" .NextVaLTabLink :=~; 2317 new(NewDim); 2216 NewVaLTabLink".IntermedResuLt := true; 2318 NewD;m .... dimenlength :::: DimPtr" .dimenLength; 2217 if not LeftArg" .ForwardOrder 2319 LeftSkip := LeftSkip * DimPtr'" .dimenlength; 2218 "tFierlReverseL i nkLi st (Left Arg); 2320 if switch 2219 ITnot RightArg'" .ForwardOrder 2321 then 2220 thenRev,erseL; nkL is t (R i ght Arg); 2322 beg i n 2221 ~al TabLink" .ForwardOrder := true; 2323 switch := faLse; 2222 if LeftArg" .FirstOimen = niL 2324 NewValTabLinkA.FirstDimen := NewDim 2223 then NewVaLTabLink" .dimenSTOns := 1 2325 end 2224 erse 2326 eLse-NewPtr~ .NextDimen := NewDim; 2225 ~wValTabLink~.d;mens;ons := LeftArg~.F;rstDimen~. 2327 NewPtr := NewDim; DimPtr:= DimPtr".NextDimen 2226 dimenlength; 2328 end; 2227 ResultLength := 1; LeftVaLPtr:= LeftArg~.FirstVaLue; 2329 LastLeftDim := DimPtr .... dimenLength 2228 switch := true; 2330 end; 2229 whiLe LeftVaLPtr <> nil do 2331 i f~ghtArgA.F; rstDimen <> ni l 2230 --r-left arg values---areaimensions of resul t } 2332 then 2231 begin { build resul t dimensions} 2333 be"gin 2232 ~uLtLength := ResuLtLength * trunc(LeftValPtr~. 2334 --{-copy all but first of right arg dims into! result} 2233 ReaLVal); 2335 RightSkip :; 1; 2234 newCNewDi m); 2336 DimPtr := RightArg".FirstDimen".NextDimen; 2235 NewDim~ .dimenLength := truncCLeftValPtr~ .RealVal); 2337 whi le DimPtr <> nil do 2236 LeftVaLPtr := LeftValPtr~ .NextValue; 2338 be'9in { copy rightarg dimensions} 2237 if SOlI; tch 2339 -ne;(NewDim) ; 2238 then 2340 NekolDim~ .dimenlength := DimPtr A.dimenLength; 2239 begin 2341 RightSkip :::: RightSkip * DimPtr'" .dimenLength; 2240 -----switch := false; 2342 if switch 2241 NeOilVaLTabLink .... FirstDimen := NeOilDim 2343 then 2242 end 2344 beg; n 2243 else---DimPtr'" .NextDimen .- NeOilDim; 2345 sOilitch := faLse; 2244 DimPtr := NekolD;m 2346 NewValTabLink~.FirstDimen := NewDim 2245 end; 2347 end 2246 NewDim .... NextDimen := niL; 2348 eLse-NekolPtr~ .NextDimen := NeOilDim; 2247 RightValPtr := RightA;g:-.FirstValue; elements:= O· 2349 NewPtr := NewDim; DimPtr:= D;mPtr~.NextDimen 2248 switch := true; 2350 end 2249 while eLements < ResultLength do 2351 end' 2250 be'9in { duplicate right arg values into result values} 2352 ;(S-;~tch then NewVaLTabLinkA.FirstDimen := nil 2251 ---eLements := elements + 1; new(NeOilValues); 2353 else NewDim"'-:-N'eXtDimen := ni L; 2252 if RightValPtr ; nil 2354 TfLeftArg" .F; rstVaLue = nT then LeftSkip := 0; 2253 - { extend right---argument if necessary} 2355 if RightArg~-.F;rstValue =Ii'"iL then RightSkip := 0; 2254 then RightValPtr := RightArg" .FirstValue; 2356 SWitch := true; - 2255 NewValues .... RealVal := RightVaLPtr .... RealVal; 2357 if RightArg .... FirstDimen <> nil 2256 if skolitch 2358 then FirstRightDim :::: Right""Arg".FirstDimenA.dimenLength 2257 then 2359 eTS'e Fi rstRightDim := 0; 2258 beg in 2360 iTFi rstRightDim > LastLeftDim 2259 switch := faLse; 2361 then CommonLength := FirstRightDim 2260 NewVaLTabLink .... FirstValue := NeOilValues 2362 eLSe CommonLength := LastLeftDim; 2261 end 2363 lC'Oli"nt := 0; LeftValPtr:= LeftArg".FirstVaLue; 2262 eLse-NewPtr .... NextVaLue := NeOilValues; 2364 while icount < LeftSkip do 2263 NewPtr := NewVaLues; 2365 begin { loop for each row in left arg } 2264 RightValPtr := RightVaLPtr" .NextValue 2366 Lptr := LeftVaLptr { hold start of row position}; 2265 end; 2367 jcount := 0; 2266 NewVaLues'" .NextVaLue :=~; 2368 koIhile jcount < RightSk;p do 2267 end 2369 ----;;gin { loop for each cOlumn in right arg end {reshape }; 2268 2370 -----ce:ftValPtr := lptr; 2269 2371 RightValPtr := RightArgA.FirstVaLue; 2270 2372 Lcount := 0; 2271 procedure InnerProductCLeftArg, RightArg: TypeVaLTabPtr); 2373 koIhiLe Lcount < jcount do 2272 2374 begin { skip to starting value in right arg 2273 var 2375 Ri ghtVa lPt r := Ri ghtVa LPt r" .NextVa Lue; 2274 Inpro1Code, Inpro2Code, LeftSkip, RightSkip: integer; 2376 if RightVaLPtr = nil then 2275 icount, jcount, kcount, lcount, mcount: integer; 2377 -Ri ghtVa LPt r := RightA"r"g~. Fi rstVa Lue 2276 LastLeftDim, FirstRightDim, CommonLength: integer; 2378 { extend arg }; 2277 lptr: "values; 2379 lcount := lcount + 1 2278 hoLd: reaL; 2380 end" 2279 SFLoat, value: real; 2381 kcoun~ := 0; 2280 2382 while hount < CommonLength do begin { loop for each element in row/column 2281 begin { inner product is matrix multiplication 2383 2282 -r>iiTiPtr := LeftArg~ .Fi rstD;men; 2384 SFLoat := RightVaLPtr~ .ReaLVaL; if LeftArg .... FirstDimen <> nil then DyadComp CS FL oa t, Le ft Va LPt r'" • Rea LVa L, 2283 2385 -whi Le DimPtr'" .NextDimen Inpr02Code) ; 2284 ~nTfCfo 2386 o:fiTiPtr := DimPtr'" .NextDim~- vaLue := SHoat; 2285 2387 { get last dimen of left arg( if any) }; if kcount = 0 2286 2388 if (DimPtr <> nil) and CRightArg".FirstDimen <> nil) then 2287 2389 then -- set identity value for first time through 2288 2390 --:rr DimPtr'" .dimenLength <> RightArgA .Fi rstDimen'" .dimenlength case Inpro1 Code of 2289 2391 then -SZ, 53, 78: SFLOat :; 0.0; 2290 2392 2291 ---.-r ro r (52) 54, 55, 56, 77: SHoat :; 1.0; { last dim of left arg not = to first dim of right arg } 2393 71, 72, 73, 74, 75, 76: { null case} 2292 2394 2293 eL se end { case } begin 2395 eLse-SFloat := hold; 2294 2396 ----rriPr01Code := code div 100 { separate operators}; DyadCompCSFloat, vaLue, Inpro1Code); 2295 2397 Inpr02Code := code =-Too * Inpro1 Code; hold := S Float { save summer result}; 2296 2398 22 Software Tools 2399 LeftVa lPt r := Left Va lpt r" 0 NextVa lue; 2501 procedure dyadic(LeftArg, RightArg: TypeValTabPtr); 2400 if LeftValptr = nil then 2502 { operators wi th codes of 52 and higher } 2401 -LeftValPtr := leftAr"g""oFirstValue 2503 2402 { extend arg ); 2504 var 2403 mcount := 0: 2505 compatible: Boolean; 2404 while mcount < RightSkip do 2506 arg: TypeVa l TabPt r; 2405 begin { skip to next vaI;;"e' in right arg ) 2507 SFloat: real; 2406 mcount := mcount .. 1; 2508 2407 RightValPtr := RightValptr"oNextValue; 2509 begin 2408 if RightValPtr = nil 2510 if code> 1000 then InnerProduct(LeftArg, RightArg) 2409 then RightValPtr := RightArg" oFi rstValue; 2511 erse 2410 en~ 2512 --:rr code> 100 ~ OuterProduce(LeftArg, RightArg) 2411 kcount := kcount + 1 2513 erse 2412 end: 2514 --:rr code > 80 2413 new(NewValues); NewValues"oRealVal:= SFloat; 2515 then 2414 if switch 2516 --case code of 2415 then 2517 ---s'7: IndexOf (leftArg, Ri ghtArg); 2416 begin 2518 88: reshape(LeftArg, Ri ghtArg); 2417 switch := false: 2519 89: catenate(LeftArg, RightArg) 2418 NewValTabLink"oFirstValue := NewValues 2520 end { ease ) 2419 end 2521 else 2420 else NewValptr" oNextValue := NewValues; 2522 begin { simple dyadies ) 2421 NewValPtr :: NewVaLues; j count := j count + 1 i 2523 compatible := true; 2422 2524 if (LeftArg" odimensions >= 1) and (RightArg" 0 2423 iCQUf·t := icount + 1 2525 - dimensions >= 1) 2424 end; 2526 then 2425 ifSwitch then NewVaLTabLink".FirstValue := nil 2527 ---;-:r LeftArg- .dimensions <> RightArg'" .dimensions 2426 else NewValu~NextVaLue := nil 2528 then 2427 en-d- 2529 -COmpatible := false 2428 end """"i'nnerproduct }; 2530 { different ranks/neither scalar 2429 2531 eLse 2430 2532 begin { ranks match - check lengths} 2431 procedure OuterProduce(LeftArg, RightArg: TypeVal TabPtr)i 2533 LeftOimPtr :;:: LeftArg".FirstOimen; 2432 2534 RigthDimPtr :;:: RightArg" .Fi rstDimen; 2433 var 2535 whiLe LeftOimPtr <> nil do 2434 OutProCode: integer; 2536 begin -- 243.5 SFloat: reaL; 2537 if LeftDimPt r" .d ;men Length <> Ri gthOimPt r" • 2436 2538 - dimenlength 2437 begin 2539 then 2438 ----outProCode := code d;v 10; newCNewVaLTabLink): 2540 -COmpatible := false { different length(s) ); 2439 OldVal TabLink" o NextValTabLi nk := NewVal TabLink; 2541 LeftOimPtr :: LeftDimPtr".NextO;men; 2440 NewValTabLink .... NextValTabLink :; nil; 2542 Ri gthOimPt r :: Ri gthOimPt r" .NextDi men end 2441 NewVaLTabLink".IntermedResuLt := tr'Ue; 2543 2442 if not LeftArg".ForwardOrder 2544 end; 2443 tii'enReverseL; nkL; st (LeftArg); 2545 if compatibLe 2444 TIri'ot RightArg" oForwardGrder 2546 { arguments sui tible for dyadic operation} 2445 tFienR"everseL; nkL i st (Ri ght Arg); 2547 then 2446 NewVal TabLink".ForwardOrder :: true; 2548 ~gin { build dimensions of result} 2447 NewVal TabLink".dimensions := LeftArg'" .dimensions + RightArg". 2549 if RightArg" .dimensions > LeftArg" .dimensions then arg := RightArg 2448 dimensions; 2550 2449 switch := true; OimPtr:= LeftArg".FirstDimen; 2551 erse 2450 whi le DimPtr <> n; l do 2552 ---arg := LeftArg { resul t has shape of large!! arg }; newCNewVa l TabL ink); 2451 begin { copy left a-F"g dimensions to resul t } 2553 OldValTabLink"oNextValTabLink := NewValTablink; 2452 new(NewDim): NewDim".dimenLength:= DimPtr".dimenlength: 2554 NewVaLTabLink".NextValTabLink :;::!!..i.l; 2453 if switch 2555 NewVaLTabLink" .IntermedResuLt :;:: true; 2454 then 2556 if LeftArg" .ForwardOrder <> RightArg" .ForwardOrder 2455 ~gin 2557 then ReverseL; nkL i st (LeftArg); 2456 --switch := false; NewVal TabLink" .Fi rstOimen := NewDim 2558 NewVaLTabLink" .ForwardOrder :;:: arg- .ForwardOrder; 2457 end 2559 NewVaLTabLink" .dimens;ons :;:: arg" .dimensions; 2458 else-NewPtr- .NextDimen := NewD;m: 2560 switch := true; DimPtr:;:: arg".FirstDimen; 2459 NewPtr := NewOim: DimPtr:= DimPtr".NextDimen 2561 while DimPtr <> nil do 2460 end- 2562 := ~i n { copy d imenSTons to resul t } 2461 DimPt; RightArg" .Fi rstO;men: 2563 ~CNewDim); 2462 while DimPtr <> nil do 2564 begin { copy dimenSions of right arg to resul t } NewDim- .dimenlength :;:: OimPtr" .dimenlength; 2463 2565 if switch 2464 new(NewOim); NewD;m".dimenLength:= DimPtr".dimenlength; 2566 then 2465 if switch 2567 then 2568 begin 2466 switch :;:: faLse; 2467 ~gin 2569 NewVal TabLink" .Fi rstOimen :;:: NewDim 2468 ----swrtch := false; NewVaLTabLink" .Fi rstDimen := NewDim 2570 end end 2469 2571 el"S"e"NewPtr" .NextOimen := NewDim; eLse-NewPtr".NextDimen := NewDim; 2470 2572 NewPtr := NewDim; DimPtr:= DimPtr" .NextDimen NewPt r :;:: NewDim; 2471 2573 end; OimPt r :;:: Oi mPt r" .NextDimen 2472 2574 ifSwitch then NewVaLTabLink".FirstDimen := nil end; 2473 2575 erse NewOim":Ne'XtO;men := ni l; if switch 2474 2576 S"WITch := true; LeftVal~:= LeftArg" .Fi rstValue; then 2475 2577 while LeftValptr <> nil do 2578 ~wValTabLink".FirstDimen :: nil 2476 ~in -- { result is a scal } 2579 2477 else NewDim" .NextDimen :: n; L; Ri'ghtValptr := RightArg"oFirstValue; 2580 2478 S"W1"tch := true; - while RightValptr <> nil do 2581 2479 RightVaLPtr :;:: RightArg".FirstVaLue; ~in -- 2582 2480 --s-FToat := RightValPtr" .RealVal; LeftValPtr := LeftArg"oFirstValue; 2481 2583 ValPtr :: arg-.FirstVaLue; DyadComp(SFloat, LeftValPtr"oRealVal, OutProCode); 2584 2482 newCNewValues); while VaLPtr <> nil do 2483 2585 if switch begin { performoperation } 2484 2586 new(NewVa Lues); then 2587 2485 --segin SFloat := RightValPtr"oRealVal; 2588 2486 --switch := false; DyadComp(SFloat, LeftValptr" oRealVal, code); 2;89 2487 NewValTabLink".FirstVaLue := NewVaLues NewValues".ReaLVaL := SFLoat; 2488 end 2590 ; f swi tc h 2489 elSeNewValPtr" .NextValue := NewValues; 2591 then 2490 NewValues".RealVal := SFloat; NewVaLPtr:;:: NewVaLues; 2592 begin 2491 RightValptr := RightValptr"oNextValue 2593 switch :;:: faLse; 2492 end o 2594 NewVa LTabLi nk". Fi rstVa Lue :;:: NewVa lues 2493 LeftV;lPtr := LeftValptr"oNextValue 2595 end 2494 end; 2596 eLse NewVaLPtr".NextVaLue :;:: NewValues; 2495 ifSwitch then NewValTabLink-.FirstValue :: nil 2597 NewVaLPtr :: NewValues; 2496 erse NewValu~NextValue :: nil 2598 ValPtr :;:: ValPtr".NextVaLue; 2497 end"{ outerproduct }; 2599 LeftValptr := LeftValPtr" oNextValue; 2498 2600

Software Tools 23 2601 RightValPtr := RightValPtr".NextValue; 2701 begin { parser } 2602 if LeftVa lPt r = nil then 2702 assign:= false; assign1:= false; DonePa rse : = fa l se; 2603 -Le ft Va lPt r := LeftArQ"". Fi rstVa lue 2703 repeat 2604 { extend arg }; 2704 expression(ValidExp) { checks for valid expression ); 2605 if RightValPtr = nil then 2705 if not ValidExp then error(10) 'invalid expression' 2606 -RightValPtr := RightArg".FirstValue 2706 else -- 2607 { ex tend 2707 --rr SpecSymbol(XRightArrow) 2608 2708 tilen 2609 if e:~~ tch 2709 --rr not «OperTabPtr".OperPtr".FirstValue = nil) and 2610 tilen 2710 - OperTabPtr".OperPtr" .dimensions > 0» 2611 ---""N'ewVal TabLink" .Fi rstValue := nil 2711 then { branch ) 2612 { vector of len 0 } 2712 tresul t of expression is at opertabptr 2613 else NewValues".NextVaLue :=.!!il 2713 if OperTabPtr".OperPtr".FirstValue".RealVal - 1.0 • trunc 2614 en-d- 2714 - 0.0 2615 eLse- 2715 then error(12) { stmt.num.to branch to not an integer 2616 -error(55) 2716 e1Se 2617 { arguments imcompatible for dyadic operation} 2717 --rr SubrTabPt r = nil 2618 end 2718 tilen - 2619 end dyadic}; 2719 begin { function mode 2620 2720 TokenTabPtr := hold; DonePa rse : = true 2621 2721 end 2622 procedure FunCaLL(~ ValidFunk: Boolean); 2722 else 2623 2723 --rr trundOperTabPt r" .OperPt r". Fi rstVa lue" • RealVa II in 2624 var 2724 - [1 •• (SubrTabPtr" .CalledSubr ".~mOfStatements)r 2625 Val idPm: Boolean; 2725 then 2626 2726 --cegin 2627 begin { funcall ) 2727 VFuncHold := SubrTabPtr".CalledSubr".FirstStatement; 2628 ValidFunk := false; 2728 for cnt := 1 to trundOperTabPtr" .OperPtr". 2629 if FunctCall 2729 -Fi rstValue":"RealVall do 2630 tilen 2730 begin - 2631 ~gin 2731 VFuncPt r := VFuncHo ld; 2632 "ifTokenTabPtr" .noun <> StatEnd 2732 TokenTabPtr := VFuncPtr" .NextStmnt; 2633 then . 2733 VFuncHold := VFuncPtr" .NextVFunPrt 2634 begin 2734 ~ 2635 SubrTabpt r". TokenCa II ingSubr :;: TokenTabpt r; 2735 AuxOperTabPtr := OperTabPtr; 2636 primary(ValidPm); if not ValidPm then errod17>; 2736 OperTabPtr := OperTabPtr" .LastOper; 2637 'leftarg of dyadic fun~all not a primary' } 2737 dispose(AuxOperTabPtr); PtrLastOper:= OperTabPtr; 2638 end; 2738 TokenTabPtr := VFuncPtr" .NextStmnt 2639 CallSubr; ValidFunk:= true; 2739 end 2640 end; 2740 elseReturnToCall ingSubr 2641 end { funcall ); 2741 else {--;';ccessor ) 2642 2742 else( successor ) 2643 2743 begin 2644 begin expression 2744 if not assign1 then OutPutVa l; assign1 := fa l se; 2645 primary(Val idPri); 2745 17 SU6'rTabPt r = n~ 2646 if not Va l idPr i 2746 then - 2647 tilen 2747 -"be"g;( { interpretive 2648 begin 2748 ho d := TokenTabPtr; 2649 if TokenTabPt r" .noun Stat End 2749 TokenTabPtr := TokenTabPtr" .NextTokeri; 2650 "t'hen begin ValidExp := true; assign1:= true end 2750 DoneParse := true 2651 erse Val,dExp := false 2751 end 2652 encr­ 2752 e l se-{ function 2653 else 2753 begin 2654 begin 2754 VFuncPtr := VFuncPtr" .NextVFunPrt; 2655 DoneExp := false; 2755 DoneSuccessor := false; 2656 whi le not DoneExp do 2756 repeat 2657 begin 2757 if VFuncPt r <> ni l 2658 FunCa II (Va l idFunc); 2758 then 2659 if Val idFunc 2759 begin 2660 tlen begin expression(VaLidExp); OoneExp:= true "end 2760 TokenTabPt r := VFuncPt r" .NextStmnt; 2661 e1Se-- 2761 DoneSuccessor := true 2662 --"'beg in 2762 end 2663 ---assignment (Va l idAssn); 2763 else- 2664 if ValidAssn and character[ForwardSlash]) or (APLstatelftenH2J 2686 ----ayad i c (OperTabPt r" • OperPt r, OperTabPt r" • 2786 ---0 character[asterisk]) do { '* ends program r LastOper" .OperPt r); 2687 2787 begin - 2688 AuxOperTabPt r := OperTabPt r; 2788 SkipSpaces; TokenSwitch:= true; OperTabPtr := OperTabPtr" .LastOper; 2689 2789 while (position <= LineLength) and (not TokenError) and (not Pt rLastOper := OperTabPt r; 2690 2790 --c:rneTooLong) do di spose (Aux OperTabPt r); 2691 2791 beg i n { sc ann iilg 2692 OperTabPtr" .OperPtr := NewVal TabLink; 2792 if APLstatement[position] characterCdel] end; - { function del imi ter } 2693 2793 end; 2694 2794 then { del encountered } 2695 end; --:rt Funct ionMode end;­ 2795 2696 2796 then end;- begin { end of current function 2697 2797 end (expression ); 26.98 2798 if NewFuncTabPt r <> nil "then NewFuncTabPt r" . NumOf Statements := FuncStatements; 2699 2799 ITF"uncstatements > 2700 2800 a

24 Software Tools 2801 then DIGIT MUST FOLLOW A DE:C IMAL KiINT 2802 begin EXTRANEOUS CHARS, FOLLOW FUNC71O,~ Hi. A;'.' .' 2803 NewFuncTabPt r" .NextFuncTabPt r := OLdFuncTabptr; INV ALID CHARACTE'R F:NCOUNTf.Itl:I, 2804 OLdFuncTabPtr := NewFuncTabptr; FUNCTION ALREADY DF:FINOD 2805 NewVFuncPtr'" .NextVFunPrt := nil ILLEGAL NAME TO frIGHT OF o·X/'[.lc'l)' f.!.,;~::r 2806 end - INVALID FUNCTION/AhGUMfo.'NT NAME 2807 else­ RESULT OF ASSIGNMENT NOT VALID VAAlA";.'· 2808 --sError(75) function defined wi th no statements}; INVALID FUNCTION RIGHT AhGUMo'NT NAP..' 2809 Funct ionMode := false; position:= position + 1 INV ALID EXPRF:SSION 2810 end SYMBOL NOT FOUND 2811 elSeProcessFuntionHeader { start of a new function STATEMENT NO, TO BRANCH TO NOT INTI,'GI.h 2812 e l5eT not a del encountered } DYADIC OPERATOR NOT PRI,CE:DW BY PFtI.'fAhY 2813 begin INVALID EXPRE:SSION WITHIN PARI,NTHI,S;;S 2814 ; f TokenSwi tch MISMATCHED PARF:NTHF:SI:S 2815 then NOT USED 2816 begin { this is start of a new statement LEFT ARG OF DYADIC FUNCT, NOT A fA IMA.IY 2817 TokenSwitch := false; NOT USED 2818 HoldTokenPtr := OldTokenPtr { save starting position VALUE NOT BOOLEAN 2819 ATTEMPfISD DIVISION BY ZERO 2820 MakeTokenLink; NewTokenPtr" .noun := StatEnd; ARGUMENT NOT A SCALAR 2821 NewTokenPtr" .EndAdj := 0; HasLabeL:= false ARGUMENT IS NEGATIVE' 2822 end" ARGUMENT IS NOT AN INTEGo'h' 2823 MakeT~kenLink; identifier(name, ItsAnldentifier); ARGUMENT IS A SCALAJi Oli EMPfY VECTOh 2824 if not ItsAnldentifier then TryToGetA~mber NOT USED 2825 else INVALID OUTU PRODUCT EXPhES'S'ION 2826 begin { process identifier INV ALID INNER PJi'ODUCT EXPRESSION 2827 Sk; pSpaces; NOT USED 2828 if (APLstatemenHpositionJ character[colonJ) and ( LEFT ARGUMENT IS NOT A VtCTOn 2829 - NewTokenPt r" .NextToken" .noun = StatEnd) NOT USE'D 2830 then NOT USED ERROR IN FUNCTION ARGUMENT 2831 ---""begin { process statement label ERROR IN FUNCTION AJiGUMENT 2832 ----saveLabeL := name; HasLabel:= true; INVALID INDEX EXPRESSION 2833 position := position + 1 NON-SCALAR INDICES 2834 end ASSIGNED EXPRESSION NOT A SCALAR 2835 else 2836 --segin process variable name NON-INTEGER INDICES 2837 . ~not FunctionMode INDEX OUT OF RANGE 2838 t'iienNewTokenPtr" .noun := GlobVar INVALID INDEX EXPRESSION 2839 erse NOT USED 2840 ---n- NamesMatch(name, NewFuncTabpt r" • Resul tName) NOT USED 2841 then NewTokenPt r" .noun := FormRes NOT USED 2842 erse NOT USED 2843 ---n- (NamesMatch(name, NewFuncTabpt r" .LeftArg» NOT USED - or (NamesMatch{name, NewFuncTabPt r". 2844 NOT USED 2845 iITghtArg) ) NOT USED 2846 then NewTokenPt r" .noun := FormArg NOT USED NewTokenPtr" .noun := GlobVar; 2847 erse NOT USED 2848 if NewTokenptr" .noun <> GLobVar NOT USED Then TestFuncPtr := NewFuncTabptr 2849 NUMBER AND BASE OF DIFFERENT SIGN Test FuncPt r := nil; 2850 eLSe ARGUMENT IS A VECTOR OF LENGTH ONE "fffi"ot NamelnVarTablecname, VarPointer, 2851 ARGS. NOT COMPATIBLE FOR INNER PRODUCT - Test FuncPt r) 2852 ARGUMENT-S] WITH RANK GREATER THAN ONE 2853 then ATTEMPfED INVERSE OF ZERO 2854 begin ARGS, INCOMPATIBLE FOR DYADIC OPERATION AddNameToVa rTable(name); 2855 LEFT ARGUMENT NOT A VECTOR NewTokenpt r" • VarTabpt r := NewVa rTabpt r 2856 NOT USED end 2857 NOT USED elseNewTokenptr" .VarTabptr := VarPointer 2858 NOT USED encr- 2859 GREATER THAN THREE DIMENSIONS end 2860 NIL 2861 end; RE"ENTER LAST LINE 2862 Ski""PSpaces; INPUT 2863 end; NOT USED 2864 ifNewTokenPtr <> nil NOT USED 2865 then NOT USED R 2866 --rr (TokenError) or (NewTokenPtr .noun StatEnd) NOT USED 2867 tii"en Destroystatement NOT USED 2868 eLSe NOT USED 2869 ---:rr Funct ionMode IDENTIFIER TOO LONG 2870 Then INPUT LINE TOO LONG 2871 --""'beg in INVALID REDUCTION OPERATOR 2872 ---runcStatements := FuncStatements + 1; DYADIC REDUCTION REFERENCE 2873 if FuncStaternents > 0 MONADIC REFERENCE TO DYADIC OPERATOR 2874 then FUNCTION DEFINED WITH NO STATEMENTS ----segin { catalog function statement 2875 NOT USED ----new(NewVFuncPt r); 2876 NOT USED FuncStaternents ;: 1 2877 .!!.. NOT USED 2878 then NewFuncTabPt r" • Fi rst St at ernent : = NewVFunc Pt r NOT USED 2879 erse OLdVFuncPtr" .NextVFunPrt := NewVFuncPtri NOT USED 2880 OLdVFuncPt r := NewVFunCPt r; NOT USED 2881 if HasLabeL NOT USED 2882 then NewVFuncPt r". StatLabel := SaveLabel; NOT USED 2883 NewVFuncPt r" .NextStrnnt := NewTokenPt r NOT USED 2884 end NOT USED 2885 end NOT USED 2886 eLse NOT USED 2887 --rr APLstatement[1 J <> character[deL] then NOT USED 2888 -begin NOT USED 2889 pa r ser(Ne wTo kenPt r, NewVa l TabL ink); NOT USED 2890 100: DestroyStatement NOT USED 2891 end; NOT USED 2892 readLn; TokenError:= faLse; GetAPLstatement; NOT USED 2893 end; NOT USED 2894 end I scanner J. NOT USED NOT USED Contents of APLfil(> NOT USED NOT USED VARIABLE NOT ASSIGNED A VALUE ABCDEFGHIJKlJ>INOPQRSTUVWXYZ 1234067a90: - o. - ll·';. > +- •• * I,'. -(. :" >'VI i.oi

?tL'f t t ~~ V,~ 'c=>nuITI\ PUG INVALID CHARACTER FOLLOWS NEGATIVE 5;·;.\' Software Tools 25 "Don't Fail Me Now"

By Srully Blotnick

The government imposed a 55-mph speed limit on Since last summer I, therefore, have been collect­ cars, not computers. Why, then, are computer owners ing the opinions of everyone, from teachers and hob­ going so slowly? byists to investors and small business owners, who know Are we in the early stages of a technology bust? Pascal to see which books they consider best. A tally Strange as this may sound at a time when the nation of the nearly 1,600 replies shows the following: seems to have gone computer crazy, a good many sci­ For people who know nothing at all about com­ entists are starting to worry about just that. puters or computer programming, the best place to be­ Their concern stems from the massive switch in the gin is R. Pattis' Karel the Robot: A Gentle Introduction computer business from a customer base consisting of to the Art of Programming (John Wiley, $8.95). You a handful of large institutional buyers to millions of don't need a computer to read this book (or the others smaller ones. The computer finally has become a piece about to be mentioned). By learning how to move a ro­ of mass-market electronics, much like video recorders. bot through the streets of a small town, you come to Why is that a problem? A basic rule of business is that understand how programming instructs a computer to risk accompanies opportunity. In this instance, the risk do what you want it to. affects not only the companies in the field, but the entire Pattis' book is about programming but doesn't ac­ country, thanks to the expanding economic importance tually teach the language. The elementary text that re­ of this industry. Its health will soon playa decisive role ceived the top rating in out survey was Arthur Keller's in determining the U. S.' international competitive A First Course in Computer Programming with Pascal position. (McGraw-Hill, $14.95). The book received high praise The risk in dealing with the mass market is always ("Very clear and easy to read") from everyone from 17 a simple one: The mob is fickle. What intrigues it today to 70. It is suitable even as a high school text. may leave it indifferent tomorrow. This time the fickle­ After Keller's book, the next step should be A ness could produce a national disaster. The U.S. has Primer on Pascal by Conway, Gries and Zimmerman unwittingly invested a major portion of its capital-and (Little, Brown, $20). The consensus view: "This book even more important, its hopes - in this area. That's will help you deepen your understanding of the lan­ why some thoughtful workers in the field are beginning guage once you've learned the elements." For those to pray quietly: "Don't fail me now." who already know BASIC, a good way to learn Pascal How, specifically, do they see a failure occurring? fast is Quick Pascal by D. Matuszek (John Wiley, The consensus view is as follows: "A Ferrari is excit­ $11.95). ing, but how exciting would it continue to be if the only One work that was highly rated by advanced stu­ place you could use it were your driveway? Well, that's dents was the second edition of Pascal - User's Man­ exactly what is happening with way too many of the ual and Report (Springer-Verlag, $10.50) by K. Jensen computers now being bought. Car or computer, people and N. Wirth. That is hardly surprising since one of the are eventually going to get tired of just looking at the coauthors, Nikolaus Wirth, invented the language. thing and bragging about it to their friends. Then, the To see what the language can really do, serious stu­ fad will pass. Computer manufacturing plants will close. dents will want to learn about data structures - that is Only a minuscule proportion of computer buyers are such things as lists, stacks, queues, trees, sets, records: making good use of the machine's capabilities. They recursion, sorting and searching. The three top-rated don't know enough about programming to make the texts, all very well written, are: Data Structures and machine really perform." Algorithms by A. Aho, et al. (Addis ion-Wesley, $28.95); "Well, suppose everyone learned BASIC?" I Advanced Programming and Problem Solving with asked. Pascal by G. Schneider and S. Bruell (John Wiley, The overwhelming majority had a better idea: $26.95); and Data Structures Using Pascal by A. Te­ "BASIC is a very easy language to learn, but it would nenbaum and M. Augenstein (Prentis-Hall, $25.95). As be enormously better, a dream come true, if everyone the authors of the first work comment, "The only pre­ learned Pascal, which is far superior and just as easy to requisite we assume is familiarity with some high-level master." programming language such as Pascal." Finally, people with a background in probability theory rated the second edition of R. Cooper's Intro­ duction to Queueing Theory (North-Holland Publishing Dr. Srully Blotnick is a research psychologist and au­ Co., $27) the best - clearest and most user-friendly­ thor of Getting Rich Your Own Way and Winning: The book on the subject. Psychology of Successful Investing. Summing up: Buying a computer and not learning to program it properly not only wastes money, it also Reprinted by permission of Forbes magazine, stands agood chance of eventually harming the nation's February 28, 1983. economy. PUG

26 Articles Computer Generated Population Pyramids Using Pascal

Gerald R. Pitzl Geography Department Macalester College St. Paul, Minnesota

Background and which 1) are effective vehicles for developing the During the past twenty years the development of understanding of key concepts in a discipline (demog­ computer applications in geography has been exten­ raphy in this case); 2) are produced with a cost factor sive. Hundreds of programs have been written and many reflecting only the programmer's time; 3) can be easily are available to users through various dispensing insti­ implemented on any system, micro to mainframe; and tutions, particularly the Geography Program Exchange 4) are written in the programming language of the day, located at Michigan State University. 1 Virtually all of Pascal. the programs, however, are writen in FORTRAN and are suitable for easy installation primarily on large The Population Pyramid (Age Structure) Diagram mainframe computers.2 It is abundantly clear that world population con­ A similar situation exists in cartographic computer tinues to grow at a less than acceptable rate, and that program development. Although the number and va­ some regions, particularly those with countries exhib­ riety of programs written is extensive, the FORTRAN iting low levels of economic development, have excep­ language is used almost exclusively, and the software tionally high rates of growth. 5 The population pyramid is designed for use on large systems. A recent textbook is a useful diagram to study the composition of the pop­ in computer-assisted cartography provides only pass­ ulation of any country or region. ing mention of microcomputer graphics in the field of In the diagram, age groupings of five years each cartography. 3 (0-4, 5-9, 10-14, ... , up to 75+) are presented for both As a consequence of this situation, computer ap­ male and female segments of the population. The scale plications in geography and cartography are limited pri­ along the horizontal axis reports the percentage of the marily to the larger colleges and universities that have total population in each of the age groups. Generally a mainframes and the faculty within the departments to pyramid shape wide at the bottom (young age groups) teach the sUbjects. As a geographer in a small liberal is representative of a fast growing population while an arts college teaching not only introductory cartography age structure more evenly represented along the year's but a course in micro-based computer mapping, I feel axis identifies a population that is stabilizing and that somewhat like a pioneer trying to make a clearing in the does not have a high rate of increase. The industrialized wood without the proper tools. The situation is further and urbanized countries in the developed world would exacerbated because liberal arts colleges have not been fall into the later category; the less developed in the as highly revered by the computer industry as have the former. high technology learning centers and are consequently not receiving anywhere near the number of equipment The Programs grants or the same degree of personnel support. Yet, more than one writer has commented on the Three programs have been deVeloped for student need for a closer association between the computer in­ use in an introductory human geography course. 6 It is dustry and the liberal arts college. In a recent editorial not necessary that the students know the Pascal lan­ in Datamation, John L. Kirkely stated the following: guage in order to run the programs. Introduction is given in class on login/logoff procedures and how to access We urge our industry to work with the lib­ the programs. The student need only find suitable in­ eral arts colleges to develop courses of study formation in the appropriate statistical source for each that combine the humanities and the sciences. of the age groups for a particular region, round these A merging of these artificially separated dis­ values to a whole number, and enter the numbers in the ciplines could be a powerful tonic for both our sequence described in the program prompts. colleges and our corporations.4 The programs developed include: 1) pyramicLfile - This program is used to create I believe that, in time, changes will be made which an external file of information including the region will result in the liberal arts colleges receiving their fair names, year of the data, and the percentages of male share of industry support. In the meantime, however, and female in each age group. Following the input, pro­ individuals in those colleges will continue to make con­ cedure echo-data publishes all the information entered tributions to the furtherance of computer applications for verification. If there were no input errors, the stu­ in what would be considered today to be non-traditional dent selects the appropriate key and the program stores disciplines. The set of programs included in this paper the information in an external file in the student's ac­ are suggestive of the kinds ofthings faculty can produce count. The listing of program pyramicLfile follows:

Articles 27 proor.'" l"yre",ld.fl1eC In!:ll1t. outOllt) I be"in read_dllltlll (e proQraftl to C'r.ate .'1'1 fxtfl!"""ll ttl," ('It pc~o_dllta , POPulit 10'1'1 pyra", Id <1.t.,) if (anslttPr = 'v') (lr (anS'lier = "V") then t-eain const store_l1t1ta; se".rdtor = " •••••••••••••• ------.. --.--.---.. - •• ----... -.-----.. - "rit@ln(' ••••• t')~f'Tat!Or'l C'o"'pletet1 ••••• '), writeln{' Infor'TI"tiol"l stor'(l !r the ftlea " fl1en ••• ) ty.e .nd Ii,ta = else record .rlteln(" invdllc1 dAtil: r'Jn tn. C'lrt')Qral'l' 80811'1') ('ountrYI paCked arrrw rl",,,1 ("of cr-arl yean 'PaCl(tod drray {t,.4] Of el'ldTl "'.le~erc~nt, fe~alererce~tl array fl.,1bl nt lrtprl~r end, 2) geLpycfile - An editing program which the ldfntlflfrs K file of ("!at~)I student may use to access an external file, display the var tefllpi data, contents, and make any necessary changes. This pro­ Infol lde"t!f!pr., filename I packed aTrlly [1 .. 1"'1 of cr..,r: gram would come in handy if more recent data is re­ an .... r I cnarl ceived and the file is to be updated. The listing or program geLpycfile and an example run of informa­ var tion contained in the external file, SWEDEN .PYR, 11 InteQerl follow: healn' ~rltf'lnl ~r1te(' pnter filE' na"'el '11 readll'lCfl1enarre)I (a program to examine tnt" I!"xterT'lal data ftle wrltell'1' creat@d oy ttle prngra"'. 'pyra",ld_fl Ie', aTld chanQ's wr i teit'll to "'Ike 1f necessary. writeC' enter !:llecp !"81r.e -- US" 1'> co 1 Ill1\f"I 5 I '), type read 1 n (tP'Y'll'. count rv); data • wri tt"lnl writeln; record country. packed array rl •• l!)l (If chari wrltfC' enter tne ye8r of the ~ata: '); year a pacl(ed array {J,. 41 (If char I readIn(temp,v~ar} I ",pet, fpct: arr~y (1 .. 1bl of ir.tegllf wrlteIn, end, wrlteIn(' now, ent"r ~~le enl1 fe~ale rprce~taQe5 t~r')1 Id@nttf!er. =- tile of datdl ""rlteln(' todC~ tlQ' QrO\l~1 tonter "'ale r'rcer'lt,.",,.s flrst", wrlteln(" fro" tne niQhest aoe Qroup to t~. lo*est,'), wrlteInC' you !!'ust nave 1f.> ef"ltrles f('lr teen orour,'): var telTlp wrlte-In("entf'r as inteners all on tn" sa"e Un!','" r data, wrlt@lnl info, IdentlflersJ flle"nalTler paclCt"" drray of for 1 1= 1 to I b dO n,.tn) crar, read (temD,lTIe 1 ent r cent r I} 11 writeln(' neyt, ent@r the fe~ale r"rce~t8QeS,'" for 1 ,. 1 to tb do procedure skiPl!nel' feed(te~~,'e~alerercent(l}" var fead 1" I end (reatl.data) r 1, int@Q@rl beoln for 1 1= 1 to 10 0(1 wrlteln vor end (skl.lIne.1 II IntOQU'

heflin writeln, wr 1 telr (Se!'ar,Hor), ~r1teln, .. r1te-lr'l(' tne followlnQ lntt)r.,,~tlon was entere-d.')1 .. r 1 teln; begIn writell'l(' ,tef!'t"l,colJr'ltrv)r writelnl wrlte(' enter file ne~e: '): wr 1 tell'll read In (f iIenaR!e) I wr1tel!'~(" " tell't',vear), reset(lnfo, fl1ena!!'e), wr i tf'l 1"11 temp, country ;. info·,country, .. rlte(' rrale I "" get(lnt.l, 1 := 1 1 f.> do for to temp,year 1= Info·,yearl wrltP(te"'p,rral~(.1ercert{111 J)' get (Int.l, \ilir 1 tell'l; for 1 ,. 1 to ttl do wr 1 t"l~1 beQln \l;r1tf'(' fell'81p I 'll temp,mpctltl ,. !nfo·,,,,pct[ll, for I := 1 tn t b 1(1 oet(lnt.l wrlte(te"'lJ,telt altr.ercentf111 )): @ndl wrlteln, for 1 I II: 1 to 1 b 00 _rlteln, begin .. r1telnCseoar~tor)' temp,fPcttll la Info·,fpC'tUl, wrlteln(' Is tnt lrt~rll'atlnn correct?'), get (lnt.l "'ritf'lr(' if yes, entpr a "'y", If not, etlt.r"), OM, ... r i t4!'(' ",," I '): clOlOClnt.l readlr(al"ls"fI'r), end I.cee ••_tlle_data, , wr 1 tell'll writel!" fond 4eC~O_l1ata) ,

const leparator K " - •••_~~~",,-.--- •• -".---••••••• - ••• ---', vor 11 1nteQer I bea1n t--eQin Skipl1nes, re.,;rttf'(fnfo, fllef"la"'e); ""r 1 trln (ser'lar~tor)' lf1fo·,country :c t@lTc,countrv, "'rltell'll rut(t",fo); ~rlteln(' tne follo~t~" 1nformatl('1f"1 II'" if'lfo·,year I. t."'~,yejllr, ",ritf'l,,(' eontair'led tr'! " fl1t'na~e, ",')1 put (Info); wr1t.lrQ for 1 ,&: 1 to t t- do wrlteln(' , te",~,e-oul"trV)' beain wrltf'ln; tnfo·,rrale[lereent(ll 1= telll~,,.,al.~efCel'ltrl)' ~r1tell'\(' , terrp,Veolr): ~ut (info) wrltelnl .nd, wrlteC' lI'ale I""' .. rcent:'), for I I K 1 to t b do tor 1 :: 1 to lb do r-~all'1 wrltt"(tefl'l~,~ect{1}t 1), Info-,fe"'aler'lercllnt[tl I. tell'tI,telTlal.ptlreent(I)' "'r ltelT'l' put (info) ... rUe(' fell'dle ~@tcentl")' ef\dl for 1 1= 1 to ttl do closectnf(J) write-(teIllP.fret (ill lH enrt fstore_"at") wr 1 tell'; wr It.ll''ll

28 Articles lII'r 1 t! Ir (s!r:larlltor) end (pul:ll1sn.o.-Jt,.) , pseudo-graphic on a line printer. The program can pro­ duce a single plot, as shown in the BERLIN example, ~rocedu re "'cU< e.t 1 I p.C'hanoes: or a double plot of either one region in two time periods VaT or two different regions. The student selects single or 1: 1I'1tPQPr: 5r1ectorl charr double plot and enters the file names. The program takes bea1n over from there and produces the output. A double plot ... rl t.1 r'll ~rltell'lJ of SWEDEN and MEXICO illustrates the age struc­ ""rltpll'l(' YOIl rrav If'ake aT'lV nUl'IIl:Ier of c.,anges')1 ... rltelI"lC' l"Iy s!lectlP'1Q ttle at'l~ropriate IYIf,bol')1 tures of a country with a low rate of growth and one writelnC' for the data to t-e cha"aed,')1 which is high. wrlt"ln; wrlteln(' usp. tnf' followino set tit .eolectorSS')I writeolnl run getpyr wrttelrC' area na",e -- "a'''')1 enter file name: sweden. pyr .,..rttelnC' year -- "y"')1 writelnC' lI'·ale percent -- "'11\'''')1 writelnC' female percef'\t -- "'f'''''' wrlteln; writelnC' enter the selector, thPn (cr>, and'" llirltelnC' YOIl w111 ". prol"pted tCl enter thr", ~rltelnC' ne~ data,')1 wrlteln, writelnC' when you have C'o",pletett t.ne chanoes,'H wrtteln(' enter an "f" to pn~ th@ leaston,'), .. rltell"lJ wrlte(' enter a selecton ">r readl n CIe lrctor) I the following information is repeat contained in sweden.pyr: case Sflector of 'A', 'a'i beolr1 sweden wrltelP'lC' enter r'\e ... arra n~rr",'lI 1970 ~ritplr(' 115! 1~ colU~I'\SI "31 read 1 n (tll!l""t. cOllnt rv) male percent: 2 2 4 4 pnrtl female percent: 2 2 4 4 beq1" wrlteC" enter tl"'P nelll· yearl '" read In CtelT'tI, year) end, do you want to modify the data? -­ '/II', '''''I if so, enter a 'y' !"Ieoin if not, enter an 'n': writflnC' eT'lter fill sh'tp,!," fl'c"lle r~rce"t v".lnes no changes to the file. Wlrit@ln(' 1'!1or'lfst a'1f' ornups to lo'~e!lit:'); for 1 1= 1 to 1 ~ do Ready read Ctfl~C.1T pet r 1] ): reartln p.nd: 'F', 'f'l DrOQrerr dra""yralJlld( Inr:lut, outeut): bl!Qln writeln(' f'ntp.r all slli'tp.el"l ferrdlp fPl("('"t writell"l(' hiqnpst aile QrolJrs teo 10w€,sU'l: const for t := 1 to I t del blInk = ' " re~d(temr.,fpct r I)}, readln type ~T'ld, end (cast') : record ~rttp.ln(' ~~~e a~ntner 5~1f'ctil"l~: ',: countrY: Do1ckert array rt,.IS) nt chdr; reed 1 n (select or) yetlr: r'J4cl(e.., array [1,,'.1 nf C/"cH, until (sell!'ctor "~") or {splectnr = "'dIe, fell'dle: oI1rrdY (l,,1!)) of intp(,Ier, rfwritt'(1nto, tl1enarre': end, info".countcv := te.Tc,country; identlflers file of .., .. tal put (infoll = filfnaTl'e paclced array (1 •• 10) Clf chari info",year := teIl'P.year: = put(Il'\fo): Vor for t := 1 to 16 do beglT'1 choice I C'h"r, tell'PI riatal lnfo",",petr11 := tflIfiP.,,"pctfl1; l?1atrh:: array rl •• 4~, l.,o]} of charI put (info) pyra"'lri I ident I f leTS; 'en"" ftlet, tl11!2: fllenall'el for 1 :a I tn ie, dt:l bec;lJ'1 info",tpct[11 := tf'lT'p,fpctf11: procerJurp InJtiallze.rtrrolVI (slOt all arrey ele",erts to t'lank) put(infol fnd, closeCinfo), Var i, 1: inteaer; writeln(' new data stoT~ti I" fl1el'\arr-e)l ~rlteln, bealr puhlis.,.data for 1 := 1 to 42 ('0 end (maKe.flle.chanaes. : for 1 := t tl') "j ~o 'IIat.r1xrl, 11 := r-lllrk, end (fnltlal1z".arrdv) : procedure ft'Cdify.ttle.cI"'Cliee, var prncedure rl.ot.cnolc", ~SlT'1'llf' Dl!H or sup~rllf~osel"1 rIot} chOice I char I l"eQIn beQin writpln, wr 1 tt!!ln, writelnC' pnteT i!t "11" ff t~ls 15 ill dout-le rlot,')1 wrltelnl wrltel,.c' enter "s" tC'lr ., slrHlle plotr ')1 wrttelnC' 110 you '4i!1nt to II'011fy n· .. .-1ata? --')1 readinCchotcfl; wrlteln(' It la, ef'ltPr a "y''')J "·ritfl'lf' writeC" If r'lot, .. "ter an "n"l '), pnt1 (plot_C'holce) readlnCct'lolce) I if Cc",olce = 'V') or (cnoie! = 'v') tr'lf'F'I make.file.chanoes elle _rlteln(' no ChanQPs tl"l tne file.') heqin end (modify.flle.Choice) ; if (c!'",oice.; 'r,') er (rohC'lice :I "ri') then (ttouble ~lot) heatn "ritelnC" ~nter pach filP Ma~e tin a lepar8tP line;'): B.UI:!_ _ritelr(' UlP. ten colu~ns for ~~ch' rote thp Merker,""":'), accesl.! iie.dat a I 'tJriteln(' It yOll dre at tne lIre prll'1t~r,'); PUblish_dateJ writel"C' posit10n the IfI'rlti"q nead to tl"le"lI !fOd I f y_f lH'_ChO 1 ce wrltell'l(" ldst line ot tl"lp paper before·" pnt1, wr1tf'lnC' enterlno (Cr> lIfter thf' seeof'd file name,'" IJiritelni 3) drawpyramid - The final program accesses the writel"C""": In,. readlr,Cf1iel), information stored in the external file and produces a reaoln(fIle~)

Articles 29 eM var 1, j, k: lntf'Qer: .1 •• 4s11"~le plot) t>fQ'ir'l tllearray: array [1,,2] of ttlpr'I"'It", _rit~ll"'(" tnt.r tn. f11. n~mf' uI1nc ter'l COlu",,,,.,',, ¥Prittl"'(" note t"' • .,.ark'er .... • .. ' .. ), beain wrftl!'lr'l(" tt you IIrt' at tne 11,.., prlf'1ter,'), If (C/"Iolce = '0') or (choicp = "('I'" tt'l@n (t'louble plot.) writf'l!"(" t'nslUC'n ttl •• r1tlI"1Q "'flad to the"), be-01''' IlloarrayllJ 1= f!lol, .vrltf'lrC' last l1n. ~t t"" pal'f'r bptore'), wrfttl"'C" f'nterir'l<:i .')1 fll .. rravl2J := 1110" t ,;; \liT Hf'll"ll t. or t to 2 do b@'l1in wr 1 tflr. ('.", 1 {l) J rea rl lnCfllf'l ) If1=lthpn I!'nri k := 43 end (~nt~r_ttl~_n~~~l I else k I = III, reset (pyrdn"1"', tl1earray r 11 ) J temp, country ,= Dyrarr!d-,country, Qf't(pyran"1d) , vor !LL!"_.~ tl>~ 1, j, 11"1 If'1tf'Qerl for 1 1:1 1 to 1~ dO shorttitlel packPr1 arrl!ly 11 .. 11:11 otctJlr' ",atrIx[4, 1 + 171 1= te!fltl.cout\try(1) lonqt1tlel paclCed l!lrrdV rl .. 1~1 of charI else aQ@'QfouPSI paCked !rraV (l,,~5) of ch.r; tor 1 1= 1 to 15 do rrenWOfTIflnl I"acked arrey [1,,1('1) ot enar, rratrlx[4, 1 + '1 := tell'p,C"C'lul"ltryrjll te",p,year 1:1 pvrarrSd-,ve"r, beQin qet (pyrdll"ld)' tor 1 Iz 2 to 42 ClO If i = :2 t~en bealr- for 1 1 = 1 to 4 ('10 rratrh,[l, 11 II:: "!~: II""trIx(S, 1 + 171 := tt''''J''!.veftr{Jl ",atrlx{l, fill 1= 'I', else endJ for j f= 1 to 4 110 tor 1 Ie 1 to ~3 dO IT'atrlxrS, 1 + '1 IZ te"o,y~arl1l' 1= ,jn ~eaI" for 1 1 to It! ~at r Ix r 1, 1) : I: .... ; beQln mdtrh;[42, 1J 1= ...... , te"p,mau't1) 1= pYTall'1d"',mI'l1"'l11 r end 1 o"t(pyra"'lt1) J for I II: b to 37 "'0 If matrix{2 * 1 • 4, :.t' • "} * tt''''r,1T1'I1,,[1)] (> ,'lank thpn l!Iatrlxrl, 27] pi "t', lI'atrtx{2 '* j + 4, 7' • 2 '* ten~,lTa]t'rj1l := '=" for 1 := 7 to 47 !'lC! else I'I'atrlx(J7, 11 := '.', matrlx[2 '* j • 4, 21 • 2 * tell'tI.II',altf11l := ("tlT(Ie) If (ernic@' = 'n') or (cholC'E' • "d') th.n @'n~1 bt"oin for j r= 1 to 1 b cH'I lonatltlt' 1= "porulo!tlnr'l pvre1l1!.11 lu~ertlT',~oled" beQln t@'n'p,fe,.,ele(j] := r:yrd'TIld"','fpIT181Pt1J; for 1 1= ,) to n ~o lTIatrlxfJ, 1J Z= lonqtlt1eo[1 - 2] Q'et(pyralf'ld)' oM If llIatrlx('2 • 1 + 1, 11 + "} * telll~,f"I'I'ale(1)l (> blank. tt'len .1s' ,.,atr1x{2' j .. 4, '17 + • tPIT,~.felf'al('rjll := "=~ t'leOln tlse j + + shorttitle :1: ~"O"ulat1or'l r-yra"'1rl~, ",,,trix[2'* 4, 21 2 • ten'l'P,ftrri!!llfd1l1 := C'hr(k) end, for j la 3 to '0 ('If.! lIIatrlxr3, 1l 1= S!lorttltlerj .. 2) close(pyrCl!'l'1d) erlC1, .nO rre,,_olTlen :z "lI'll.telYlale', .00 for 1 IS 13 to 16 do else (s1nQ]e I='lot) I""trixfll, j] 1= IYIl!'nwofllen[1 .. 1211 t-oeQln for j 1= 3111 to 41 110 rtset(ryramlt1, ftlp1): JT!atr1xf13, 11 1= !1'p"Wo1l'eT'l(1 - 'OJ, temp,couf'ltry := pyrdrrid",cn,lntry: ",atrIx[4, SJ} IZ 'a" Ott (pyralf'1t1)' j ,",0 ft'.8tr1x(4, ~ .. l ,. '0", for tz 1 to 15 rr8trixr4, t;!)} 1= 'e", lI'atrlx[4, 1'" 7] := tp.lT'c,cotJ1'Itryf)1; temp,year IZ pvrarrld-,yeen ",atrlx[b, 53} 1= "'''' IT'atrlx(6, 54) := 'S", Qet(pyraIl'1r1), ft'atrix(6, 551 := '+', t.or 1 ,. 1 to 4 "'0 aO@'groups 1= IT'atrjx(~, 1" 2} 1= t.ell'p,y" .. r{1}: ·70-74.5-6960-b4~5-~.~O-54.5-'940_4435_3930_3425 for 1 := 1 to 1~ ~o -'920-2415-19! 0-14 beain tefl'p,male(1) := r,yri!!lmId-,'~a1f1'(1]' Qet (pyramId), t II:: 1, "'atrix{2 • j + 4, 27 .. 2 • tprrt"l,lIIdlflfj11 := ~." k ,_ B J end; wh!l' ! <= b5 do for 1 .= 1 trl 1 t- ()O "'felin beqir'l tor j ,I:: 52 to ~f, do telfp,tem .. le(1J := nvra"'1~"'.fplTi'Jlp[11' beat n Qet (Dyral'l'Id); matrix[k, 11 1= 1I~,.oroIJPs[1lr l"atrix(2 • ) + 4, 7' + 1 • tP or r,fel'l'dlefjlJ := .... 1 Ie 1 + 1 enl'll enrt; elose-(!:lvramld) Ie 1= It • eM end; e~d {r.tri@v._an~_~SS10n_d8t~) fIIatrh(J4, ~3) := '5', Ifatrlx()4, 54) ;= '-'; 1= lI'atrh[34, 51!11 '9': proeedu re Iyrrbol_ex~ 1 anat Ion: tl'8tr1x(3fl, ~11 1= '0"; IT'atrtx[3fo, ~4l 1= '-': va. rratr1x£36, ~~J := '4', Cheekl, cneck21 data. j 1= 7J IIroIhile 1 <1: 47 do beql n t'leoir'l "r 1 t'lr; II'dtrh:{3!a, 11 := ,.,., rf'set(pyrarrlr4, ftlf'l), 1 : = j • 4 cl"ec:kl,cf'lu1'1try 1= pyrdll"lrl"'.coul"ltrv: tonti, aet(f'!yraIfId)J rr"trlx[3P, oIl7] := 'r.": C'htcIC1.y.ar I: ~vr"''1't.,-,ve~r, lI'atrlxf3 C , 1] := '1" elosp(pyrslI'lrl)' IT'atrlxfJQ, I:tl ;: 'r,', reset (rYT'dlT'lt1. til"]); rratrlx(jQ, 111 := '~', ehpc:k2,ceuntry := ryrtS"'lrl"',cnl.lntry: rratr1xU Q , lr;J ::1: 'b', apt (pyrarrit1): lI"etrhrl9, lqJ &= '4'; cneck2,year ::; ~yrarrld·.ytar; ""arrbd39, 23j := '2', closeCllyramlr1)1 l'I'atrlx[J9, 31) := '2', it cMeC:l(l.collntrv = et'l~ck7.,courtry tl"lel" {SI!!III'P. I!!Ir'8 for botn plots) ~atr1x()9, l~j := '4', Clealn fTlatrlx[)Q, lQl := 'b'; ilrltel~(' ", Checlel,vp.ara 4, ••• • ")1 ",atrlx[lc;, 43] := '8", "'r 1 ('In (' ., cnpCk:J,y@'ar: ot, , -- 0'), lI"atrlx(3Cl, 4ft] := '1", IIrHelnC' ''':'''1 SdlT'e v,lJll1e tor 'l!!Ich veAr') rratrlx[JCl, 4il ;: 'O"J .M rr4trhr41, 24] := 'p', plse {rHftf!'rll!'l"t lfatrbd4t, 2SJ PI: 'e': ~eoln If'4trh(41, 2f1j := "r"; wr i til!' 11"1 ( .. eneclc'l,co'Jn(ry, ' -- +~)J lI"atr1x(41, 27} := "c'; 'Ar 1tll!'lM (. , ("rec\t2.coul"I(ry, , -- 0'), rratrlxf41, 2R) ;: 'e'; wr 1tel,., ( ...... =.. 1 Sitfl'le vt!llue tor Dotro areas') rratrix[4t, 2qj := 'n': .M rratrhf41, j(',j := 't'; flnrl (sYIf~ol_exrl~natic". I @'nd {lat-els}

var 11 1 nt e~flr,

30 Articles .,------beat T" tor t 1= 1 tn 12 do populat ion pyramids -- superimposer! "r1tell'l sweden rnex i~o ~nc1 ($lr(i~l1n"ll I 1970 1975 : ! =

... ('I ! ('I + ! Vir ... (') ! ('I + 1, ) I t "tf.'''~r: ! ... ('I ! ('I t-ta11"'1 male I femalt" Iktr'lll'1~s: o ! (') for t 1= 1 to 42 no for 1 1= 1 to "3 dr.l o ! ('I t-ea ir. ".-rite(IT'

! 10 8 8 10 ! populatinn pyramid ! sweden age percent ! 1970 • ! * 75+ ------sweden 70-74 mexico -- 0 I: I: same value for both areas 65-69

60-64 :nale female 55-59 the opportunities available in the field of computer 50-54 science. 45-49 40-44 Notes 35-39 1. The Geography Program Exchange assists uni­ 30-34 versities and other non-profit organizations with the in­ 25-29 terchange of computer software which relates to 20-24 problems of a geographic nature. The address is: 15-19 Geography Program Exchange 10-14 Department of Geography 5-9 Michigan State University 0-4 East Lansing, Michigan 45824

10 8 8 10 2. One of only a few books written on the general percent topic of computer applications in geography is Paul M. Mather, Computers in Geography: A Practical Ap­ proach (Oxford: Basic Blackwell, 1976); it contains four chapters, one of which is an introduction to the FOR­ Conclusion TRAN language. The inclusion of exercises such as this one in social 3. Mark S. Mormonier, Computer-Assisted Car­ science classes has proven to be valuable in a number tography: Principles and Prospects (Englewood Cliffs, of ways. It allows students with little or no program­ New Jersey: Prentice-Hall, Inc., 1982), p. 22. ming background to get over their tentativeness about 4. John L. Kirkley, Editor, "Our Industry Could approaching a computer. In addition, I believe that such Lead a Liberal Arts Renaissance," Datamation, March, exposure to computers, howev~r limited, contributes 1983, p. 29. to the overall computer literacy of students. Finally, the 5. Brian J. L. Berry, et al, The Geography ofEco­ experience may spur a student to want to take a course nomic Systems (Englewood Cliffs, New Jersey: Pren­ in computer programming or to learn other uses of the tice-Hall, Inc., 1976), p.36. computer. 6. The programs in this paper were prepared using There is absolutely no reason why students in all Oregon Software Pascal, Version 2.0, and run on a DEC divisions of the liberal arts setting should not benefit by PDP 11170. PUG

Articles 31 Path Pascal A Language for Concurrent Algorithms

By W. Joseph Berman Advanced Programming Techniques, Inc. 704 Village Road, Charlottesville, VA 22903

1. Introduction 2.1 The Island This paper is intended to provide an overview of Before discussing the example Path Pascal pro­ the Path Pascal programming language. Rather than in­ gram, it may be useful to understand that this program troduce the language by studying its definition, the ap­ is a simple event-driven simulation. The simulation in­ proach taken here is to explore a moderately complex volves an island and its inhabitants. example. While any detailed understanding of Path The island of this program is a very special island. Pascal must be based upon the formal definition of the It consists of a 25 x 17 grid, each element of which can language, this paper will present the most important either be empty (displayed as a blank), contain a wolf concepts embodied in the language. (designated by a 'W'), or contain a rabbit (designated After a brief history of the development of Path by a 'R'). Initially, there are 17 wolves (all in column Pascal, the problem to be solved by the example pro­ 10) and 17 rabbits (all in column 16). gram will be presented. Using this example, three major Each wolf begins with a user-specified "energy". concepts of Path Pascal will be explored. With these This energy is used on an "annual" basis to remain alive, major concepts, the operation of the program can be looking for rabbits to eat or other wolves with which to understood. Finally, a summary of the present status mate. Each "year" the wolf looks around his position and anticipated future of Path Pascal are discussed. on the grid, determining if there are any rabbits or wolves in his neighborhood. Ifthere are any rabbits, the wolfs 2. Background energy is increased by eating them. If, on the other hand, Path Pascal was originally developed at the Uni­ there are too many wolves in the neighborhood, the wolf versity of Illinois in 1978 by Dr. Roy Campbell. Details loses excess energy due to overcrowding. Only if there of the original Path Pascal compiler project are avail­ are a reasonable number of neighbor wolves and this able from the University of Illinois as a series of Re­ wolf is "fertile" does the wolf attempt to produce an search Reports. In addition, the definition of the offspring. Ifthe wolf s energy is reduced to zero, it dies. language has appeared in SIGPLAN Notices [1]. Each rabbit also begins with a user-specified "en­ The University of Illinois implementation of Path ergy". This energy is affected in a manner similar to a Pascal was for the LSI-11123 processor. Path Pascal has wolf, except that a rabbit is considered to have been now been implemented on a variety of machines in­ "eaten" if there are any wolves in its immediate neigh­ cluding the M68000 (by NASA-LaRC), AMAC-80 (by borhood and that rabbits gain energy by overcrowding Martin-Marietta) and V AX-ll/780 (by NASA-God­ rather than losing it. dard). This report is based upon experience gained with Finally, the user may wish to "repopulate" the is­ Path Pascal as part of NASA Contract N AS 1-16985 land, assigning new energy and lifetime specifications. during 1982 using the M68000-based Path Pascal com­ This is done by pressing any key on the keyboard. pilerdeveloped by Dr. Ed Foudriat at NASA's Langley Research Center. 3. Path Pascal Constructs Path Pascal is based upon "Path Expressions" first described by Campbell and Habermann in 1974 [2]. The The example program, ISLAND, is primarily writ­ key concept is that coordination among a collection of ten in standard Pascal. It makes use of only three new concurrent processes should be expressed in a language constructs - OBJECTs, PROCESSes and Wait-for-Son designed especially for that purpose. "Path Expres­ processing. sions" conveniently and succinctly specify the central concepts of "mutual exclusion" (protecting "critical 3.1. OBJECTs sections" of code) and of "synchronization" (waiting Of the several extensions to standard Pascal, the for information to be computed by other processes). In OBJECT construct is the most important to under­ Path Pascal, the primary unit for mutual exclusion and standing Path Pascal. An OBJECT is a Path Pascal synchronization is the subroutine, allowing the use TYPE with several properties similar to a RECORD. symbolic names in the Path Expressions. As with a RECORD, each variable of an OBJECT TYPE In Path Pascal, "counting semaphores" are used allocates stack space and NEW of a pointer to an OB­ to implement both mutual exclusion and synchroniza­ JECT TYPE allocates heap space. The space required tion. By specifying the Path Expression prior to the for a OBJECT TYPE is that for the semaphores implied subroutines that it controls, the compiler can generate by the OBJECT's Path Expression and for any varia­ appropriate initialization, P-operation and V-operation bles explicitly declared within the OBJECT. Unlike at the beginning and ending of each subroutine. RECORDs, OBJECTs contain subroutines (PROCE-

32 Articles DURESs, FUNCTIONs and PROCESSes). Those tion). The routine WRITES (update terminal screen) is subroutines that are included in the Path Expression are available only within this OBJECT. termed "ENTRY" routines and may be accessed from outside of the OBJECT using the RECORD-like nota­ tion "object.entry(parameters)" (e.g., line 436 or line 3.1.4. OBJECT SHUTUP (lines 186-200) 444). This OBJECT is used to synchronize the termi­ Lines 16-52,71-95,96-183 and 186-200 indicate four nation of the simulation. Since Path Pascal does not al­ common kinds of OBJECTs. These examples will be low "preemptive termination" of process (see Section discussed in the following sections. 4), care must be taken when writing processes that must eventually terminate. 3.1.1. OBJECT CRTOBj (lines 16-52) This OBJECT acts essentially as a binary sema­ This OBJECT is an example of an "interprocess phore. The call to SHUTUP. WAIT on line 376 will cause buffer" OBJECT. Since processes run concurrently (see the calling process (SHUTDOWN) to suspend opera­ Section 4), they must be synchronized in order to trans­ tion until the call to SHUTUP.SIGNAL is made on line fer information. Unlike ADA in which processes must 364. "rendezvous", Path Pascal facilitates the concept of "interprocess buffers" that contain data to be trans­ 3.2. PROCESSes ferred from one process to another. This allows the The second major addition of Path Pascal to stand­ "sending" process to continue execution after gener­ ard Pascal is the PROCESS. Conceptually, a PRO­ ating the information for the other process. CESS is a PROCEDURE that, after it is called, executes The Path Expression on lines 19-21 has both mu­ in parallel with its caller. In Path Pascal, all processes tual exclusion and synchronization expressions. the first that are not waiting due to a Path Expression, a DOlO two expressions simply state that the operations PUSH (see below) or a DELAY are competing for the hard­ and POP are atomic (only one PUSH at a time and only ware processor(s). Also note that each call to a PRO­ one POP at a time). The last expression specifies the CESS creates a new process, as in lines 311-317. synchronization between PUSH and POP. It states that PROCESSes in Path Pascal can either be normal a call to POP may not proceed until a call to PUSH has or INTERRUPT PROCESSes. An INTERRUPT PRO­ completed and, furthermore, at most CRTSZ calls to CESS has two special attributes not associated with PUSH can be honored before at least one call to POP normal PROCESSes. The PRIORITY and VECTOR occurs. information are used to control the interrupt hardware This last implication of the Path Expression, that such that the DOlO statement (lines 213-237) acts as a at most CRTSZ calls to PUSH can proceed without at "wait-for-interrupt" . In addition, as shown on lines 211, least one call to POP, is the key to understanding the 216, 234, 239, it is sometimes necessary to enter "su­ data structures (lines 24-27) and code (lines 29-51) of pervisor state" in order to access device controllers. CRTOBJ. Since at most CRTSZ calls to PUSH can oc­ cur without a call to POP, all that is required is space 3.2.1. INTERRUPT PROCESSDLVjIN (lines 201-221) for CRTSZ "messages". Since the "interprocess mes­ sage" in this case is just a character, BUF is simply an This process is an "infinite loop", waiting for an ARRAY ofCRTSZ characters. INPTR specifies where interrupt from the terminal input hardware. When such PUSH is to put its character, and OUTPTR specifies an input occurs, the character is forwarded to the ap­ where POP is to get its character. This code works be­ propriate interprocess buffer. cause the Path Expression controls access to the rou­ tines PUSH and POP, and, therefore, controls access 3.2.2. INTERRUPT PROCESS DL VjOUT to the BUF ARRAY. (lines 224-241) This process is also an "infinite loop". It waits for 3.1.2. OBJECT CREATOR (lines 71-95) a character to be placed into the appropriate interpro­ This OBJECT is also an interprocess buffer; how­ cess buffer, transfer the character to the terminal, and ever, the buffer has only a single entry (the V ARs XX, waits for the completion interrupt. YYand EE). This form of the interprocess buffer is very similar to the ADA "rendezvous". 3.2.3. PROCESS WOLF (lines 242-270) This process corresponds to a wolf in the simula­ 3.1.3. OBJECT SCREEN (lines 96-183) tion; it is called when a wolf is to be created. The pro­ This OBJECT is used to control access to the INFO cess is a loop corresponding to the lifetime of the wolf. ARRAY, the inmemory representation of the island. The In the loop, the ENERGY of the wolf (a local variable) Path Expression on line 99 simply states that one and is constantly updated until it is reduced to zero and the only one of the allowed operations may be progress at wolf dies. any given instant. The routines in this OBJECT include SETUP (for 3.2.4. PROCESS RABBIT (lines 273-302) reinitialization), KILL (for termination), LOOK (for This PROCESS is similar to PROCESS WOLF, examining the "neighborhood" of a wolf or rabbit), except that it corresponds to a rabbit. As with the wolf, ASSIGN (for direct control ofINFO), CHANGE (a test­ the ENERGY of the rabbit is constantly updated until and-set operation) and DONE (a set-and-test opera- it is reduced to zero and the rabbit dies.

Articles 33 3.2.5. PROCESS SHUTDOWN (lines 366-380) 444). The main program now signals the SHUTDOWN This PROCESS is used to wait for input from the process that no more requests for creation will be gen­ user (any input will do). When this input occurs, it is erated, and the master control loop iterates. necessary to notify the screen monitor (line 374) and the main program (line 375). However, at thia point it is 5. Summary and Conclusions necessary to wait for the main program (actually, PRO­ While a single example cannot cover all of the con­ CEDURE PROCREATE) to complete its processing structs and uses of those constructs, the ISLAND pro­ (line 376). Finally, SHUTDOWN "absorbs"any extra gram is representative of the important capabilities that attempts to create rabbits or wolves. This is completed Path Pascal has that are not found in standard Pascal. when the special message having an ENERGY of zero These capabilities include multiple processes (PRO­ is encountered, and SHUTDOWN is terminated. CESS), interprocess coordination (OBJECT), and pro­ cess termination coordination (Wait-for-Son). 3.3. Wait-for-Sons Processing Having programmed in Path Pascal for several When a PROGRAM, PROCEDURE, FUNC­ months, it is clear that these new capabilities are useful. TION or PROCESS calls a PROCESS, it is necessary Many of the PROCESSes and OBJECTs that have been that this "son" process terminate before the "father" written have been found to be highly reuseable since can terminate. This is logically necessary due to the they "encapsulate" and entire concept or function scope rules of Path Pascal. Furthermore, this "wait­ within the program. However, it is equally clear that for-sons" processing is a useful tool for coordinating these new capabilities do not "solve" the concurrent the termination of a system. programming problem. DeVeloping the Path Expres­ Except for "wait-for-sons" processing, there is no sions is a tedious, error-prone undertaking. Nonethe­ reason that the code in PROCEDURE PROCREATE less, once a Path Expression is finally "correct" , it is could not be part of the main program. Note, however, usually clear to anyone reading the code exactly what that all of the WOLF and RABBIT processes are ini­ will occur when the program is executed. tiated by PROCREATE. Hence, PROCREATE cannot One of the goals of the current research with Path continue until all of these processes have terminated. Pascal is to identify various "prototype" Path Expres­ This fact is critical to the coordination between PRO­ sions. The "interprocess buffer" is a good example. If CREATE and SHUTDOWN when the simulation is a few such prototypes can be found to be sufficient for being terminated. most situations, a "macro OBJECT" facility might be added to Path Pascal to make these prototypes readily available to the average programmer. 4. PROGRAM ISLAND Having looked at the special features of Path Pas­ PROGRAM ISLAND; (" WOLf" AND RABBIT SIMULATION PROGRAM .. ) CONST cal that are used by this program, it is now possible to BEL 7; (* ASCI r FOR TERMINAL BELL") CR 1"; (* ASCI I FOR TERMINAL ENO- OF' INPtrr .) step through a typical execution of the program. F.sr n; (" ASCI I FOR TERMINAL CREATOR .)

The main program begins (lines 430-433) by allo­ CR'1'5Z 120: (. SIZF. OF TERMINAL BUFFER .)

cating heap-space for CRTIBUF and CRTOBUF, by XMAX 7f,; (' ISLAND SIZE: COLS+l .) initiating the input/output processes DLJVIN and YMAX 18; I:~LAN[) SIZE: ROWS+l ~) DLVJOUT, and associating DLJVIN with CRTIBUF XWO!,F ]0; (. INITIAL COLUMN FOR WOLVE:-; .) XRARRIT If,; (. INITIAL COLUMN FOR RABAITS 'j and DLJVOUT with CRTOBUF. TYPF

The driving loop of the program (lines 435-445) rRTOR,T OA,TFCT (. :JYNCHRONIZF. TERMINAL INPtrr/otITPlIT .)

clears the terminal's screen (using DEC-VT52 proto­ PATH col), prompts the user for parameters (PARAMS), rein­ 1: ( P(J.'!!-i), (. ONE AT A TIME .) l:(POP), (. ONE-AT-A TIME 'j itializes the simulation (SCREEN. SETUP), initiates a (~RT:;Z: ( PW-iH; POP) (. PUSH THEN POP .) END; process to look for terminal input (SHUTDOWN), and VAP calls PROCEDURE PROCREATE. AlIF : ARRAY [1"" CR'I'SZ J OF CHAR; INPTR INTEGER; PROCEDURE PROCREATE (lines 303-365) be­ OUTPTR : INTEGER;

gins by initiating 17 wolves and 17 rabbits. It then enters ENTRY PROCEDURE PUSH( CH; CHAR); a loop waiting for requests for creation. When such a BEGIN RUF[ INPTR 1 CH; request occurs, it is first tested to see ifit was generated IF' INPTR-'CRTSZ THEN INPTR by SHUTDOWN, indicating that termination should E.LSE INPTR INPTR 11 ; begin. If this is not a SHUTDOWN request, it is a re­ END: I' PROCEDURE PDSH ') quest for the creation of a wolf (ENERGY> 0) or a rab­ t:NTRY PROCE:!)lIRE POP( VAR ("H: CHAR): bit (ENERGY

CREATOR OFUIT'T' I' :lYN('HRONIZE WOLF/RAAAIT CREATION' ) :>Hlrr!JP OR,JECT (. SYNCHRONIZE TERMINATION 0-) PATH ) ; ( 'REATE; :lTARTlJP) PATH END; 1: (SIGNAL;WAIT) END; VAR xx INTEGER; ENTRY PROCEDURE SIGNAL; yy INTEGER; BEGIN EE INTEGER; END; (0- PROCEDURE SIGNAL ~)

ENTRY PROCEDURE CREATE( X, y, E: INTEGER l; ENTRY PROCEDURE WAIT; BEGIN REGIN XX X: END; (* PROCEDURE WAIT .-) YY Y: Ef. E: END; (0- OBJECT SHUTUP 0-) END; (. PROCEDURE (~REATE .) INTERRUPT PROCESS DLVJIN [PRIORITY=l,VECTOR-,,#1001 (IRUF:CRTPTR); (. DEFAULT VF:C'TOR II 100 .) ENTRY PROCEDURE STARTUP( VAR X, Y, F.: INTEGER): (. OEFAULT ADDRESS #77777560 t) ~~El; I N VAR X XX· l;,R[ #7777750;,0) INTEGER; Y YY; RUFI 1I-77777Sf,;I 1 INTEGER; EE; (-HRUP INTEGER; END; (. PROCEDURE STARTUP .) CH CHAR; BEGIN ENlJ; (. OR,]J::eT ('REA'I'OR .) REPEAT .')UPSET; SCREEN OBJECT (. COORDINATE SCREEN .) ("SR 64: \)010: PATH (-HRlJF R1W· 1: (SETUP, KILL, LOOK ASSIGN, CHANGE, DONE) '·SF\. CSR 64· END; ~,lJF'RTN : IF ("HAUF· () THEN VAR IRIJF~ PIJSHiCHR(ESC)); STOP BOOI..EAH; lRUF' ,PlrSH((-HR(CHRUF MOD llA)); INFO ARRAY [O .. XMA.X O .. ¥MAX 1 OF INTEGER: !lNTTL FALSE; f.N[); I' !NTf.RRIJPT PROCF.SS DLV,JIN .) ENTRY PROCEDURE SETUP; (~(RE)INITIALIZATION') VAR INTEGER; J NTFRR1JPT f-JROC"F.:-;.'; D].V.1OUT[ PRIORITY -1 VEn'oR II ·l2.() I (()HUF: CRTPTR ) INTEGER; (. DF.F'AIJLT VF:CTOR II ~ 20 .) BEGIN IlFFA1Jl.T An[lRF.:~' STOP FALSE; VAF FOR X : = 0 TO XMAX 00 (. RESET ENERGIES .) (':~Rr #"/·1)'17'",41 IN'rEC;r:R; FOR Y 0 TO YMAX 00 A1Wi1P777"I',nh I INTEGER; INFO[X,Yl 0: (·H ('HAR· END; (. PROCEDURE SETUP 0-) RFI ;IN REPEAT ENTRY PROCEDURE KILL; (0- BEGIN TERMINATION') AEGIN STOP TRUE: END: (0- PROCEDURE KILL .) fd AUF ORIl( ('H) ENTRY PROCEDURE LOOK ( X . Y : INTEGER: VAR ER, EW : INTEGER) ; I;()IO:

PROCEDURE TEST( ENERGY: J NTEGER ); .';IJPRTN· BEGIN l1NTlr, FAr.;;F.· I F ENERGY < 0 THEN ER ER+ENERGY PROCESS WOLF! X. Y. I ENFRGY: I NTE(~ER ); ONE I N~;TANrE PER WOLF .) EL:;f. VAR EW EW+ ENERGY; FNF.R(~Y INTF:(;ER; (,'lJRRf~N'I' ENER(~Y LEVEL '\ END· (0- PROCEDURE TEST .) ER TNTf.(;ER; I' ENf:pr;y LEVEL OF NEIGHBO'RINC; RAHBITS .) EW INT}-:C;PR: I' ENFRr;y LFVEl. ()F NFI<;!lArl'RINI; WOLVES') REGIN INTf.(;EF< . ·'RE:;T" TIMF kF1'WF.EN Ar'TTVITIES .) ER (. SURROUNDING RABBIT ENERGIES • \ HFt;rN EW 0; (. SURROUNDING WOLF ENERGIES .) ENERI;Y I ENERCY· ALWAY:; ,n .) TEST( INFO [X 1, Y 1 ); PEP EAT TE::>T( INFO! X+ 1, Y 1): ENERt;Y ENEI

h IH,.Y CRTOBUF • PUSH( 'W' ); )IELAYi 'I; RF.:;T END; (0- PROCEDURE WRITES 0-) :INTIL ';(-kEEN j)()NHX.Y ENfRCjY); [JEt-TDF WlIETHER STILL "ALIV1::" ~) ENI); I' PR(WF.';'; W(1LF ENTRY PROCEDURE ASSIGN( X, Y, E: INTEGER); BEGIN INFO[X,Y] := E; (0- UPDATE IN-MEMORY 0-:) IF kAhKITl1. 'r , • 11NY IN:;TANIT PER RAHH IT WRITES( X, Y, E); (0- UPDATE SCREEN 0-) \-'AR

END; (0- PROCEDURE ASSIGN 0-) f- NFPI;'y' ; NT!- ;f:H ·'f.,'RYNT ~,'NFR Y ;'1-;\1).'[,

ER [~T~ ;F:F I:N~:RI.y :,J-:'';YL 'JF NE 1 (;I-!ROR I Nl.; R/l.HR I '1':; ENTRY FUNCTION CHANGE ( X, Y, E: INTEGER) :'BOOLEAN; FW N'i'F .i- \,'. I·,NER\;Y (iF NFI',~IlHtlf..1N':, ·W"OJ,VE:-; BEGIN [1[,]" ;'-.JTI- ;!T ·r.-! ·:'lMl H)-TWFFN A,';-',V;TIE:; ') CHANGE : ~ FALSE;

IF (INFO[X,Y)-=O) AND NOT STOP THEN (. PREE •. ) F~FlI\ ,v BEGIN !-'I:I·l

i\N)J I ENI-:P(;Y· RFEI,'!'l LF THEN \' I·P()CREATF ENTRY FUNCTION DONE(X,Y,E:INTEGER):BooLEAN; Articles 35 HECJN PROCESS SHUTDOWN: (" HANDLE TERMINATION ... ) ('REAT( If(, ( REATE( X, Y, ENER(;Y ); VAl< IF' ER, R("R(lWT) THEN (. RARA ITf, I,OVF. A rROW[) ~) CH CHAR: (" INPUT CHARACTER .. ) r:Nr:R{jYf-2 'RANNJ1AI,; X INTEGER: ( ... ABSORB EXCESS ATTEMPTS TO PROCREATE ... ) END: Y INTEGER: If' fNER(;Y, () THI;:N (. AVOID RfCOMING A WOLF·) ENERGY INTEGER; ENER(iY 0; BEGIN I f' ENERGY < RMAX THf:N (. CANNOT {};,F. EXCESS ENERGY .,..) CRTIRUFA,POP(CH); (I< WAIT POR TERMINA.L INPUT 1<) ENERGY RMAX; SCREEN,KILl,; (I< NOTIFY SCREEN MONITOR 1<) OLY: ENERGY RMAX; (. REST BASED UPON ENERGY .) rREATOR, CREATE( 0, (l, 0); (. TERMINATE PROCEATION .,..) IF [)l,Y (- ENERGY THEN ,<;HI1TtTP,WAIT: DJ,Y -ENERGY: REPEAT (. HANDLE ANY EXTRANEOUS ATTEMPTS AT CREATION ~) DELAY( DLY): (* REST"") rRF.AToR , .":TARTlJP( X y, ENERGY); !INTli, SCREEN,OONE{X,Y,ENERGY); (. DECIDE WHETHER STILL "ALIVE" ") IINTII, ENF.RGY-O: END: (.,.. PROCESS RABBIT .,..) f:NrJ: (. PR()('F..s~; SHIITDOWN .)

PR()c:EII1JRE PARAM:';; (. PROMPT U::ifo;R f'OR INPlrr .) 'l'YPF. PROCEDURE PROCREATE 1 (" CREATE RABBITS AND WOLVES ") ~;TRJN(;f, l'A('KEIJ AfH( 'H'): IF nIR:;'O THEN (. If' 0, ("ANNOT !)(l ('REATION rRTOHUJ-" ,PW,H( ('HR( ESC' ) ) ; (. VT'):l rLEAR., SCREEN OPE RAT I ON .) r F r:NER(;Y, () THEN I ' "HEA'I'E NEW RAHH I 'T' • I ("RTOAI1F' P[JSH(' ,J' ); RAHAl 1'( X, y, !':NElo:, iY I PARAMS; (' ASK lISER FOR PARAMETERS .) rr.';E (REATF NEW WoLF ' i SCREEN. SETUP; (. INITIALIZE INTERNAL SCREEN -) WOLFI X. '( .r~NEH(;Y): SHtfTDOWN : (. SETUP FOR EVENTUAL TERMINATION .. ) EN!); PROCREATE; (. RETURNS WHEN ALI, TASKS COMPLETED .,..) IINTII. r:Nf:R(iY 0: (' :aHJ'l'floWN ptmVIIJr::; :;I'F.('IAL ('ODE FOR TERMINATH,N rRF.ATOR, CREATE( 0, (), (l): (. TERMI NATE SHUTDOWN .) .';HIITtJP,: J (;NAL' (. :;HtJ1'Il()WN HANrJl,r:~; Ex'rRANF()!J:; ('Rf:AT I ()N Rr:()tJf':m'~; lIN'I'II. FAI.SE; ENrI' I' PR()CF:t)llTH: PR()( 'JU:A'rr: .) END, (. PROGRAM I :lLANO .) PUG

36 Articles An Introduction to Modula-2 for Pascal Programmers

By Lee Jacobson and Bebo White Jacobson, White, & Associates San Francisco, CA

THE BACKGROUND AND HISTORY object declared outside of it when it only needs to ac­ OF MODULA-2 cess a few of them. Syntactically, modules closely resemble proce­ Modula-2 (like Pascal) was developed at the ETH­ dures, but they have different rules about visibility and Zurich under the direction of (lnstitut fur the existence of their locally declared objects. Consider Informatik). Its development grew largely from a prac­ the following declarations: tical need for a general purpose, efficiently implement­ PROCEDURE Outside, PROCEDURE Outside, able systems programming language. The first VAR x,y,z, INTEGER, VAR x,y.z: INTEGER; production use of Modula-2 occurred in 1981. Dr. MODULE Mod, Wirth's book, 'Programming in Modula-2' was pub­ IMPOQT x, (* no module here *) lished by Springer-Verlag in 1982. EXPORT Q, P1; It is virtually impossible to examine Modula-2 VAR a,b,c, INTEGER, a,b.c: INTEGER; without recognizing its roots in Pascal. In its original PROCEDURE P1, PROCEDURE 'P 1; BEGIN BEGIN design, Pascal was intended to be a language suitable a:=a+1~ a : = a ... 1; K : = a; K : = a; for teaching programming as a systematic discipline END P1, END; (* PI *1 based on certain fundamental concepts clearly and nat­ urally reflected within it. These concepts were largely END Mod; centered around stepwise refinement of problem solu­ tions and structured programming. END Outside; END; (* Outside *1 Inasmuch as Pascal is basically an academic lan­ guage, its widespread use for a variety of applications The only syntactic difference between the module has clearly exceeded its design intention. Hence, many Mod and a normal Pascal procedure declaration are the extensions to the original Pascal definition have been reserved word beginning the declaration (MODULE designed. Likewise, it has attracted as many critics as instead of PROCEDURE) and the presence of IM­ it has disciples. PORT and EXPORT declarations following the module Modula-2 has assumed all of the positive features heading. of Pascal, and has attempted to address its commonly The semantic differences are more interesting. The recognized shortcomings. The result is a structured, objects declared within Mod (a, b, c) exist at the same modular, portable, readable, efficient, machine inde­ time as the variables x, y, and z, and remain so as long pendent, flexible language. as Outside is active. The objects named in Mod's IM­ This paper will address the primary differences be­ PORT list are the only externally declared objects vis­ tween Modula-2 and Pascal with particular emphasis on ible within Mod (x but not y or z). The objects declared some ofthose features which the authors consider quite in Mod's EXPORT list are the only locally declared ob­ significant. Programming examples will be given in both jects visible outside Mod. Thus, a and PI are accessible Modula-2 and Pascal. from Outside, but band c remain hidden inside Mod. Specifically, a module can be thought of as a syn­ MODULA-2'S DIFFERENCES FROM PASCAL tactically opaque wall protecting its enclosed objects, be they variables or procedures. The export list names The Role of Modules in Modula-2 identifiers defined inside the module that are also to be Modules are the most important feature distin­ visible outside. The import list names the identifier de­ guishing Modula-2 from Pascal. Relying heavily upon fined outside the module that is visible inside. Gener­ the concepts of scope and block, modules address the ally, the rules for modules are: problem, usually found in large programs, of separating visibility from existence. In block-structured lan­ 1. Locally declared objects exist as long as the en­ guages, the range in which an object (e.g. a variable or closing procedure remains activated; procedure) is known is called the object's scope, and 2. Locally declared objects are visible inside the therefore, defines its visibility. However, an object's module and if they appear in the module's export list, visibility also binds its existence, in that objects are cre­ they are also visible outside; ated when the block in which they reside is entered and 3. Objects declared outside of the module are vis­ destroyed when the block is exited. It should be pos­ ible inside only if they appear in the module's import sible to declare variables that maintain their values, but list; are visible only in a few parts of a program. Concur­ rently, there is also a need for closer control of visibil­ The following example demonstrates the essence ity. A procedure should not be able to access every of modularity:

Articles 37 MODULE MainProgram; PROGRAM nainProgra.; before constants, constants before types, and so on. VAR Seed INTEGER: Modula-2 eliminates this restriction - declarations can appear in any order. Programs containing a large num­ MODULE RandomNumbers: IMPORT TimeOIDay. ber of declarations are easier to read and understand EXPORT Random; CONST Modulus = 2345. when related declarations are grouped together (re­ Increment = 7227; gardless of their kind). VAR Seed • INTEGER, FUNCTION Rando •• INTEGER, CONST Modulus a 2345. The following is an example of relaxed declaration PROCEDURE RandomC) • INTEGER. Incre.ent = 7227. order: BEGr~ BEGIN Seed CSeed+Increment) Seed CSeed+Incre.ent) .= .= MODULE Xlator. MOD Modulus. MOD Modulus. CONST MaxsSym = 1024. RETURN Seed; Rando. ;= Seed; END Random. END. C* Rando. *) TYPE Sy~Buller = ARRAY! 1 .. MaxSym! OF CHAR. VAR SymBuffl. SymBuff2. SymBuffer. BEGIN (* RandomHumber *) Seed := TimeOfDay; CONST MaxCode 512. END RandomHumber; = TYPE CodeBuffer = ARRAY!I .. MaxCodel OF BYTE. VAR CodeBuff. CodeBuffer. BEGIN (* MainProgram *) BEGIN C* MainProgr •• *) END Xlator. Seed ;= TiaeOfDay.

WriteIntCRandomC). 7). Writeln(Rando., 7). This example easily demonstrates how various re­ END MainProgram. END. C* MainProgra. *) lated declarations may be placed together in a Modula- 2 program, whereas in a Pascal program they may be scattered due to strict block ordering. Relaxed decla­ The random number generator in these examples ration order not only improves readability but enables uses a seed variable to generate the next random num­ a logical ordering which may be very important in large ber. Thus, the seed must maintain its value across func­ programs. tion calls. The program on the right shows the classical Pascal solution. Notice that Seed's declaration is at the GOTO-Iess Programming In Modula-2 top of the program, while its initialization is forced to the bottom. Two obvious disadvantages arise from the Inasmuch as structured programming is often scattering of Seed across the face of the program: equated with elimination of the use of unconditional transfers, Pascal was designed to de-emphasize use of 1. Its occurences become hard to find, especially the GOTO statement. Still the GOTO statement and the in a large program; LABEL 'type' were supported to allow programming 2. It becomes accessible to every other procedure cases where the Pascal logical structures were insuffi­ in the program even though it is used only by Random; cient. This meant that a GOTO statement was available for use in a situation which would otherwise have forced The example on the left demonstrates the useful­ restructuring of the program logic. ness of the module structure. The only object visible to For example, consider the following two program the ouside world is the procedure Random, while all segments: objects pertaining to the random number generator are Remainder := Alpha MOD Beta; 10. Remainder .= Alpha MOD Bet., contained in one place. Note that the module WHILE Remainder <> 0 DO IF Remainder = 0 THEN BEGIN GOTO .20. RandomNumber contains both declarations and a Alpha • = Beta. Al pha • = Beta. statement part. Module bodies are the (optional) out­ Beta := Remainder; Beta := ReaainderJ Remainder .= Alpha MOD Beta GOTO 10. ermost statement parts of module declarations and serve EHD. 20. to initialize a module's variables. Although subject to the module's restrictive visibility rules, module bodies conceptually belong to the enclosing procedure rather The example on the left avoids use of a GOTO by than the modules themselves. Therefore, module bod­ duplicating an operation. The example on the right, ies are automatically executed when the enclosing pro­ while using GOTOs is actually more explicit. cedure is called. Modula-2 does not support Pascal GOTO and LA­ BEL. Instead it provides transfer mechanisms for uses Relaxed Declaration Order under particular controlled circumstances. One of these mechanisms is the EXIT statement which permits pre­ New Pascal users are often frustrated and con­ mature exiting of a loop. The following is a program fused by the enforced declaration and definition block segment in Modula-2 performing the same operation: structure required within the program skeleton. De­ spite the emphasis on modules, blocks still play an im­ LOOP portant part in Modula-2: implementation modules, Remainder .= Alpha MOD Beta. program modules, internal modules, and procedures are IF Remainder .= 0 THEN EXIT. all declared as blocks. Differences from Pascal include Alpha := Beta; Beta : = Remainder relaxed order of declarations, termination of all blocks EHD. by a procedure or module identifier, and the optional nature of block bodies. This example also illustrates the Modula-2 LOOP Pascal imposes a strict order on the declaration of construct which operates as a Loop-Forever structure. objects; within any given block, labels must be declared When the EXIT statement is executed, program control

38 Articles will transfer to the statement following the END state­ communication between subsystems. During the de­ ment which terminates the range of the LOOP. sign stage, however, the subsystems themselves do not Additional examples of unconditional transfers yet exist. They are known only by their interfaces. supported by Modula-2 include the RETURN state­ The concept of a subsystem interface corresponds ment which is used to prematurely exit a procedure, to the definition module construct. Thus, interfaces can and the HALT standard procedure which terminates be defined as a set of definition modules before sub­ the current program. system development (i.e., design and coding ofthe im­ plementation modules) begins. These modules are Dynamic Array Parameters distributed to all members of the programming group, Another important distinction between Modula-2 and it is through these modules that inter-subsystem is and Pascal involves the capability to declare dynamic defined. Interface consistency is automatically en­ array parameters. Modula-2 allows formal parameter forced by the compiler. types of the form: Modula-2 Libraries ARRAY OFT The library is a collection of separately compiled where T is an arbitrary base type. Note that the array modules that forms an essential part of most Modula-2 bounds are omitted defining a dynamic array type which implementations. It typically contains the following is compatible with all (one dimensional) arrays having kinds of modules: the same base type T. The ramifications of this feature are widespread. 1. Low-level system modules which provide ac­ through it, procedures are able to pass to other proce­ cess to local system resources; dures (functions, etc.) arrays of unspecified size. (Index 2. Standard utility modules which provide a con­ checking is accomplished by means of a new standard sistent system environment across all Modula-2 procedure HIGH). implementations; Perhaps the most important way in which dynamic 3. General-purpose modules which provide useful array perameters may be used is in the area of string operations to many programs; processing. This feature lifts the rigid Pascal restriction 4. Special-purpose modules which form part of a concerning the value assignment and comparison of single program; string variables. No longer is it necessary that opera­ tions may only be performed on strings which have the The library is stored on one or more disk files con­ same length. taining compiled forms of the library module's compi­ lation units. The library is accessed by both the compiler Separate Compilation and the program loader - the former reads the com­ Separate compilation is allowed by the Modula-2 piled definition modules while compiling and the latter compiler through the use of the compilation unit. Mod­ loads the compiled implementation modules when ex­ ula-2 programs are constructed from two kinds of com­ ecuting the program that imports library modules. pilation units: program modules and library modules. A dependency arises between library modules and Program modules are single compilation units and their the modules that import them. Consider the example of compiled forms constitute executable programs. They a single library module. The compiler must reference are analogous to standard Pascal programs. the module's symbol file (a compiled definition module) Library modules are a different animal and form in order to compile the implementation module. There­ the basis for the Modula-2Iibrary. They are divided into fore, the definition module must be compiled first. Once a definition module and an implementation module. Def­ an implementation module has been compiled, its ob­ inition modules contain declarations ofthe objects which ject file is tied to the current symbol file, as the object are exported to other compilation units. Implementa­ code is based on procedure and data offsets obtained tion modules contain the code implementing the library from the symbol file. Similarly, when a program im­ module. Both always exist as a pair and are related by ports a library module, it is assumed that the symbol being declared with the same module identifier. file offsets are accurate reflections ofthe corresponding To understand the rationale behind dividing a li­ object file. brary module into separate definition and implemen­ The Modula-2 language contains no standard pro­ tation modules, consider the design and development cedures for I/O, memory allocation, or process sched­ of a large software system, such as an operating system. uling. Instead, these facilities are provided by standard The first step in designing such a system is to identify utility modules stored in the library. Standard utility major subsystems and design interfaces through which modules are expected to be available in every Modula- the subsystems communicate. Once this is done, actual 2 implementation. Thus, by using only standard mod­ development of the subsystems can proceed, with each ules, Modula-2 programs become portable across all programmer responsible for developing one (or more) implementations. of the subsystems. The advantages of expressing commonly-used Now consider the project requirements in terms of routines as library modules (rather than part of the lan­ Modula-2's separate compilation facilities. Subsystems guage) include a smaller compiler, smaller run-time will most likely be composed of one or more compila­ system, and the ability to define alternative facilities tion units. Defining and maintaining consistent inter­ when the standard facilities prove insufficient. Disad­ faces is of critical importance in ensuring error-free vantages include the need to explicitly import and bind

Articles 39 library modules, and occasionally a less flexible syntax REFERENCES imposed by expressing standard routines as library modules (as opposed to their being handled specially 1. Niklaus Wirth, Programming in Modula-2, Sprin­ by the compiler). ger-Verlag, 1982 2. Niklaus Wirth, MODULA-2, ETH Institut fur In­ CONCLUSION formatik Report No. 36, reprinted by Volition Sys­ The examples cited above can only provide a clue tems, Del Mar, CA, 1980 as to the power and flexibility of the Modula-2Ianguage. 3. Rich Gleaves, Modula II User's Manual, Volition It is the hope of the authors that they can pique signif­ Systems, 1982 icant curiosity and interest into this amazing new pro­ 4. Roger Sumner and Rich Gleaves, Modula-2 -A So­ gramming tool. lution to Pascal's Problems, Volition Systems, 1982 PUG

AVAILABLE ON MICROFICHE DIRECT INQUIRIES TO:

miCRO PHOTO Olvlslon ~ BELL E. HOWELL OLD MANSFIELD ROAD WOOSTER OH 44691 Contact Christine Ellis Call tOil-free (800) 321-9881 In Ohio, call (216) 264-6666 collect

40 Articles Data Structures Using Pascal gorithmic errors as so often is the case with multiple by A.M. Tenenbaum and M.J. Augenstein figures. Second, the same basic figure is repeated sev­ Prentice-Hall, 1981 eral times with each version successively updated to show the intermediate results of an algorithm. For ex­ This book is intended as a text for a first course in ample, an array is listed after each pass of a sorting al­ data structures that is also a second course in program­ gorithm so the reader can follow how the sort ming. It presents all of the major data structures in­ progresses. Third, algorithms are often presented as a cluding stacks, queues, lists, trees, and graphs and combination of Pascal and pseudocode, thus highlight­ describes recursion, list processing, sorting, and ing the key points and not confusing the reader with searching. An appendix provides a brieftutorial on Pas­ such irrelevancies as initialization or 110. Fourth, al­ cal. The emphasis is on practical techniques as opposed gorithms are presented several times with each new to theoretical concepts. All algorithms and examples version a refinement of the previous one. are presented in Pascal. My only criticisms would be that some of the al­ This book is excellent both for students and for gorithms could be simplified, frequently by more ap­ practicing programmers who want to learn how to apply propriate tests in "while" statements; and more use algorithms and data structures, whether or not they use should be made of enumeration types - certain algo­ Pascal. However it would not be appropriate, nor was rithms had a Fortran ring to them. However these are it intended to be, for those merely wishing to learn nitpicks: the book is excellent and is highly recom­ Pascal. mended to all PUG'ers. The authors employ several pedagogical tech­ niques which others would do well to emulate. First nu­ Arthur Salwin merous examples and sample programs are presented; 1405 Homeric Ct. the authors do not merely rely on textual explanations. McLean, VA 22101 In spite of this, there are very few typographical or al-

Book Report 41 SOFTWARE BUILDING BLOCKS, INC. ® IBM and IBM Personal Computer are registered ANNOUNCES PASCAL COMPILER FOR THE trademarks of International Business Machines IBM PERSONAL COMPUTER® Corporation @) PascallZ is a trademark ofIthaca InterSystems, Inc. ITHACA, NY - A new company, Software @) PC-DOS is a trademark of International Business Building Blocks, Incorporated, has been formed in Ith­ Machines Corporation aca, New York. The founders of the company are Jeff @) Software Building Blocks and SBB Pascal are trade­ Moskow, author of the popular, highly acclaimed Pas­ marks of Software Building Blocks, Inc. callZ@) compiler marketed by Ithaca InterSystems, Inc.; Laurie Hanselman Moskow, formerly Software Prod­ ucts Manager at InterSystems; and William Kellner, a SAGE OPENS BOSTON DIVISION software engineer who has worked extensively with Moskow on the PascallZ compiler. Sage Computer Technology, headquartered in The first product to be released by Software Build­ Reno, Nevada, has announced the opening of its Bos­ ing Blocks, Inc. is a two-pass, locally optimizing Pascal ton division. compiler for the IBM Personal Computer. The initial The purpose of the new facility is to provide re­ release will run under PC-DOS@); and a CP/M-86@) ver­ gional support for dealers and users of the Sage line of sion is planned for the near future. Based on the Pascali 16-bit , and to expedite delivery of new Z compiler, the Software Building Blocks implemen­ units throughout the Eastern United States. tation, SBB Pascal@) , closely follows the Jensen & Wirth A complete inventory of Sage II's, Sage IV's, parts definition of the language, with extensions designed to and literature is stocked, and a fully-equipped and aid the professional programmer in serious software de­ staffed service department is maintained on the velopment. Extensions will include: variable length premises. strings, direct file access, arbitrary precision BCD According to Rod Coleman, Sage president, plans numbers for business arithmetic, functions returning call for a total of nine such offices to augment the com­ structured values, separate compilation, exterenal rou­ pany's domestic sales and support activities. "Regional tines, include files, symbolic I/O of enumeration types, support for our dealers and OEMS is a critical part of an ELSE clause for the CASE statement, overlays and our marketing plan. " chaining. Sage's Boston office is now open to dealers & The compiler package includes a sophisticated in­ OEMS, and is located at 15 New England Executive teractive Pascal debugger, written in SBB Pascal, de­ Park, Suite 120, Burlington, MA 01803. The telephone signed to aid in isolating and correcting faults in Pascal number is (617) 229-6868. programs. Features ofthe debugger include the abilities More information about Sage micros is available to set and display both absolute and conditional break­ from either Boston office or corporate office at 4905 En­ points; set watches on variables, procedures or func­ ergy Way, Reno, Nevada 89502. Telephone (702) 322- tions; display and modify both global and local variables; 6868. display the procedure/function stack, current state­ ment and module numbers, current run-time require­ If agency contact is required, phone or write The Schraff ments, and the last ten statements executed; trace Group, 18226 W. McDurmott, Suite E, Irvine, CA through a program by statement number and proce­ 92714. Telephone (714) 540-8977. dure/function entry/exit; and more. Also included in the package is a screen editor, provided in SBB Pascal source. The editor's capabili­ NEW, 16-BIT SAGE IV ties include: insertion and deletion of lines and char­ HAS WINCHESTER PLUS acters, finding and/or replacing of strings, copying lines MULTI-USER CAPABILITY oftext, autoindent for entering structured programs, and many other features. The editor makes use ofthe func­ RENO, NEVADA - Sage Computer Technology tion keys on the IBM PC to make editting as easy and has announced availability of the Sage IV, 16-bit (68000) efficient as possible. The editor is provided in source as supermicro. an example of the advantages of programming in SBB The new multi-user computer, which accommo­ Pascal. The library routines are also provided in 8086 dates up to 6 simultaneous users, surpasses the consid­ assembly language source, and many other example erable capabilities of the Sage II introduced in March, programs are included as well. 1982. Software Building Blocks, I",c. intends to release Both machines are based on the 8 MHz 68000 pro­ the PC-DOS version of the compiler in June. For more cessor, and both are capable of performing 2-million information, contact Laurie Moskow, Software Build­ operations per second. According to Rod Coleman, Sage ing Blocks, Inc., P.O. Box 119, Ithaca, New York, president, they offer performance comparable to that 14851-0119, (607) 272-2807. of high-end mini-computers at a mid-range to high-end business micro price. @) CP/M-86 is a trademark of Digital Research, Inc. The Sage IV comes standard with 128K of main

42 Announcements memory which is expandable, optionally to a mega­ vided by an operating system, such as program and pro­ byte. This represents an enormous jump from the 128K cess control; console and file 110, including random to 512K expandability of the Sage II, which in turn of­ access files and disk directory operations; and storage fers far greater capacity than the typical 64K, 8-bit management. The standard software modules also in­ computer. clude utility routines for format conversion, strings, 19 In addition, a 5 to 30Mb Winchester disk, either digit BCD arithmetic, and other facilities. fixed or removable, is built into the Sage IV next to a The manual is divided into six sections. The Mod­ 5~ inch floppy backup. Since there are no wait states, ula-2 tutorial for Pascal programmers comprises about a 20K program loads from the floppy in 1 second, and one-third of the book. from the hard disk in 1/10 second. In addition, there is an introductory section and The cabinet, though about 1Yz. inches taller than sections defining the standard library modules, the util­ that of the Sage II, is still deceptively small, measuring ity library, a system document that describes the im­ only 6W' high, 12W' wide and 16%/1 deep. plementation of Modula-2 for UCSD Pascal@) and a "There aren't any tradeoffs with either of these machine-specific implementation guide which includes machines, said Coleman, "the user doesn't have to give information on machine specific library modules, in­ up software support to get high performance, because terrupt handling, and machine-level data representation. the Sages' p-System standard operating system is able The Modula-2 User's Manual, including Wirth's to run hundreds of popular programs deVeloped for 8- Modula-2 report, is immediately available from Voli­ bit micros." tion Systems, P.O. Box 1236, Del Mar, CA 92014 for More information may be had by contacting Sage $35 per copy. Wirth's book, Programming in Modula- Computer Technology, 35 North Edison Way, Suite 4, 2, published in 1982 by Springer-Verlag, can be ordered Reno, Nevada 89502. Telephone (702) 322-6868. for $16. Further information about the programming language is also available from Volition Systems. If agency contact is required, phone or write The Schraff Volition Systems concentrates on systems soft­ Group, 1325 Airmotive Way, Suite 175, Reno, Nevada ware development and on research and development in 89502. Telephone (702) 348-7339. hardware and sotware. Since the company was founded in 1980, it has been a leader in the implementation and dissemination of the Modula-2language and other high NEW MODULA-2 MANUAL FEATURES level languages and in the design and development of TUTORIALS, STANDARD LIBRARY advanced computer architectures.

DEL MAR, CA, Jan. 21 - A 264-page Modula-2 For further information, contact: user's manual, featuring a language tutorial and stand­ Volition Systems ard library definitions, is now available from Volition P.O. Box 1236, Del Mar, CA 92014 Systems here. (619) 481-2286 Modula-2 is a new programming language designed @) UCSD Pascal is a trademark of the Regents of the by Niklaus Wirth to replace his earlier language, Pas­ University of California. cal, in a wide range of real-world applications. Together with Wirth's own specifications of the language, this manual provides a complete description of Volition's MODULA-2 USER'S MANUAL from Volition implementation of Modula-2, according to its author Systems (Del Mar, CA) describes Niklaus Wirth's new Richard Gleaves of Volition Systems. programming language in a 264-page loose-leaf format. The manual is designed to be used with Wirth's 48- page monograph which defines Modula-2 in a concise document contains a complete tutorial for Pascal pro­ grammers, sections defining the standard library mod­ but informal style. The monograph is included with the ules and the utility library, and an implementation guide. manuaL Wirth's newly published book Programming The manual comes with a copy of Wirth's 48-page tech­ in Modula-2 is also available from Volition. The manual contains a tutorial for Pascal program­ nical report on Modula-2. Modula-2 is particularly useful in large industrial mers that can make them comfortable with the language and commercial applications where using standard within a few hours and proficient within a week, Gleaves modules facilitates development oflarge, complex sys­ said. The name Modula-2 comes from MODUlar LAn­ tems, according to Volition, which has pioneered in commercial implementations of the new language. The guage. It uses modules to facilitate the development and maintenance of large, complex systems. The language Modula-2 User's Manual is immediately available from Volition Systems, P.O. Box 1236, Del Mar, CA 92014 is especially useful in large industrial and commercial applications where it can save software developers both for $35. time and money. For further information, contact: Modula-2 is designed to utilize standard software modules, which are defined in the new manual. These A. Winsor Brown modules provide access to the facilities normally pro- (714) 891-6043

Announcements 43 USUS FALL MEETING SET UCSD PASCAL USERS FORM FOR WASHINGTON,D.C. TEXT EDITOR INTEREST GROUP

WASHINGTON, D.C., June 3 - USUS, Inc., the SAN FRANCISCO, CA, June 15, 1983 - A spe­ UCSD Pascal User's Society, will hold its semi-annual cial interest group (SIG) for users of the Advanced Sys­ national meeting at the Crystal City Hyatt Hotel here tem Editor (ASE) for the UCSD Pascal System has been October 14-16, according to Robert Peterson, USUS formed by USUS, the UCSD Pascal System User's So­ president. ciety, according to Robert W. Peterson, president of In conjunction with the meeting, USUS will spon­ the society. sor two free tutorials - an introduction to the p-System The new SIG will be chaired by Sam Bassett, of and an introduction to UCSD Pascal, including Apple San Francisco, CA. "The ASE SIG will be open to any Pascal. * USUS member who is using or thinking about getting The meeting will feature technical presentations, the Advanced System Editor." Peterson said. hardware and software demonstrations, language tu­ The new ASE SIG allows members to share com­ torials, special interest group meetings and software li­ mon problems and solutions and will serve as a clearing brary exchange. Also planned are expert user and major house for information relating to implementation, op­ vendor panels. Election of officers will be held. timization and use of ASE on a variety of systems which "Non-USUS members are welcome to register and have the UCSD p-System installed. attend any or all of the meeting programs," Peterson The SIG has established a liaison with Volition noted. Systems of Del Mar, CA, the creators of ASE. It will USUS (pronounced use-us) represents users of the coordinate relevant contributions to the USUS Soft­ UCSD Pascal System and its derivatives including the ware Exchange Library and to USUS News, the soci­ UCSD p-System and Apple Pascal. It is the most widely­ ety's quarterly newsletter, Bassett said. Furthermore, used, machine-independent software system. The so­ SIG members may communicate via electronic mail un­ ciety is non-profit and vendor independent. der USUS sponsorship. The UCSD Pascal System has more than 100,000 The next ASE SIG meeting will take place at the users and is capable of running on nearly any computer. USUS semi-annual national meeting in Washington, It was developed at the University of California San D.C., October 14-16. In addition to the ASE and other Diego to facilitate software portability. SIG sessions, the USUS meeting will feature tutorials Among the special interest group meetings sched­ on UCSD Pascal and the UCSD p-System. Also on the uled for the Washington meeting are those for users of agenda are technical presentations, software exchange, IBM Personal Computers, Apple, DEC, Texas Instru­ hardware and software demonstrations and an expert ments, NEC Advanced Personal Computer, the IBM user panel. display writer and Sage Computer Technology Membership in the ASE SIG is free of charge to computers. any member of USUS, the vendor-independent, non­ Also meeting will be those interested in application profit user's group for the UCSD Pascal System. An­ development, graphics, communications, file access, nual membership in the society is $25 for individuals Modula-2, UCSD Pascal compatibility and the Ad­ and $500 for institutions. vanced System Editor. USUS (pronounced use-us) was founded in 1980 The software library, with significant recent ac­ to promote and influence the development of the UCSD quisitions, will be available for reproduction on various Pascal System and to provide a forum for education and diskette formats. Members at the meeting will be able information exchange about it. Further information on to copy the library onto their own disks for $1.00 each. USUS is available from the Secretary, USUS, P.O. Box Those registering for the meeting before Septem­ 1148, La Jolla, CA 92038. ber 23 will qualify for the pre-registration price of $25. Checks should be made payable to USUS and mailed to USUS Meeting Committee, P.O. Box 1148, La Jolla, CA 92038. Registration at the door will be $35 and will PASCAL USER'S SOCIETY begin at 10 a.m. Friday, October 14. FORMS MODULA-2 GROUP Hotel reservations should be made directly with the Crystal City Hyatt hotel (adjacent to Washington SAN DIEGO, CA, May 26 - USUS, the UCSD National Airport), 2799 Jefferson Davis Highway, Ar­ Pascal System User's Society, has formed a special in­ lington, VA 22202, (703) 486-1234. Additional meeting terest group (SIG) for users of the new Modula-2 pro­ information is available from Thomas Woteki, Infor­ gramming language, according to Robert W. Peterson, mation Systems Inc., 3865 Wilson Blvd., Suite 202, Ar­ USUS president. lington, VA 22203, (703) 522-8898. The new SIG will be chaired by David Ramsey of USUS was created to promote and influence the Corvus Systems, Inc. (San Jose,CA). The group was development of the UCSD Pascal System and to pro­ formed when USUS held its semi-annual national meet­ vide users and vendors with a forum for education and ing here last month. Modula-2 runs on Version II based information exchange about it. Annual membership in UCSD Pascal Systems. the society is $25 for individuals and $500 for institutions. "The Modula-2 SIG will be open to any USUS member using or wanting to investigate this language," Ramsey said. "It is, to my knowledge, the first user's * Apple Pascal is a trademark of Apple Computer, Inc. group devoted to communication about Modula-2." 44 Announcements The new language was created by Niklaus Wirth attended and actively participated in special interest to answer difficulties encountered with his earlier lan­ group and committee meetings, panel discussions and guage, Pascal. "As people discover the benefits of the four tutorials." working in this new language, we expect this SIG to Keynote speaker for the event was Andrew Green­ expand repidly," Ramsey said. berg, designer and co-author of the popular Wizardry Implementations of the Modula-2 programming games. He told how he had solved the challenge of put­ language are available for the Apple II, lie and III com­ ting a very large program like Wizardry on a microcom­ puters, the IBM Personal Computer, the 68000-based puter with limited disk and main memory storage. Sage 2 and 4, the Texas Instruments 9900, the Scenic "Greenberg offered members valuable insights into One and Z80/8080-based systems, according to Joel J. program design, structure and implementation," Pe­ McCormack of Volition Systems (Del Mar, CA). terson noted. Volition is the only current supplier of the language The new special interest groups are for application for use on microcomputers and supplies systems as well developers and for users of the NEC Advanced Per­ as the Modula-2language to run on them. sonal Computer, the IBM Display Writer, the Ad­ "Because the language is modular, users spend less vanced System Editor from Volition Systems, and the time writing and maintaining code," McCormack said. Modula-2 programming language. In addition, plans for "Standard library modules provide Modula-2 with a the national organization's first local group in Southern standard operating environment, and programs created California were discussed. within it are portable across all Modula-2 systems." USUS already has SIG's for users of Apple, DEC, The new Modula-2 SIG will enable users to share Texas Instruments and Sage computers, the IBM Per­ experiences with others using the language or devel­ sonal Computer and for those interested in communi­ oping applications in it, Ramsey said. "We expect to cations, word processing and UCSD Pascal serve as a clearing house for user information in this compatibility. fast-changing area." Of particular interest to those attending the meet­ One of the first goals of the SIG is creation of a ing was the demonstration area, where the latest ad­ user's library of Modula-2 programs that will be in­ vances in UCSD Pascal hardware, software and cluded in the USUS library, Ramsey noted. It will be applications were demonstrated on 20 different ma­ compiled by Curt Snyder of Allergan Pharmaceuticals chines, Peterson said. (Irvine, CA). At the meeting, Apple Computer, Inc., which has Membership in the Modula-2 SIG is free of charge an installed base of some 82,000 Pascal development to any member of USUS, which is the vendor-inde­ systems on its Apple II and Apple III computers, an­ pendent, non-profit user's group for the UCSD Pascal nounced that updates of Apple II Pascal and Apple III System. Annual membership in the society is $25 for Pascal will be available this year. individuals and $500 for institutions. Further informa­ Apple revealed that Version 1.2 of Apple II Pascal tion on USUS is available from the Secretary, USUS, will be available in the fourth quarter of 1983 and will P.O. Box 1148, La Jolla, CA 92038. provide support for all features of the Apple lIe includ­ For those wanting to know more about the Mod­ ing extended memory support for the 128K lIe. Version ula-2 SIG, Ramsey can be reached at Corvus Systems, 1.2 also makes available facilities for integrating into 2029 O'Toole Avenue, San Jose, CA 95131, (408) 946- the UCSD Pascal environment in a natural way addi­ 7700, extension 267. tional mass storage devices such as hard disks. Volition Systems has pioneered in the implemen­ Apple also confirmed that Version 1.1 of Apple III tation and dissemination of the Modula-2 language. Pascal will be available at the end ofJune 1983. Its most Further information about Modula-2 and available im­ notable feature is the Standard Apple Numeric Envi­ plementations may be obtained from Tracy Barrett, ronment that fully implements the IEEE standard for Volition Systems, P.O. Box 1236, Del Mar, CA 92014, floating point arithmetic. (619) 481-2286. Volition Systems demonstrated the new Modula-2 programming language running for the first time on an IBM Personal Computer. USUS members formed a Modula-2 SIG at the meeting to exchange information PASCAL USERS, VENDORS GATHER about the language. It will be chaired by Dave Ramsey, FOR USUS SAN DIEGO MEETING Corvus Systems (San Jose, CA). The chairman of the newly formed application de­ SAN DIEGO, CA, May 2 - USUS, the UCSD Pascal veloper's SIG is Dennis Gallinat, Apple Computer (Cu­ System User's Society, formed five new special inter­ pertino, CA), and Samuel Bassett, Bassett Information est groups (SIG's) and made plans for a first regional Processing (San Francisco, CA) is chairing the Ad­ chapter at its well-attended, semi-annual national meet­ vanced System Editor SIG. ing here last week, according to Robert W. Peterson, Lane Sharman, Resource Systems Group (Del Mar, USUS president. CA) will head the Special Interest Group for the IBM In addition, two vendors ofUCSD Pascal products Display Writer, and the NEC Advanced Personal Com­ - Apple Computer, Inc. and Volition Systems - chose puter SIG will be chaired by George Symons, TICOM the occasion to reveal new offerings. Systems, Inc. (Marina del Ray, CA). "Record meeting attendance reflects the users' The fall USUS meeting will be held in Washington, commitment to increased knowledge about use of the D.C., at the Hyatt Regency Crystal City, October 14- UCSD Pascal System," Peterson said. "More than 240 16, 1983. Further information is available from the Sec-

Announcements 45 retary, USUS, P.O. Box 1148, La Jolla, CA 92038. The IBM PC implementation will significantly ex­ USUS (pronounced use-us) is a vendor-independ­ pand the availability of Modula-2. Current Volition ver­ ent, non-profit user's group for the most widely used, sions are based on the 6502 (including Apple IF and machine-independent software system - the UCSD Apple III computers), the 8080/Z80, TI 9900, and the Pascal System, and its successors such as the Apple 68000. Pascal System and the UCSD p-System. Niklaus Wirth developed Modula-2 (from MOD­ USUS was created to promote and influence the ular LAnguage) to replace his earlier language, Pascal. development of the UCSD Pascal System and to pro­ Whereas Pascal was intended as"a teaching language, vide a forum for education and information exchange Modula-2 is expressly designed for use in a wide range about it. USUS has institutional as well as individual of real-world applications, and it offers great flexibility members in more than 20 countries. Annual member­ in the development oflarge, complex systems. ship in the society is $25 for individuals and $500 for The implementation for the IBM PC is expected to institutions. be available in the third quarter of 1983, McCormack said. The system will include Modula-2 and Pascal compilers, the modula library, the powerful ASE text VOLITION DEMONSTRATES editor, V-NI)(@> command shell (that provides a UNIX3- MODULA-2 FOR IBM PC like programming environment), and a complete set of utility programs for file manipulation and electronic mail DEL MAR, CA, May 3 - Volition Systems here communication. has demonstrated Niklaus Wirth's new Modula-2 pro­ Volition Systems concentrates on systems soft­ gramming language running for the first time on the IBM ware development and on research and development in Personal Computer. hardware and software. Since the company was founded The new implementation was demonstrated for in 1980, it has led in the implementation and dissemi­ members of USUS, the UCSD PascaP System User's nation of the Modula-2 language and other high-level Society, at its semi-annual national meeting in San Diego languages and in the design and development of ad­ last week. Modula-2 will be included as part of Voli­ vanced computer architectures. tion's complete software development system. "Modula-2 is proving especially valuable in large For further information, contact: industrial and commercial applications where standard V olition Systems software modules can save time and money in program P.O. Box 1236, Del Mar, CA 92014 development and maintenance," according to Joel J. (619) 481-2286 McCormack of Volition Systems. "Now our new implementation will make these savings possible on the IBM PC. Our software devel­ 1 UCSD Pascal is a trademark of the Regents of the opment system will even run efficiently on 64K PC's," University of California. he continued. "And the availability of Modula-2 on the 2 Apple II and Apple III are trademarks of Apple Com­ IBM PC should make the language even more attractive puter, Inc. to application developers." 3 UNIX is a trademark of Bell Laboratories. PUG

46 Announcements O. DATE Apr. 28,1983

1. IMPLEMENTOR/MAINTAINER/DISTRIBUTOR (0 Give a person. address and phone number 0, Robert Reimiller OMegaSoft p.O. Box 842 CaMarillo, CA 93010 (805) 987-6426 2. MACHI NE ISYSTEM CON FIGURATION (0 Any known limits on the configuration or support software required, e.g. ··1C (i 8 09 P race s so r oper.ting system. OJ Running Moos, 05-9, or Flex OS Requires 48K to 5fiK (RecoMmended)

3. DISTRIBUTION (0 Who to ask. how it comes. in what options. and at what price OJ

;\Iorth America: Fron OMega Soft International: FroM OmcqaSoft or distrihutors in GerMrtny, Switzer­ land, Great Britain, Australia, Sweden, and the Netherlands. Price is $425 to $475 for Compiler, Dehuqqer, and Runtime. Relocatable AsseMbler/Linker available ~or $125 to $150.

4. DOCUMENTATION (0 What is available and where OJ 220 Per. Pascal manurtl with complete syntax and installation instructions.

5. MAINTENANCE (0 Is it unmaintained. fully maintained. etd OJ Yearly Maintenance is $100 to $125

6. STANDARD (0 How does it measure up to standard Pas caP Is it a subset) Extended? How. °1 Cornnlete ISO standard except packed variables and procedural para­ meters. Scored 92% on conformance section of validation suite. ISO report in manual. Extended for real tiMe and industrial control applications.

7. MEASUREMENTS (0 Of its speed or space. °1 Warshalls AlgorithM: procedure size=270 hyt~s, J';xecution time=9. 7 seconds

8. R E LlABI LlTY (0 Any information about field use or sites installed OJ Over 400 sites installed. Over 4000 sites installed.

9. DEVELOPMENT METHOD 1° How was it developed and what was ir wntten in) 0' FrOM scratch in asseMble language.

, 0 LIBRARY SUPPORT (0 Any other support for cOn-Jpder In the form of Ilni

Implementation Reports 47 ~ !/aih ~ r~!/aih ~ r~!/aih ~ r~!/aih ~ r~ .~ OmegaSoft Pascal Version 2

Pascal Processor Identification Test 6.9.3-1: Standard I/O devices may not be re­ defined if declared. Host Computer: Smoke Signal Broadcasting Chief­ Test 6.9.3.5.1-1: Real numbers written out in float­ tain 9522812WI0 running the OS-9 operating system. ing point format always have six digits to the right of Host Computer Requirements: MC6809 processor, the decimal point. minimum of 48K bytes of memory, 2 or more disk drives, running the OS-9, MDOS, XDOS, DOS69, or FLEX DEVIANCE TESTS operating system. Processor: OmegaS oft pascal version 2.10 Number of deviations correctly detected = 83 Number of tests showing true extensions = 45 (22 Test Conditions reasons) Number of tests not detecting erroneous deviations = Tester: R. D. Reimiller 9 (6 reasons) Date: June 1982 Validation Suite Version: 3.0 Details of Extensions

General Introduction to the OmegaSoft Implementation Test 6.1.5-4: No digits are needed after the decimal point in a real number. The OmegaSoft Pascal compiler was developed to Tests 6.1.6-4 and 6.1.6-5: Labels may be a positive provide the users of the 6809 processor with a fast and integer constant. efficient way to develop code capable of running on the Tests 6.1.7-5, 6.4.3.1-3, 6.4.3.1-4, 6.6.3.3-5, 6.9.3.2- host development system or installed into a target system. 2: All variables are packed at the byte level, the re­ The compiler is aimed primarily at industrial applica­ served word "Packed" is ignored in any type tions such as process control and instrumentation. Due declaration. to the nature of these applications many extensions were Tests 6.1.7-6, 6.1.7-7, 6.1.7-8, 6.4.3.2-5: Strings, added such as byte arithmetic, long integers, dynamic characters, and arrays ofless than 127 elements are all length strings, modular compilation, and versatile vari­ compatible. able addressing. As a secondary requirement it was de­ Tests 6.1.7-11 and 6.4.5-12: Strings are dynamic sired that the compiler be able to accept a Pascal program length, allowable length is from 0 (null string) to 126. written in ISO standard Pascal wherever possible. Tests 6.2.1-8 and 6.2.1-10: Label, const, type, and var declaration sections can be in any order and re­ CONFORMANCE TESTS peated mUltiple times until a procedure/function dec­ laration or "begin" is encountered. Number of tests passed = 144 Test 6.3-9: In any context where a constant is ac­ Number of tests failed = 12 (9 reasons) ceptable an expression with a constant value may be used. Details of Failed Tests Test 6.4.2.3-5: All enumerated type values are compatible. Test 6.4.2.3-3: If an enumerated type is defined in Test 6.4.3.3-8: The values of the case constants in the index declaration part of an array its values cannot a record variant declaration are not used, access is pro­ be referenced until the array declaration is complete. vided to all variants at all times. Test 6.4.2.3-4: If an enumerated type is defined in Test 6.4.5-7: All subranges of the same type are a record its values cannot be referenced until the record compatible. declaration is complete. Tests 6.4.5-8 and 6.4.5-13: Arrays of the same size Tests 6.6.3.1-4, 6.6.3.4-1, 6.6.3.4-2, and 6.6.3.5-1: are compatible. Procedures and functions cannot be passed as Tests 6.4.5-9 and 6.4.6-7: Records ofthe same size parameters. are compatible. Test 6.6.5.4-1: Pack and Unpack procedures are not Test 6.4.5-10: All pointers are compatible with other supported. pointers or the type "Hex". Test 6.7.2.2-3: Failed on MOD using a negative Test 6.6.2-5: Any type with a size of less than 128 dividend. The Jenson/Wirth "remainder after divi­ bytes can be used as a function return type. sion" method is used rather than the method specified Test 6.6.6.3-2: Trunc and round can have integer in the ISO standard. or longinteger parameters. Test 6.8.2.4-1: Non-local GOTO' s are not allowed. Test 6.7.2.3-2: Logical operators are valid for char­ Test 6.8.3.9-1: Assignment to the control variable acter and integer expressions. of a FOR loop occurs after the evaluation of the first Test 6.7.2.5-6: Arrays of the same size can be com­ expression. pared. Records of the same size can be compared. 48 Validation Suite Reports Test 6.8.2.4-2: Goto between branches of an If considered an error to check eoln if eof is true. statement are allowed. Tests 6.8.3.5-10 and 6.8.3.5-11: Ifno match in case Test 6.8.2.4-3: Goto between branches of a Case statement, falls through with no error. statement are allowed. Test 6.8.3.9-18: No restrictions on the control var­ Tests 6.8.3.5-7 and 6.8.3.5-8: Subrange Case state­ iable of a For loop. ment constants are allowed. Test 6.8.3.9-1: At the completion of a For loop the Tests 6.8.3.9-5, 6.8.3.9-6, 6.8.3.9-7, 6.8.3.9-10, control variable is valid and has the final value. 6.8.3.9-12,6.8.3.9-13,6.8.3.9-14, 6.8.3.9-15, 6.8.3.9-16, Tests 6.9.3.2-5 and 6.9.3.2-5: Writing of real num­ and 6.8.3.9-17: No restrictions are placed on For state­ bers with no digits past the decimal point is permissible. ment control variable. Tests 6.8.3.9-8 and 6.8.3.9-9: If a For statement is QUALITY MEASUREMENT entered and exited normally the control variable will be valid and contain the final value. If a For statement is Number of tests run = 52 not entered then the control variable will be valid and Number of tests incorrectly handled = 5 contain the initial value. Results of Tests Details of Deviations "Synthetic Benchmark" - execution time 1 min­ Test 6.1.8-5: A number can be terminated by a letter. ute, 10 seconds. Tests 6.2.1-5 and 6.2.1-6: MUltiple siting for labels "GAMM measure" - execution time 1 minute, 40 is not checked, nor are labels required to be sited at all. seconds for N = 1000 Tests 6.2.2-8, 6.3-6, and 6.4.1-3: Error in scope procedure calls - execution time 40 seconds rules. identifiers are significant up to 120 characters. Test 6.6.1-7: Unresolved forward function or pro­ source lines may be up to 120 characters. cedure declaration is not detected. no reasonable limit on number of real literals Test 6.6.3.3-4: Use of a field selector as a parameter allowed. is not detected. no reasonable limit on number of strings allowed. Test 6.10-4: No check is made for duplication of if a line of code is incorrectly part of an unclosed program parameters. comment the compiler will signal that no code was gen­ erated for the line. . ERROR-HANDLING at least 50 types may be declared in a program . no reasonable limit on number of labels, but there Number of errors correctly detected = 19 can be a maximum of 8 forward referenced goto's in a Number of errors not detected = 31 (13 reasons) block. at least 128 constant definitions are allowed per Details of Errors Not Detected constant declaration part. at least 128 procedures are permitted in a program. Tests 6.2.1-11, 6.4.3.3-11, 6.4.3.3-12, 6.4.3.3-11, maximum size for an array or record or for any var­ 6.5.4-2, and 6.6.2-9: No checking is made to verify iable section is 32750 bytes. whether or not a variable is accessed that has an un­ at least 8 index types can appear in an array type. defined value. Instead the variables are guaranteed to at least 128 case-constant values are permitted in contain garbage unless initialized. a variant record. Tests 6.4.3.3-1,6.6.5.3-8,6.6.5.3-9, and 6.6.5.3-10: at least 50 record-sections can appear in the fixed Any tagfields or selector variables in a record variant part of a record. are irrelevant to which variants can be accessed. at least 30 distinct variants are permitted in a record. Test 6.4.6-10: No subrange checking on parameter "Warshall's algorithm" procedure size = 270 passing. bytes, execution time = 9.7 seconds. Tests 6.4.6-12, 6.4.6-13, and 6.7.2.4-4: Overflow considerably less than 300 indentifiers are allowed checking is done on sets based on byte count - not per in a declaration list (actual number depends on length element. of identifier). Tests 6.5.4-1, 6.6.5.3-4, 6.6.5.3-5, and 6.6.5.3-11: at least 8 dimensional array is allowed. Pointer value is not checked before use. procedures may be nested to at least 15 levels. Tests 6.5.5-2,6.5.5-3, 6.6.5.3-6, and 6.6.5.3-7: There at least 30 formal parameter sections can appear in are no restrictions on the use of pointers or file buffer one parameter list. variables which are currently parameters or elements the dispose in the standard heap manager is a of a with statement. _ dummy, a more complex heap manager is available. Test 6.6.5.2-5: To support random files a "get" is deeply nested function calls are allowed (at least not executed until called as a procedure or when ac­ 6). cessing the file buffer without a valid element - not at deeply nested compound statements are allowed the time of "reset". (at least 25). Test 6.6.6.4-7: Char and Hex variables "roll over" a procedure may have at least 300 statements. from maximum value to zero - it is not considered an deeply nested if statements are allowed (at least error. 25). Test 6.6.6.5-7: If eof is true - so is eoln - it is not at least 256 case constants are allowed. Validation Suite Reports 49 at least 300 constants are allowed in a case-con- are fully evaluated. stant list. Tests 6.8.2.2-1 and 6.8.2.2-2: In an assignment case statements can be nested to at least 15 deep. statement evaluation of the expression is done before repeat loops can be nested to at least 15 deep. the selection of the variable. while loops can be nested to at least 15 deep. Test 6.8.2.3-2: When a procedure is called the pa­ for loops can be nested to at least 15 deep. rameters are evaluated in forward order. with statements can be nested to at least 15 deep. Test 6.9.3.2-6: Default field widths are: Integers = recursive 110 can be used with the same file for the 10, Boolean = 6, Real = 16, Longinteger = 16, Hex = second 110 action. 6. at least 30 variable-accesses can appear in a read Test 6.9.3.5.1-2: Real values written in floating point or readln parameter list. format have 2 exponent digits. at least 30 write-parameters can appear in a write Test 6.9.3.6-1: Boolean values written in the de­ or writeln parameter list. fault fieldwidth have the format as shown (between data written on the output field appears regardless quotes) " TRUE" and" FALSE". of the omission of a line marker. Details of Tests Incorrectly Handled IMPLEMENTATION-DEFINED Number of tests run = 12 Tests 6.6.6.1-1: Functions are not allowed to be Number of tests incorrectly handled = 1 passed as parameters to a procedure.

Details of Implementation-Defined Features Levell Tests - Not applicable

Tests 6.1.9-5 and 6.1.9-6: alternate symbols are EXTENSIONS available for comments, array indices, and pointers. Test 6.4.2.2-10: Maxint is 32767 Extension present = 1 Test 6.4.3.4-5: maximum range of set elements is 0 .. 1007 Result of Extension Test 6.6.6.2-11: Base = 2, Bits of mantissa = 24, not rounding, minimum value = 2.710506E-20, maxi­ Test 6.8.3.5-16: An otherwise clause is allowed on mum value = 9.223372E+ 18 a case statement. Tests 6.7.2.3-3 and 6.7.2.3-4: Boolean expressions PUG

50 Validation Suite Reports Membership July 1983 Pascal News 2903 Huntington Road Cleveland, Ohio 44120

Please enter my o New or o Renew

membership in Pascal Users Group. I understand I will receive "Pascal News" whenever it is published in this calendar year.

Pascal News should be mailed 1 yr. 0 in USA $25 o outside USA $35 o AirMail anywhere $60 3 yr. 0 in USA $50 o outside USA $80 o AirMail anywhere $125 (Make checks payable to: "Pascal Users Group," drawn on USA bank in US dollars)

Enclosed please find US $ __. on check number ___

(Invoice will be sent on receipt of purchase or­ ders. Payment must be received before news­ letter will be sent. Purchase orders will be billed $10 for additional work.)

(I have difficulty reading addresses. Please forgive me and type or print clearly.) My address is:

NAME

ADDRESS

PHONE

COMPUTER

DATE

o This is an address correction here is myoid address label:

Coupons 51 JOINING PASCAL USER GROUP?

• 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"). • When you join PUG any time within a year: January 1 to December 31, you will receive all issues Pascal News for that year. • We produce Pascal News as a means toward the end of promoting Pascal and communicating news of events surrounding Pascal to persons interested in Pascal. We are simply interested in the news ourselves and prefer to share it through Pascal News. We desire to minimize paperwork, because we have other work to do.

RENEWING?

• Please renew early (before November) 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.

ORDERING BACK ISSUES OR EXTRA ISSUES?

• Our unusual policy of automatically sending all issues of Pascal News to anyone who joins within a year means that 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 out of print. • Issues 9 .. 12, 13 .. 16, & 17 .. 20, 21 .. 23 are available from PUG(USA) all for $25.00 a set. • Extra single copies of new issues (current academic year) are: $10 each - PUG(USA).

SENDING MATERIAL FOR PUBLICATION?

• Your experiences with Pascal (teaching and otherwise), ideas, letters, opinions, notices, news, articles, con­ ference announcements, reports, implementation information, applications, etc. are welcome. Please send material single-spaced and in camera-ready (use a dark ribbon and lines 15.5 cm. wide) form. • All letters will be printed unless they contain a request to the contrary.

52 Coupons Back Issues 1983

Pascal News 2903 Huntington Road Cleveland, Ohio 44120

Back issues are requested and sent in sets

$25 D set 1 Issues 9 ... 12 (September 1977 - June 1978)

$25 D set 2 Issues 13 ... 16 (December 1978 - October 1979)

$25 D set 3 Issues 17 ... 20 (March 1980 - December 1980)

$25 D set 4 Issues 21 ... 23 (April 1981 [mailed January 1982] - September 1981 [mailed March 1982])

Requests from outside USA please add $5 per set.

All memberships entered in 1983 will receive issue 24 and all other issues published in that year. Make check payable to: "Pascal Users Group," drawn on USA bank in US dollars.

Enclosed please find US $ __ ._ on check number ___

(I have difficulty reading addresses. Please forgive me and type or print clearly)

My address is:

NAME

ADDRESS

PHONE

COMPUTER

DATE

53 Coupons 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 "as 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 property of The British Standards Organization 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 documentation contained in the Validation Suite for the purpose of compiler validation, acceptance tests, benchmarking, preparation of comparative reports and similar purposes, 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 documents, reference shall be made to the original copyright notice and its source. Distribution Charge: $300.00 Make checks payable to: Mail Request and Check To: Software Consultin~ Services Software Consulting Services 901 Whittier Dr. in US dollars drawn on a US bank. AllentownJ... P A. 18103 USA Remittance must accompany application. Attn: 1\. J. Cichelli

SOURCE CODE DELIVERY MEDIUM SPECIFICATION

I Mapnelic Ilpe I 8" Diskllle 9-Tnck, odd parily, 1I2"x600'. Selecl Densily: ( I Si.gle DI.sily ( I 800 bpi (I 1600 bpi ( I Double Daslly I ANSI"STANDARD. Each logical record is an Formal 80 character card image. Each physical I CP/M I UCSD III (W. D. Mlcroe.ginel record has I block size of 40 logical I UCSD II, IV I DEC-RT (Si.gll Dasilyl records. Select Character. Code: I DEC-RSX Files 11 I IBM 3740 (Singll De.slly EBCDICI ( I ASCII ( I EBCDIC I Special DEC Syslem Allernale Formals: Special Formal ( I RSX-IAS PIP (requires ANSI MAGlape RSX SYSGENI. I Inlerleave (1-261 ( I DOS-RSTS FLX. I Skew (0-251

Office Use Only

Signed: Date: Richard J. Cichelli On Behalf of A. H. J. Sale and B. S. I.

54 Coupons UCSD Pascal System User's Society UCSD p-System User's Society naus

GET MORE FROM YOUR PASCAL SYSTEM .... JOIN USUS TODAY

USUS is the USER'S GROUP for the most widely used, machine-independent software system. If you use UCSD Pascal*, Apple Pascal** or the UCSD p-System, USUS wililink you with a community of users that share your interests.

USUS was formed to give users an opportunity to promote and influence the development of UCSD Pascal and the UCSD p-System and to help them learn more about their systems. USUS is non­ profit and vendor-Independent.

Members get access to the latest UCSD p-System information and to extensive Pascal expertise. In USUS, you have formal and Informal opportunities to communicate with and learn from other users via:

• NATIONAL MEETINGS • SOFTWARE LIBRARY • USUS NEWS AND REPORT • SPECIAL INTEREST GROUPS • ELECTRONIC MAIL

'UCSD Pascal and the UCSD p-System are trademarks ollhe Regents 01 the University 01 Caillornla. ~ ___... __ .. ______.. _____.. _·"AP~~~!!.~~?~~~':'.~~~.:.~~~~ .. ;:~:':?£~:.. ~~~E.~.~.! ..~~ ...... __ ._._ .. ___.. ______._ .. _.... ___ .

USUS MEMBERSHIP APPLICATION IPlease complete both sides)

I am applying for $25 individual membership $500 organization membership $ __ air mail service surcharge

Rates are for 12 months and cover surface mailing of the newsletter. If you reside outside North America. air mail service is available for a surcharge. It is as follows: $5.00 annually for those in the Caribbean. Central America and Columbia and Venezuela; $1 0.00 annuallyforthose in South America, Turkey and North Africa; and $15.00 for all others. Check or money order should be drawn on a U. S. bank or U.S. office.

Name/Title

Affiliation Address ______

Phone \-( ______.______TWX/Telex

Option: Do not print my phone number In USUS rosters Option: Print only my name and country In USUS rosters Option: Do not release my name on mailing lists

Coupons 55 USUS MEMBERSHIP BENEFITS * * * * * • NATIONAL MEETINGS twice a year let you learn from experts and tryout the newest products. Meetings feature hardware and software demonstrations, tutorials, technical presentations and information. reduced-cost software library access, special interestgroup(SIG) meetings. and a chance to query "major" vendors.

• USUS NEWS AN D RE PORT brings you news and information about your operating system fourtimes a year. It contains technical articles and updates, library catalog listings, SIG reports, a software vendor directory and organizational news.

• ELECTRON IC MAl L puts USUS subscribers in touch with a nationwide network of users. Compu­ Serve MUSUS SIG is for data bases and bulletin board communications. GTE Telemail accommo­ dates one-to-one messages.

• SOFTWARE EXCHANGE LIBRARY offers an extensive collection of tools, games, applications, and aides in UCSD Pascal source code at nominal prices.

• SPECIAL I NTEREST GROUPS zero in on specific problems, represent member interests with manufacturers.

For more information. contact: Secretary, USUS, P. O. Box 1148, La Jolla, CA 92038, USA.

Computer System: __ Z-80 __ 8080 __ PDP/LSI-11 __ 6502/Apple __ 6800 __ 6809 __ 9900 __ 8086/8088 __ Z8000 __ 68000 __ MicroEngine __ IBM PC Other ______

I am interested in the following Committees/Special Interest Groups (SIGs):

____ Advanced System Editor SIG __ Meetings Committee __ AppleSIG __ Modula-2 SIG __ Application Developer'S SIG ____ N EC Advanced PC SIG __ Communications SIG ____ Publications Committee __ DEC SIG __ SageSIG __ File Access SIG __ Software Exchange Library __ Graphics SIG ____. Technical Issues Committee __ IBM Display Writer SIG __. Texas Instruments SIG __ !BM PCSIG __ UCSD Pascal Compatability SIG

Mail completed application with check or money order payable to USUS and drawn on a U.S. bank or U.S. office, to Secretary, USUS, P.O. Box 1148, La Jolla. CA 92038, USA.

56 Coupons Membership July 1983 Pascal News 2903 Huntington Road Cleveland, Ohio 44120

Please enter my o New or o Renew

membership in Pascal Users Group. I understand I will receive "Pascal News" whenever it is published in this calendar year.

Pascal News should be mailed 1 yr. 0 in USA $25 o outside USA $35 o AirMail anywhere $60 3 yr. 0 in USA $50 o outside USA $80 o AirMail anywhere $125 (Make checks payable to: "Pascal Users Group," drawn on USA bank in US dollars)

Enclosed please find US $ __. on check number ___

(Invoice will be sent on receipt of purchase or­ ders. Payment must be received before news­ letter will be sent. Purchase orders will be billed $10 for additional work.)

(I have difficulty reading addresses. Please forgive me and type or print clearly.) My address is:

NAME

ADDRESS

PHONE

COMPUTER

DATE

o This is an address correction here is myoid address label:

Coupons 57 JOINING PASCAL USER GROUP?

• 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"). • When you join PUG any time within a year: January 1 to December 31, you will receive all issues Pascal News for that year. • We produce Pascal News as a means toward the end of promoting Pascal and communicating news of events surrounding Pascal to persons interested in Pascal. We are simply interested in the news ourselves and prefer to share it through Pascal News. We desire to minimize paperwork, because we have other work to do.

RENEWING?

• Please renew early (before November) 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.

ORDERING BACK ISSUES OR EXTRA ISSUES?

• Our unusual policy of automatically sending all issues of Pascal News to anyone who joins within a year means that 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 out of print. • Issues 9 .. 12, 13 .. 16, & 17 .. 20, 21 .. 23 are available from PUG(USA) all for $25.00 a set. • Extra single copies of new issues (current academic year) are: $10 each - PUG(USA).

SENDING MATERIAL FOR PUBLICATION?

• Your experiences with Pascal (teaching and otherwise), ideas, letters, opinions, notices, news, articles, con­ ference announcements, reports, implementation information, applications, etc. are welcome. Please send material single-spaced and in camera-ready (use a dark ribbon and lines 15.5 cm. wide) form. • All letters will be printed unless they contain a request to the contrary.

58 Coupons Back Issues 1983

Pascal News 2903 Huntington Road Cleveland, Ohio 44120

Back issues are requested and sent in sets

!:II:li.!.!'I.~•• [tl!!!~:\fl::~!I;i..I.i~llr~!.i.'1::I.*i ®[illu ®~ ~OO~~u $25 0 set 1 Issues 9 ... 12 (September 1977 - June 1978)

$25 0 set 2 Issues 13 ... 16 (December 1978 - October 1979)

$25 0 set 3 Issues 17 ... 20 (March 1980 - December 1980)

$25 0 set 4 Issues 21 ... 23 (April 1981 [mailed January 1982] - September 1981 [mailed March 1982])

Requests from outside USA please add $5 per set.

All memberships entered in 1983 will receive issue 24 and all other issues published in that year. Make check payable to: "Pascal Users Group," drawn on USA bank in US dollars.

Enclosed please find US $ __ . _ on check number ___

(I have difficulty reading addresses. Please forgive me and type or print clearly)

My address is:

NAME

ADDRESS

PHONE

COMPUTER

DATE

59 Coupons Back Issues 1983

Pascal News 2903 Huntington Road Cleveland, Ohio 44120

Back issues are requested and sent in sets

I Ii @illllJ @~ [?OOmmr $25 0 set 1 Issues 9 ... 12 (September 1977 - June 1978)

$25 0 set 2 Issues 13 ... 16 (December 1978 - October 1979)

$25 0 set 3 Issues 17 ... 20 (March 1980 - December 1980)

$25 0 set 4 Issues 21 ... 23 (April 1981 [mailed January 1982] - September 1981 [mailed March 1982])

Requests from outside USA please add $5 per set.

All memberships entered in 1983 will receive issue 24 and all other issues published in that year. Make check payable to: "Pascal Users Group," drawn on USA bank in US dollars.

Enclosed please find US $ __ ._ on check number ___

(I have difficulty reading addresses. Please forgive me and type or print clearly)

My address is:

NAME

ADDRESS

PHONE

COMPUTER

DATE

60 Coupons UCSD Pascal System User's Society UCSD p-System User's Society naus

GET MORE FROM YOUR PASCAL SYSTEM .... JOIN USUS TODAY

USUS is the USER'S GROUP for the most widely used, machine-independent software system. If you use UCSD Pascal*, Apple Pascal** orthe UCSD p-System, USUS wililink you with a community of users that share your interests. USUS was formed to give users an opportunity to promote and influence the development of UCSD Pascal and the UCSD p-System and to help them learn more about their systems. USUS is non­ profit and vendor-independent.

Members get access to the latest UCSD p-System information and to extensive Pascal expertise. In USUS, you have formal and informal opportunities to communicate with and learn from other users via:

• NATIONAL MEETINGS • SOFTWARE LIBRARY • USUS NEWS AND REPORT • SPECIAL INTEREST GROUPS • ELECTRON IC MAl L

'UCSD Pascal and the UCSD p-System are trademarks of 1he Regents of the University of California . •___ • ______··App.'.:!~~~~~!...~~.~~:!:..?~.:.!'g;~.~?~E..:'..~:!.:• .!..~:: __ ... ____ .. __• __ • __ •• _. ______•

USUS MEMBERSHIP APPLICATION (Please complete both stdes)

I am applying for $25 individual membership $500 organization membership $ __ air mail service surcharge

Rates are for 12 months and cover surface mailing of the newsletter. If you reside outside North America. air mail service is available for a surcharge. It is as follows: $5.00 annually for those in the Caribbean. Central America and Columbia and Venezuela; $1 0.00 annually for those in South America, Turkey and North Africa; and $15.00 for all others. Check or money order should be drawn on a U. S. bank or U.S. office.

Name/Title Affiliation Address ______

Phone \-( ___. ______TWX/Telex

Option: Do not print my phone number in USUS rosters Option: Print only my name and country on USUS rosters Option: Do not release my name on mailing lists

Coupons 61 UCSD Pascal System User's Society UCSD p-System User's Society us na

GET MORE FROM YOUR PASCAL SYSTEM .... JOIN USUS TODAY

USUS is the USER'S GROUP for the most widely used, machine-independent software system. If you use UCSD Pascal*, Apple Pascal** or the UCSD p-System, USUS will link you with a community of users that share your interests. USUS was formed to give users an opportunity to promote and influence the development of UCSD Pascal and the UCSO p-System and to help them learn more about their systems. USUS is non­ profit and vendor-independent.

Members get access to the latest UCSD p-System information and to extensive Pascal expertise. In USUS, you have formal and Informal opportunities to communicate with and learn from other users via:

• NATIONAL MEETINGS • SOFTWARE LIBRARY • USUS NEWS AND REPORT • SPECIAL INTEREST GROUPS • ELECTRON IC MAl L

'UCSD Pascal and Ihe UCSD p·System are trademarks of the Regents of the Un,vers,ty of California. "Apple Pascal IS a trademark of Apple Computer Inc ._------.__ .. _._. __ ...... _... _...... -...... _.. ------_ ...... __ ...... -.. -----_.... -.... _- .. _------_ .. _----_ .. _-_ .. -

USUS MEMBERSHIP APPLICATION (Please complete both sides)

I am applying for $25 individual membership $500 organization membership $ __ air mail service surcharge

Rates are for 12 months and cover surface mailing of the newsletter. If you reside outside North America. air mail service is available for a surcharge. It is as follows: $5.00 annually for those in the Caribbean, Central America and Columbia and Venezuela; $1 0.00 annually for those in South America, Turkey and North Africa; and$1 5.00 for all others. Check or money order should be drawn on a U. S. bank or U.S. office.

Name/Title

Afti I iation Address ______

Phone (\-______-______TWX/Telex

Option: Do not print my phone number in USUS rosters Option: Print only my name and country In USUS rosters Option: Do not release my name on mailing lists

62 Coupons Membership July 1983 Pascal News 2903 Huntington Road Cleveland, Ohio 44120

Please enter my o New or o Renew

membership in Pascal Users Group. I understand I will receive "Pascal News" whenever it is published in this calendar year.

Pascal News should be mailed 1 yr. 0 in USA $25 o outside USA $35 o AirMail anywhere $60 3 yr. 0 in USA $50 o outside USA $80 o AirMail anywhere $125 (Make checks payable to: "Pascal Users Group," drawn on USA bank in US dollars)

Enclosed please find US $ __. on check number ___

(Invoice will be sent on receipt of purchase or­ ders. Payment must be received before news­ letter will be sent. Purchase orders will be billed $10 for additional work.)

(I have difficulty reading addresses. Please forgive me and type or print clearly.) My address is:

NAME

ADDRESS

PHONE

COMPUTER

DATE

o This is an address correction here is myoid address label:

Coupons 63 JOINING PASCAL USER GROUP?

• 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"). • When you join PUG any time within a year: January 1 to December 31, you will receive all issues Pascal News for that year. • We produce Pascal News as a means toward the end of promoting Pascal and communicating news of events surrounding Pascal to persons interested in Pascal. We are simply interested in the news ourselves and prefer to share it through Pascal News. We desire to minimize paperwork, because we have other work to do.

RENEWING?

• Please renew early (before November) 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.

ORDERING BACK ISSUES OR EXTRA ISSUES?

• Our unusual policy of automatically sending all issues of Pascal News to anyone who joins within a year means that we eliminate many requests for back issues 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 out of print. • Issues 9 .. 12, 13 .. 16, & 17 .. 20, 21 .. 23 are available from PUG(USA) all for $25.00 a set. • Extra single copies of new issues (current academic year) are: $10 each - PUG(USA).

SENDING MATERIAL FOR PUBLICATION?

• Your experiences with Pascal (teaching and otherwise), ideas, letters, opinions, notices, news, articles, con­ ference announcements, reports, implementation information, applications, etc. are welcome. Please send material single-spaced and in camera-ready (use a dark ribbon and lines 15.5 cm. wide) form. • All letters will be printed unless they contain a request to the contrary.

64 Coupons Facts about Pascal, THE PROGRAMMING LANGUAGE:

Pascal is a small, practical, and general-purpose (but not aI/-purpose) programming language possessing algorithmic and data structures to aid systematic programming. Pascal was intended to be easy to learn and read by humans, and efficient to translate by computers.

Pascal has met these goals and is being used successfully for:

• teaching programming concepts • developing reliable "production" software • implementing software efficiently on today's machines • writing portable software

Pascal implementations exist for more than 105 different computer systems, and this number increases every month. The "Implementation Notes" section of Pascal News describes how to obtain them.

The standard reference ISO 7185 tutorial manual for Pascal is:

Pascal- User Manual and Report (Second, study edition) by Kathleen Jensen and Niklaus Wirth. 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 named after the mathematician and religious fanatic Blaise Pascal (1623-1662). Pascal is not an acronym.

Remember, Pascal User's Group is each individual member's group. We currently have more than 3500 active members in more than 41 countries. Return to: BULK RATE U.s. POSTAGE PAID WILLOUGHBY, OHIO Pascal News Permit No. 58 2903 Huntington Rd .• Cleveland, Ohio 44120 Return postage guaranteed Address Correction requested

This is your last issue if you have not renewed for 1983!