The Design of the REXX Language
Total Page:16
File Type:pdf, Size:1020Kb
The design of the REXX language by M. F. Cowlishaw One way of classifying computer languagesis by two (consciously or otherwise) to be easy to compile or classes: languages needing skilled programmers, and easy to interpret, it is designed (with the help of personal languages usedby an expanding population of general users. REstructured extended executor feedback from hundreds of users) to be easy to use. (REXX) isa flexible personal language designed with particular attention to feedback from its users. It has Three major factors affect the usability of a language. proved to be effective and easyto use, yet it is suffi- First, the basic concepts of a language affect its ciently general and powerfulto fulfil theneeds of many demanding professional applications.REXX is system syntax, grammar, and consistency. Second, the his- and hardware independent,so that it has been possi- tory and development of a language determine its ble to integrate it experimentally into several operating function, usability, and completeness. Third, but systems. Here REXX isused for such purposes as com- quite independently, the implementation of a lan- mand and macro programming, prototyping, educa- guage affects its acceptability, portability, and distri- tion, and personal programming. This paper introduces REXX and describes the basic design principles that bution. This paper introduces REXX and then dis- were followed in developingit. cusses basic concepts and developmental history as applied to the design of the REXX language. There are several experimental implementations of the REXX language within IBM for both large and small machines. One of these, by the author, has omputer languages may be classified in many become a part of the Virtual Machine/System Prod- ways. One way, for example, is to divide them C uct (VMISP), as the System Product Interpreter for into two usability classes: those for data processing the Conversational Monitor System (CMS). The most professionals and those for the rest ofthe users. Most complete published documentation of the language languages currently available(such as FORTRAN, may be found in Reference 1. COBOL, and c) have been designedas tools for profes- sionals and require a significant amount of training before they can be used effectively. A few languages What kind of language is REXX? (notably BASIC and LOGO) have been designed with REXX is a new language that allows programs and more general users in mind. As a result, these lan- algorithms to be written in a clear and structured guages have found wide application in the field of way. Its primary design goal was that it should be personal computers. BASIC especially is widely used, genuinely easyto use both by computer professionals but it was originally designed for simpler applica- and by the more casual general users. A language tions. The popularity of BASIC continues, and there that is designed to be easy to use must be adept at have been many attempts to improve its structure and syntax. This has resulted in many different dia- Copyright 1984by International Business Machines Corporation. lects of the language. Copyingin printed form for private use ispermitted without payment of royalty provided that (1) each reproduction is done REstructured extended executor (REXX) is a new without alteration and(2) the Journal reference and IBM copyright language designed for the general user yet suitable notice are included on the first page. The title and abstract, butno other portions, of this paper may be copied or distributed royalty for many professional applications. REXX borrows freewithout further permission by computer-based and other significantly from earlier languages, but it differs in information-servicesystems. Permission to republish anyother one fundamental respect. Instead of being designed portion of this paper must be obtained from the Editor. 326 COWLISHAW IBM SYSTEMS JOURNAL, VOL 23. NO 4, 1984 manipulating the kinds of symbolic objects that peo- Within IBM, many REXX EXECS for the Conversational ple normally deal with: words, numbers, names, and Monitor System (CMS) have been written. Many of so on. Most of the features in REXX are included to these EXECS embody hundreds and even thousands make this kind of symbolic manipulation easy. REXX of lines. Product models consisting of over 20 000 is also designed to be highly system independent, but lines of REXX have been reported, and at least one it has the capability of issuing both commands and IBM location now reports applications involving over conventional interlanguage calls to its host environ- one million lines of code written in REXX.’~ ment. Macros. Many applications are programmable by The REXX language structure covers several applica- means of macros. In the dataprocessing world,there tion areas that traditionally have been serviced by is a different macro language for almost every type fundamentally different types of programming lan- of application. There are macro languages for edi- guage. tors, assemblers, interactive systems, text processors, and, of course, for other languages. The work of Personal programming. REXX provides considerable Stephen~on’~and others has highlighted similarities function with powerful character and mathematical between these applications and the need for a com- abilities in a simple framework. Short programs may mon language. Because REXX is essentially a charac- ter-manipulation language, it can provide the macro facility for all these applications. Macro languages often have unusual qualities and syntax that restrict their use to skilled programmers. REXX has a more conventional syntax. It is also a Command program interpretersare flexible language.Thus, it allows the same jobs tobe increasing in importance in modern done in less time by less skilled personnel. operating systems. Prototyping. The currentinterpreter implementation of REXX can be highly interactive. Therefore, as might be expected, developing programs in REXX is very fast. This productivity advantage, together with the ease of interfacing REXX to system utilities for display and for data input and output, makes the be written with minimum overhead, yetfacilities language verysuitable for modeling applications and exist to allow the writing of robust large programs. products. It has also proved to be useful for setting The language is well suited to interpretation and is up experimental systems for usability and human therefore rather suitable for the applications for factors studies. which such languages as BASIC and LOGO are cur- rently sed.^,^ REXX has proved to be an easy lan- The design of REXX is such that the same language guage to learn and toteach. can be effectively and efficiently used for many dif- ferent applications that would otherwise require the Tailoring user commands. Command program inter- learning of several languages. preters are increasing in importance in modem op- erating systems. Nearly all operating systems include The REXX language some form of EXEC,SHELL, or BAT languages4” In many cases such a language is so embedded into the REXX is a language that is superficially similar to operating system thatit is unlikely to be ofuse earlier languages. However, every aspect of REXX has outside its primary environment, as for example been critically reviewed and usually differs from Mxec.* There is, however, a clear trend toward pro- other languages in ways that make REXX more suited viding command programming languages that are to general users. REXX was designed as an entirely both powerful and capable of more general sage.^"^ new language, without the requirement to be com- REXX cames this principle further by being a lan- patible with any earlier language. This has allowed guage that is designed primarily for generality but important improvements tobe included. The follow- also for suitability as a command programming lan- ing description is intended as anintroduction to the guage. language. Becausemany of the subtleties of REXX are IBM SYSTEMS XXIRNAL. VOL 23, NO 4, 1964 best appreciated with use, the reader is urged to use tion concatenates the string 'Hello' to the variable the language. ANSWER with a blank between them. The blank is here a valid operator that means concatenate with Language summary.The REXX language is composed blank. The string "!" is then directly concatenated to of a rather small number of instructions and options, the result builtup so far. These simpleconcatenation yet it is powerful. Where a desired function is not operators make it very easy to build up strings and built in, it can be added easily by using one of the commands, and these operators may be freely mixed with arithmetic operations. In REXX, any string or symbol may be a number. Numbers are all real numbers and may be specified in exponential notation if desired. An implementa- All the operators act upon stringsof tion may use appropriately efficient internal repre- characters of any length. sentations, of course. The arithmetic operations in REXX are completely defined,so that different imple- mentations must always give the same results. The NUMERICinstruction may be used to select the arbitrary precision of calculations, which, forexam- ple,may calculate with 1000 or more significant several mechanisms for external interfacing. The digits. The same instruction may also be used to set following summary introduces most of the features the fuzz to be used for comparisons, and the expo- of REXX. Full details may befound in Reference 1. nential notation (scientific