Data General Extended Algol 60 Compiler
Total Page:16
File Type:pdf, Size:1020Kb
DATA GENERAL EXTENDED ALGOL 60 COMPILER, Data General's Extended ALGOL is a powerful language tial I/O with optional formatting. These extensions comple which allows systems programmers to develop programs ment the basic structure of ALGOL and significantly in on mini computers that would otherwise require the use of crease the convenience of ALGOL programming without much larger, more expensive computers. No other mini making the language unwieldy. computer offers a language with the programming features and general applicability of Data General's Extended FEATURES OF DATA GENERAL'S EXTENDED ALGOL Character strings are implemented as an extended data ALGOL. type to allow easy manipulation of character data. The ALGOL 60 is the most widely used language for describ program may, for example, read in character strings, search ing programming algorithms. It has a flexible, generalized, for substrings, replace characters, and maintain character arithmetic organization and a modular, "building block" string tables efficiently. structure that provides clear, easily readable documentation. Multi-precision arithmetic allows up to 60 decimal digits The language is powerful and concise, allowing the systems of precision in integer or floating point calculations. programmer to state algorithms without resorting to "tricks" Device-independent I/O provides for reading and writ to bypass the language. ing in line mode, sequential mode, or random mode.' Free These characteristics of ALGOL are especially important form reading and writing is permitted for all data types, or in the development of working prototype systems. The output can be formatted according to a "picture" of the clear documentation makes it easy for the programmer to output line or lines. recognize and correct program deficiencies and, because of Dynamic conversion of parameter types allows one pro ALGOL's modular structure, the programmer may work gram to process data of several types. Expressions of mixed independently on separate parts of the prototype program. type or precision are allowed. Data General's Extended ALGOL is a full implemen Recursive and reentrant object code is generated by the tation of ALGOL 60: recursive procedures are allowed, Extended ALGOL compiler. This is particularly important array declarations may be any arithmetic expression includ in real-time applications for fast context-switching among ing function calls, and integer labels and conditional ex programs.,,d, pressions may be used. Programs written in standard Dynamic storage allocation frees the programmer ,from ALGOL 60 are completely compatible with Data General's many details of data layout and storage assignment, ',:' Extended ALGO L. N-dimensional arrays may be allocated dynamically' at Data General's Extended ALGOL includes facilities for run time. Subscripts and array bounds in the array declara character manipulation, list processing, arithmetic with tion may be any expression, including function references, up to 60 decimal digits of precision, and random or sequen- negative numbers, and subscripted variables. Copyright © DATA GENERAL CORPORATION 1971 Direct addressing capabilities are provided by drawing class declaration. The storage classes that are declared are upon some of the powerful addressing features of PUI, in own, external, and based. cluding based and pointer variables_ This extended address A based variable is merely a template of a program vari ing capability provides more efficient code and more easily able, used as described in the section on "Extended Address understood source language notation. ing." own and external variables are held in storage through Subscripted labels provide for direct branching to a given out an ALGOL program, instead of being dynamically label upon evaluation of the subscript expression. stored. Bit manipulation is provided, using logical operators, Some examples of declarations are: octal and binary literals, and built-in functions. Character- istic Example Description Named constants may be explicitly declared to aid pro Data Type integer I, J; and J have integer nu gram readability and to simplify program modification. meric values. Condition signalling allows the programmer to set condi real K; K has a real numeric tions for interrupting normal execution and switching to value. an interrupt procedure. complex C; C has a complex numer Object code optimization is performed for efficient regis ic value. ter usage, in-line generation of literals, sub-expression elimi boolean done; done has a value true nation, optimal use of machine instructions, and efficient or false. storage allocation. A commented assembly listing is pro pointer P; P has an address as a vided. value. Straightforward subprogram linkage conventions, which string measure; measure can contain up are well documented, simplify interfacing to assembly lan to 32 characters. guage subprograms. Shape real array MAT is a 5x5 floating Explicit diagnostics aid debugging at the source level. MAT[0:4,1 :5]; point array whose first Compatibility with the Data General symbolic debugger element is MAT [0,1] aids run-time debugging. and last element is MAT [4,5]. ELEMENTS OF EXTENDED ALGOL string procedure X is a function that re Declarations X(a,b); turns a string value. Its A wide range of characteristics is possible for ALGOL formal parameters are a program variables, making them easily adaptable to specific and b. usages. Each program variable has the characteristics of Storage Class based integer I ,J; I and J are template shape, size, data type, and storage class. variables. For each program variable a declaration of desired char own real K; K has a value which is acteristics is given. Data type is always declared. Other char preserved between calls. acteristics have default values if not declared. external x is a separately com procedure x; piled procedure. The data types are integer, real, complex, boolean, pointer, string, and label. Data types can be converted to Precision real (9) array each of the 8 elements other data types, provided that the shape, size, and storage RAY [7]; of RAY has 9 word class are compatible. I nteger, real, boolean and pointer data precision. can be converted to and from strings. string (2000) s; s can have up to 2000 The shape of a program variable is scalar, array, literal, characters. switCh, procedure or operator. Scalar is the default shape of Statements a variable. If another shape is to be used, the shape must be Statements define program action. I n ALGa L, there are defined in a declaration. relatively few different types of statements, but each type The precision of a program variable represents size in is extremely flexible. For example, the basic assignment words for numeric data (from one to 15 words) and maxi statement resembles that of most compiler languages: mum number of characters for string data (maximum of V := expression; 16,283 characters). Precision is only declared for numeric and string data. Other data types have a fixed length for all The expression on the righthand side of the assignment cases. symbol is evaluated, converted if necessary to the data type of variable V, and assigned to variable V. Most ALGOL program variables are allocated and freed dynamically on entry and exit from a portion of the pro However, the programmer could have written: gram, called a block. Such variables do not need a storage CHAR := A := V := expression; 2 I n this case, the expression is evaluated and assigned to each Expressions of the variables V, A, and CHAR, and, in each case, the ex An expression is a rule for computing a value. In Ex pression is converted to the data type of the location, each tended ALGOL, this rule may result in a value which is of which might have a different data type. If the expression numeric, a character string, the address of a computer word, evaluates to a real number, it might simply be assigned to a label, or a truth value. Expressions may contain variables real V, then truncated and assigned to integer A, and con of various precisions and data types; code will be generated verted to string format and assigned to string CHAR. to convert variables to a common type and precision when The general forms of ALGOL statements are shown be ever necessary. For example, a real number could be multi low with some examples. In the statement formats follow plied by a character string which contained the ASCII repre ing, X is an expression, V is a variable, and S is a statement, sentation of a number. The number in the string would be compound statement, or block. converted to type real at execution time. Similarly, a sub script or for statement variable could be a real, string or Statement Format Description integer variable. Expressions can also be used as values for V: = X" ... , Xn do S; Statements providing loops passed on procedure calls, and as the dynamic dimensions of an array. for V: = X, step X2 until X3 do S; for V: = X, while X2 do S; Examples Description cos (y + Z X 3) Simple expressions. Variables V: = X; Assignment of expression to (a - 3/y + vu t 8) y, Z, a and vu may be integers, variable(s) . reals, or strings. x[sin(n X pi/21. 0[3, n, 4]] Subscript expressions. The if X then S; Conditional statements. subscripts of the 2-dimension if X then S, else S2; X is boolean expression. al array x are the result of go to X; Unconditional transfer, X is a the function sine and an ele label expression or label. ment of the 3-dimensional array O. NAME; Call to a procedure NAME. NAME (X" X2, ... , Xn); Each X is a parameter. s := prO] := n := n + , + S The value n + , + s is stored in the order n, p[O], s. The type Represents the null statement. of the value will be converted on each step if required.