THE UNIVERSITY OF MICHIGAN Memorandum 32 AN EXAMPLE DEFINITIONAL FACILITY IN MAD/I Ronald J. Srodawa CONCOMP: Research in Conversational Use of Computers ORA Project 07449 F.H. Westervelt, Director supported by: DEPARTMENT OF DEFESNE ADVANCED RESEARCH PROJECTS AGENCY WASHINGTON, D.C. CONTRACT NO. DA-49-083 OSA-3050 ARPA ORDER NO. 716 administered through: OFFICE OF RESEARCH ADMINISTRATION ANN ARBOR August 1970

Abstract The MAD/I language is a procedure-oriented algebraic language which is a descendant of ALGOL 60 and 7090 MAD, similar in power and scope to PL/I. The MAD/I compiler is implemented using the MAD/I facility, a flexible translator-building system whose dynamic nature allows compilers to be extended during the compilation process. This paper demonstrates the extension of MAD/I to include several graphics-oriented statements and operators through a lucid example. iii

1. INTRODUCTION The MAD/I project of the University of Michigan has designed and implemented a flexible translator-building system called the MAD/I facility. The facility provides services to aid in the lexical and syntactic scanning [3] of the program, storage allocation, and object-code generation. A compiler is written in the facility as a set of procedures, called a macro, to which is control passed at various times by the syntactic scanner and by the contents of the intermediate storage of the partially compiled programs. New macros can be redefined while a compiler is executing, thus making extensions to the compiler (and hence to the language) possible. A compiler, called the MAD/I compiler, has been implemented using the MAD/I facility. The language accepted by the MAD/I compiler is called the MAD/I language [1]. The MAD/I language is a procedure-oriented algebraic language which is a descendant of ALGOL 60 and 7090 MAD, similar in power and scope to PL/I. Because the MAD/I compiler is written in the MAD/I facility, there is a great potential for extensibility features within the MAD/I language. To date, no extension facilities have been designed for the MAD/I language; that is properly a goal of further research. This report presents an example definitional facility in the MAD/I language. A simple list-processing program is written in the MAD/I language as extended to include three 1

2 new modes, three new statements, and eight new operators. These extensions are written using the macro language of the MAD/I facility and two experimental definitional statements. These definitional statements, or similar ones determined to be more appropriate, could easily be incorporated as a part of the MAD/I language. For the moment, they also are defined at compile-time. The remainder of this report explains in detail the simple program and the code necessary to define the language extensions. This explanation references the computer output which appears at the end of the report. This output consists of six parts: (1) a listing of the contents of the file SKETCH which is the sample MAD/I program, (2) a listing of the contents of the DISPLAYDEF which defines the extensions fo the MAD/I language, (3) a listing of the contents of the file DEFFACILITY which defines the two experimental statements, (4) a listing of the contents of the file -DATA which contains the data used in the run of Step (6), (5) the compilation of the MAD/I program, and (6) the run of the generated object program using the data of Step (4). The object-code listing of the compilation has been removed to reduce the bulk of the report.

3 2. SKETCH The file SKETCH contains the sample MAD/I program. This program maintains a simple list structure representing points, lines, and collections of points called pictures. The list structure can be manipulated or printed through several commands which are recognized by the program. These commands are: POINT which adds a point to the list structure. The user is prompted for the x and y coordinates of the point. The point is assigned an internal display number which is used to reference the point in other commands. LINE which adds a line to the list structure. The user is prompted for the internal display numbers of the two endpoints of the line. The line is defined in terms of its endpoints and will be moved appropriately if its endpoints are moved. PICTURE which groups several points together into a collection called a picture. The user is prompted for the internal display numbers of the points in the picture. Whenever one point of a picture is translated, all the points in the picture are translated. MOVE which moves a point to new x and y coordinates. The user is prompted for the display number of

4 the point and its new x and y coordinates. If the point is in a picture, all other points in the picture are also translated by the same amount. DISPLAY which prints a display of the current list structure. This program is oriented to standard typewriter terminals, such as teletypes. It could easily be modified to interface to a remote graphics terminal using the display subroutines developed as a part of the CONCOMP Project [2]. Line 1 of SKETCH simply begins a procedure named SKETCH. Line 3 of SKETCH includes the contents of the file DISPLAYDEF which defines the new statements, modes, and operators which will be used in this program. The contents of DISPLAYDEF will be described in the next section. Lines 5 through 13 declare the modes of variables used in the program. Note that'POINT','LINE', and'PICTURE' are used as modes in declarations. These have been defined as described for line 3 above. Line 5 causes all variables which are not explicitly declared to receive the default mode'INTEGER'. Line 15 presets the number of pictures to zero.

5 Lines 18 and 19 prompt the user for the next command from his terminal. The first four characters of the command are stored in the variable COMMAND. Lines 21 through 120 form a compound'IF' statement. The subsection of this statement which corresponds to the command entered is given control. Lines 22 through 29 are invoked by the POINT command. Note that line 25 uses the newly defined statement'CREATE POINT' to create a point having the values of X and Y as its coordinates. X and Y, although shown here as simple variables, can be general expreasions. The operator.DISPN., which accesses the internal display number from a point, is used in line 26 to print the display number to the user. Lines 32 through 39 are invoked by the LINE command. The operator.ADROF. used on line 34 converts an internal display number to a'POINTER' to the corresponding list structure item. The operator.EVAL. also used on line 34 sets the storage allocation of a based variable to the value of a variable of'POINTER' mode. In this case P1 and P2 are allocated to the list structure items corresponding to the two endpoints..EVAL. is a built-in MAD/I operator whose name has since been changed to.ALLOC.. The operator.POINT. used

6 in line 35 returns a value of'TRUE' if its operand is a list structure item corresponding to a point;'FALSE' otherwise. Note that line 36 uses the new statement'CREATE LINE' to create the line whose endpoints are P1 and P2. Lines 42 through 57 are invoked by the PICTURE command. PICTURE is an array of up to 100 pictures, each element being the head of a linked ring of points in the picture. PICTUREN is the number of pictures allocated thus far. Lines 43 through 47 increment the number of pictures thus far, test to see that less than 100 pictures have been formed, and initialize the current picture to the empty set. The O.AS. ('POINTER') of line 47 is the empty picture constant and would better have been written O.AS.('PICTURE'). As we will see later,'PICTURE' has been defined as a synonym for'POINTER' which explains why the former case works. Lines 48 through 55 are executed once for each point in the picture. Lines 50 and 51 access the list structure item corresponding to the next point to be coded to the picture and test that is a point. Lines 52 through 54 insert the point into the picture using the'CONNECT' statement. A restriction in the implementation of our experinental define statement facility prevents us from rewriting these three statements as the one statement'CONNECT' P1'TO' PICTURE(PICTUREN)

7 Lines 60 through 75 are invoked by the MOVE command. Line 64 computes the difference between the new coordinates of the point and the old coordinates of the point. The two operators.XOF. and.YOF. access the x and y coordinates respectively of a point. Line 65 modifies the coordinates of the point to their new values. Note that.XOF. and.YOF. can be used on the left-hand side of an assignment as they return a reference. Lines 66 and 67 test if the point is a member of a picture. If the point is in a picture, line 68 accesses the next point in the picture, and lines 69 through 73 are executed for each point in the picture until we return to the original point. The.NEXT. operator returns a'POINTER' result which points to the list structure item representing the next point in the same picture as its operand. Lines 77 through 116 are invoked by the DISPLAY command. This code runs through the entire list structure and generates points and lines as sets of asterisks in the array DISPLAY. This array is then printed to give a visual depiction of the display on a typewriter-like terminal. Note that the variable HEAD referenced in line 83 is a'POINTER' to the first item in the list-structure. The operator.HEAD. referenced in line 109 returns a'POINTER' to the

8 list structure element which follows its operand. This operator is used to traverse the list structure. Line 119 is invoked if the command was not recognizable based on its first four characters. Line 122 transfers control back to line 18 where the user is prompted for the next command. The remainder of the program consists of two small procedures for computing the minimum and maximum of two values.

9 3. DISPLAYDEF The file DISPLAYDEF contains the definitions for the extensions to the MAD/I language used in the preceding program. In actual practice, packages of definitions such as this would be written and used in programs much as subroutines are written and used in programs at present. Generally useful definitional packages would be provided by system programmers for general use just as subroutine libraries are now provided. Lines 18 through 20 define the mode'POINT' which is simply a synonym for a based component structure. The components are used as described in lines 11 through 16. Lines 35 through 37 define the mode'LINE' which is simply a synonym for a based component structure. The components are used as described in lines 28 through 33. Line 43 defines the new mode'PICTURE' which is simply a synonym for'POINTER'. Lines 48 through 52 declare and preset the variables which are used by the various statements and operators of the definitional package. Line 56 includes the contents of the file DEFFACILITY which defines the two experimental definitional statements which are used below. The contents of DEFFACILITY will be described in the next section.

10 Lines 64 through 74 define the statement'CREATE POINT' using the experimental definitional statement'DEFINE STATEMENT' The'DEFINE STATEMENT' facility allows a new statement to be defined in terms of other MAD/I statements. The'CREATE POINT' statement consists of the keyword'CREATE POINT' followed by three expressions which correspond toc the identifiers POINT, X, and Y. These three expressions will be evaluated. Then the MAD/I statements in the definition will be executed, with the results of the three expressions being substituted for each occurrence of POINT, X, and Y. Line 65 allocates a block of storage to the expression corresponding to POINT, which must be a reference to a variable of'POINT' mode. Line 66 and 68 insert this new point into the chain of all items in the list structure. Line 68 initializes the point as not being an element of any picture. Lines 69 and 70 assign the next internal display number to this point. In an application using a remote display this would be an identification number for the element in the remote display program so that light-pen detects could be mapped back to the data structure in the machine in which this program is running. Line 71

11 sets the display item type to 1, indicating that this is a point. Lines 72 and 73 set the x and y coordinates of the point. Lines 82 through 92 define the statement'CREATE LINE'. This definition is similar to that used to define the'CREATE POINT' statement above and won't be discussed further. Line 100 defines the keyword'TO' to be syntactically equivalent to the comma (,). This will allow us to write'CONNECT' A'TO' B rather than'CONNECT' A,B. Note that this definition is done using the experimental'DECLARE SYNTACTIC CLASS' statement. Lines 101 through 111 define the'CONNECT' statement. This definition is also made using the experimental definitional statement'DEFINE STATEMENT'. Lines 104 and 105 are executed if the second point is already a member of a picture. In this case the new point is inserted into the existing ring. Lines 116 through 124 define the operator.POINT. which returns'TRUE' if its operand is a point,'FALSE' otherwise. This definition is written using the macro language of the MAD/I facility and requires some explanation. If.POINT. A is written we really want to transform that into A(4)=1, a test of whether the type conponent of A is equal to 1. Now.POINT. A will be converted by the

12 syntactic scanner into the triple:.POINT.,%TMP,A where %TMP is an internally generated temporary symbol which represents the result of the operation. Now A(4)=l would be converted by the syntactic scanner into the two triples:.TAG.,%TMP1,A, 4 =,%TMP2,%TMP 1,1 where %TMP2 is the result of the expression. Now, if we define a macro whose name is.POINT., it will be called by the syntactic scanner with two operands, the temporary assigned and the operand. This macro can in turn generate the two triples that A(4)=l would have generated. Line 116 declares.POINT. to be syntactically equivalent to.ABS.; that is, a unary operator with the same left and right precedence values as.ABS.. Line 117 declares to the compiler that what follows are to be considered as statements directed to the MAD/I facility. Lines 118 through 123 define the macro whose name is.POINT. and whose two operands (parameters) are given the names T and B. All identifiers in a macro definition, unless preceded by a %, are different identifiers than those of the same name in the MAD/I program. Likewise, all constants referenced in a macro definition, unless

13 preceded by'LOCAL LITERAL', are self-defining constants rather than literal constants within the MAD/I program. Line 119 declares U to be a local symbol within this macro. This is roughly equivalent to automatic variables in higher-level languages. Line 120 calls the macro TEMPORARY which assigns a temporary symbol and causes U to become a synonym for the temporary. This temporary will be used as the result of the = operator. The macro TEMPORARY is defined in the next section. Line 121 generates the triple.TAG., U,B,4 where U is the temporary result and B is the operand of the.POINT. operator. The'LOCAL LITERAL' keyword is required so that the symbol 4 represents the MAD/I constant value 4 rather than a selfdefining term 4 in the MAD/I facility. Likewise line 122 generates the triple =,T,U,1 where T is the temporary result of the.POINT. operator which has been passed as a parameter and U is the result of the.TAG. operation generated by the preceding line. The LN is necessary preceding the "=" to indicate that this is the MAD/I operator "=" rather than the MAD/I facility

14 operator "=". These two triples generated are the two we have previously discussed as being equivalent to A(4)=l. Line 124 exits from the MAD/I facility. Further lines are interpreted as being a part of the MAD/I program being compiled. Lines 129 through 186 define the operators.XOF.,.YOF.,.NEXT.,.DISPN.,.ENDA.,.ENDB., and.HEAD. in a manner similar to the definition of.POINT. discussed above. In each case the expression involving the operator, say.XOF.A, is to be mapped into an instance of subscription such as A(5). The operators differ only in the value of the subscript used. In each case the triple resulting from the syntactic scanning of the former case,.XOF.,%TMP,A is translated into the triple which would result from the syntactic scanning of the latter case,.TAG.,%TMP,A,5 In each case the operator is declared to be syntactically equivalent to.ABS. through the'DECLARE SYNTACTIC CLASS' statement and is semantically defined through a very simple macro which generates the corresponding.TAG. triple. Lines 196 through 214 define the operator.ADROF. which returns the.POINTER' to the list-structure element

15 which has been assigned the value of its operand as its internal display number. The.ADROF. operator could be represented in MAD/I by lines 190 through 194, However, we have not yet implemented a statement which allows operators to be defined in terms of MAD/I statements. Instead, we have implemented the.ADROF. operator as a macro which generates the same triples as would be generated by the MAD/I statements shown. Line 199 defines Bl and B2 to be local symbols. These will be used for the labels required. Lines 200 and 201 assign temporaries to Tl through T5. Line 202 calls the FLAD macro which assigns two floating addresses and makes Bl and B2 synonyms for these two floating addresses. The macro is defined in the next section. Line 203 is equivalent to the MAD/I statement of line 190. Lines 204 through 207 are equivalent to the MAD/I statement of line 191. Line 204 allocates the floating address Bl to the current value of the instruction location counter. Lines 205 and 206 compute the Boolean expression.DISPN. QQSV = A while line 207 transfers to B2 if the expression result is'TRUE'. Lines 208 and 209 are equivalent to the MAD/I statement of line 192. Line 210 is equivalent to the MAD/I statement of line 193. Lines 211 and 212 are equivalent to the intended effect of the MAD/I statement ~f line 194 which is to return a pointer to QQSV as the result of the operator. Line 211 allocates the floating

16 address B2 to the current value of the instruction location counter while line 212 computes the pointer to QQSV assigning the result to T, the temporary assigned by the syntactic scanner as the result of.ADROF..

17 4. DEFFACILITY The file DEFFACILITY contains the definitions of the'DECLARE SYNTACTIC CLASS' and'DEFINE STATEMENT' statements and the FLAD and TEMPORARY macros. Other macros have also been defined or redefined as required to implement the above. The macros used to define these statements are much more complicated than the macros used in the preceding section and require a detailed knowledge of the MAD/I facility and MAD/I compiler in order to implement them successfully. We stress that users of MAD/I will not be required to learn this detail,as appropriate higher-level definitional statements such as'DECLARE STATEMENT' will be provided for them; only the system programmer assigned to MAD/I need to know these details. Lines 10 through 27 define the'DECLARE SYNTACTIC CLASS' statement. Line 11 causes'DECLARE SYNTACTIC CLASS' to be considered syntactically a keyword which begins a simple statement. The macro named'DECLARE SYNTACTIC CLASS' will be called by the syntactic scanner whenever the keyword is encountered in the MAD/I program. Lines 12 through 26 define the macro'DECLARE SYNTACTIC CLASS'. Lines 14 and 15 scan off the next symbol and insert a pointer to its symbol table entry into the local symbol A. Lines 16 through 19 scan off the next symbol and

18 verify that it is'SAME AS'. Line 20 scans off the next symbol which is the one having the desired syntactic qualities. Lines 21 through 24 set the syntactic attributes in the symbol table entry of the symbol being declared to the same values as on the symbol already having the desired syntactic class. Line 25 scans off the statement terminator so that we are ready to return to the syntactic scanner. Lines 49 through 100 define the statement'DEFINE STATEMENT"'. Lines 52 through 99 define the macro'DEFINE STATEMENT' which is called by the syntactic scanner whenever the keyword'DEFINE STATEMENT' is encountered. This macro scans the entire'DEFINE STATEMENT' statement scope, saving its contents as a list of symbol table pointers. It then creates a macro (lines 81 through 97 ) which has as its name the keyword identifying the statement being defined. This new macro is called by the syntactic scanner whenever its namesake keyword is found in the input stream. It then will call the syntactic scanner once for each expression which is a part of the statement, modify the lexical scanner (GETDSK) to return the symbol table pointers on the list formed above before continuing with

19 the standard input text, and call the syntactic scanner asking it to scan the scope of a compound statement. This scope, of course, consists of the statements which define the new statement saved on the list given to the lexical scanner. Lines 108 through 126 define a macro named GETDSX. This macro will be called instead of the pseudooperation GETDSX, which itself is the entry-point to the lexical scanner. This new macro will normally simply call the pseudo-operation GETDSX to lexically scan for the next symbol in the input stream. However, if it is passed a list of symbol table pointers via the global symbol GTDSXLIST from a macro defining a new statement, it will return the symbols from the list until the list is exhausted. Lines 131 through 144 define the macro FLAD which generates new floating address symbols. This macro is referenced by the.ADROF. macro from the preceding section. Lines 148 through 161 define the macro TEMPORARY which assigns new temporary result symbols. This macro is referenced by several macros in the preceding section. Lines 167 through 223 re-define the macros GETTEMP and FREETEMP to remove deficiencies in their original

2Q implementation in the MAD/I compiler. These macros have since been changed in the compiler SQ that this update is no longer necessary,

21 5. -DATA The file -DATA contains the data presented to the MAD/I program in the run of Section 7. The program is intended to be used from a terminal on a conversational manner. Running the program in batch has required us to anticipate the requests for input and the assignment of internal display numbers. The reader will find it helpful to look at the printed output from the run with this data (Section 7) while reading Section 5. Line 1 requests a display of the current contents of the list-structure. Since the list-structure is empty the comment'NOTHING TO DISPLAY." is printed. Lines 2 through 9 define four points having coordinates (10,10),(10,40),(40,10) and (40,40). These points are assigned internal display numbers 1,2,3, and 4, respectively. Line 10 requests the current list-structure to be displayed, resulting in the first graph showing the four points. Lines 11 through 18 connect the four points with lines forming a square. Line 19 requests the current list-structure to be displayed, resulting in the second graph showing the square.(This looks like a rectange because the horizontal scale is 10 characters/inch while the vertical scale

22 is 6 characters/inch (before reduction)). Lines 20 and 21 move the first point from its original position of (10,10) to the new position (15,20). Since this point is not a member of any picture, it is the only point moved. Line 22 displays the third graph showing the point moved to its new location. Lines 23 through 28 mark the four points as members of the same picture. Lines 29 and 30 move the first point from its current position of (15,20) to the new position (20,20). The second, third, and fourth points are also translated horizontally by five raster units because they are members of the same picture as the first point. Line 31 causes the display of the fourth graph which shows the results of this translation.

23 6. COMPILATION OF THE MAD/I PROGRAM The fifth listing is the printed output resulting from the compilation of the MAD/I program. This output begins with a listing of the source program. Notice that the contents of the files DISPLAYDEF and DEFFACILITY are included at the points where the'INCLUDE' statements are encountered. Following the source program listing is the output of the storage allocation phase, giving the storage allocated to each variable and constant in the program. Following that is a dictionary giving the attributes of each variable and constant. Following that are the external symbol dictionary, relocation dictionary, and statistics for the compilation. The object listing has been left out because of its size (about 40 printed pages).

24 7. RUN OF THE MAD/I PROGRAM The last listing is the printed output resulting from a run of the generated object module. This listing consists of the loading map followed by the printed output from the program. See Section 5 for an annotation of the output from the run.

BIBLIOGRAPHY 1. Bolas, B.J., Springer, A.L., and Srodawa, R.J., The MAD/I Manual, Technical Report 32, Concomp Project, University of Michigan, Ann Arbor, August 1970. 2. Cocanower, A.B., The DF Routines User's Guide, Memorandum 23, Concomp Project, University of Michigan, Ann Arbor, May 1969. 3. Mills, D.L., The Syntactic Structure of MAD/I, Technical Report 7, Concomp Project, University of Michigan, Ann Arbor, June 1968. 25

Appendix A. Contents of File SKETCH $LIST SKETCH 1'PROCE)URE' SKETCH,; 2 3'INCLUDE' "CISPLAYDEF" 4 5'DELLARE' F"URMAL MODE''INTEGER'; 6' DECLARE' COMMAND' CHARACTER'(4); 7'iECLAREt DISPLAY'FIXE) ARRAY'(50,O50)'CHARACrTiR'(1); 8'DECLARE' (POINTP1,P2,P3)'POINT'; 9'DECLARE' L[IN'LINE'; 1C'DECLARE' PICTURE'FIXED ARRAY' (100)'PICTURE'; 11'DFCLARE' QQ1'POINTER'; 12' ECL.ARE' I2' PUINTER'; 13'DbCLARE' (MM1,M2)'FLOATING'; 14 15'PRESET' PICTUREN:= 0; 16 17 18 SKETCH:' wRITE', "'OENTER A COMMAND PLEASE.'*"; 19'READ', "C4.4*", COMMAND; 20^ 21'IF' COMMAND = "POIN"; 22' IRITE', "' ENTER X AND Y COORDINATES:'*"; 23'READ', "21*", XY; 24'IF' 1 <= X & 50 >= X & 1 <= Y & 50 >= Y; 25'CREATE POINT' POINT,X,Y; 26'WRITE',' ASSIGNED DISPLAY NUMBER',H14*",.DISPN. PuINT; 27'ELSE'; 28'WRITE', "' POINT IS OUTSIDE RASTER RANGE'*"; 29'END'; 30 31'OR IF' COMMAND = "LINE"; 32'WRITE', "' ENTER DISPLAY NUMBERS FOR ENDl-PJINITS;:'"; 33'READ', "2I*", X,Y; 34 P1 EVAL. AOCROF. X; P2.EVAL..ADRUE. Y; 35'IF".PUINT. P1 &.POINT. P2; 36'CREATE LINE' LINE,P1,P2; 37'ELSE'; 36 NOTPOINT:'WRITE', "' THCSE ARE NCT POINTS.'*"; 39'END'; 4C 41'OR IF' COMMAND = "PICT"; 42'^RITE', "' ENTER DISPLAY NUMBERS FOR ALL POINTS.'*"; 43 PICTUREN:= PICTUREN+1; 44'IF' PICTUREN > 10C; 45'WRITE', "' TOO MANY PICTURES.'*"; 46'ELSE'; 47 PICTURE(PICTUREN):= 0.AS. ('PC INTER'); 48 PICTA:'READ, "I *", X; 49' IF' X-'=; 50 P1.EVAL..ADROF. X; 51'IF' -.PCINT. P1,'(;C TC' NOTPOINT; 52 Q))2:= PICTURE(PICTUREN); 53'CCNNECT' P1'TUI' 02; 54 P1CTURE( ICTlJUEN ):= QQ2; 55'GO TO' PICTA; 56'END' 57'END'; 58 A-i

A-2 59'OR IF' COMMAND = "MOVE"; 60'wRITE', "' ENTER DISPLAY NUMBER OF POINT AND NEW X.Y'*"; 61'READ', "3I*", DIS,X,Y; 62 P1.EVAL..AOROF. DIS; 63' IF -..POINT. P1,'GOTO' NOTPOINT; 64 DX:= X-.XF. PI; DY:= Y-.YOF. PI; 65 (.XOF. PI):=.XUF. P1+DX; (.YF. P1):=.YOF. PL+DY; 66 QQ:= Pl(2); 67 IF' QQI.AS. ('INTEGER') -= O; 68 P2.EVAL..NEXT. P1; 69 MOVEA:'IF'.DISPN. P1 -=.DISPN. P2; 70 (.XOF. P2):=.XOF. P2*DX; (.YOF. P2):=.YOF. P2 71 +DY; 72 P2.EVAL..NEXT. P2; 73'GO TO' MCVEA; 74' "END' 75'END'; 76 77'OR IF' COMMAND = "DISP"; 78'IF' hEAD.AS. ('INTEGER ) = 0; 79'WRITE', "' NCTHING TO DISPLAY. *"; 80'GO TU' SKETCH; 81'END'; 82'FOR' I:= 1,1,[>50,'FOR' J:= 1,1,J>50, DISPLAY(I,J}:= " 83 PI.EVAL. HEAD; 84 DISPA:; 85'IFs.POINT. P1; 86 Q1:=.XUF. P; Q2:=.YOF. P1; DISPLAY(Q2,Ql):= "o"; 87'ELSE'; 88 LINE.EVAL. (.PT. P1); 89 QQ1:=.ENDA. LINE; P2.EVAL. QQI; 9C QQl:=.ENDB. LINE; P3.EVAL. QQ1; 91 X:= MIN.(.XOF P2,.XOF. P3); 92 X:= MAX. (XOF. P2,.XOF. P3); 93 IF' XI = X2; 94 YI:= MIN.(.YOF. P2,.YOF. P3); S5 Y2:= MAX.(.YUF, P2,.YOF. P3); 96'FOR' Y:= Y1l,1 Y > Y2 DISPLAY(YtXL):= "*'; 97'ELSE'; 98 Ml:=.YCF. P3 -.YF. P2; 99 M2:=.XOF. P3 -.XJF. P2; 100 M:= M1/M2; 101'FOR' X:= Xll,X > X2; 102 Q2: M(X -.XOF. P2) +.YOF. P2; 103 DISPLAY(Q2,X):= * 105'END'; 10b'END'; 107 QQ1:=.HEAD. PI; 108'IF' QQ1.AS. ('INTEGER') "-= 0; 109 PI.EVAL..I-EAU. P1; 110'GO TO'.DISPA; 111'END'; 112'WRITE', "'l.',lO(.'}*"; 113'FOR':= 50,-1, I < 1, 114'WRITE', "13,52C1.1*", I," ",".", 115 DISPLAY(I, 1)...DISPLAY(,50); 116'WRITE','.',1(.)*; 117 118'ELSE';

A-3 119'WRITE', "' ILLEGAL COMMAND'*1"; 120'END'; 121 122'GO TO' SKETCH; 123 124'PROCEDURE' MIN.(X Y); 125 INTEGER SHORT' (XtY); 126 MIN:'IF" X <= Y,'RETURN' X; 127'RETURN' Y; 128'END'; 129 130'PROCEDURE' MAX.(A,B); 131' INTEGER SHORT' I(Av3); 132 MAX:'IF' A >= B,'RETURN' A; 133'RETURN' B; 134'END'; 135 136'END' END OF FILE

Appendix B. Contents of File DISPLAYDEF IST DISPLAYDEF 1. << 2 DISPLAY DEFINITIONAL PACKAGE 3 4 THE FOLLOWING PARAMETER STAIEMENT DEFINES THE COMPONENT STRUCTURE 5 FOR A POINT. THE USER SIMPLY USES'POINT' AS A MODE NAME IN 6 EITHER A'DECLARE' STATEMENT OR AN ) CCNSTRUCTION. NOTE THAT 7 THE STATEMENT 8'POINT' (VARIABLE LIST) 9 WILL NOT WORK BECAUSE THIS IS SIMPLY A PARAMETRIC SUBSTITUTIGON. 10 THE STRUCTURE UF A POINT IS 11 1 POIN NTE PINTER TO NEXT LIST ITEM 12 2 POINTER POINTER TO NEXT ITEM IN SAME PICTURE 13 3 INTEGER SHORT DISPLAY ITEM NUMBER 14 4 INTEGER SHORT DISPLAY ITEM TYPE (1 FOR A POINT) 15 5 INTEGER SHORT X COORDINATE OF THE POINT 16 6 INTEGER SHORT Y COORDINATE OF THE POINT 17 18'PARAMETER''POINT''EASED''COMPONENT STRUCTURE'I POINTER', 19'POINTER','INTEGER SHORT','INTtGER SHORT','INTEGER SHORT', 20'INTEGER SHORT')'ENDP' 21 << 22 THE FOLLOWING PARAMETER STATEMENT DEFINES THE COMPONENT STRUCTURE 23 FOR A LINE. THE USER SIMPLY USES'LINE' AS A MUOD NAME IN E ITHER A 24'CECLARE' STATEMENT OR AN & CONSTRUCTION. NOTE THAT THE STATEMENT 25'LINE' (VARIABLE LIST) 26 WILL NOT WORK BECAUSE THIS IS SIMPLY A PARAMETRIC SUBSTITUITIUN. 27 THE STRUCTURE OF A LINE IS 28 1 POINTER POINTER TO THE NEXT LIST ITEM 29 2 POINTER POINTER TO THE NEXT ITEM IN THE PICTURE 30 3 INTEGER SHORT DISPLAY ITEM NUMBER 31 4 INTEGER SHORT DISPLAY ITEM TYPE (2 FOR A LINE) 32 5 POINTER POINTER TO FIRST END-POINT 33 6 POINTER POITER R O SECOND END-POINT 34 >> 35'PARAMETER''LINE''BASED''COMPONENT STRUCTURE'('POINTER', 36'POINTER'' INTEGER SHORT','INTEGER SHORT', POINTER', 37'POINTER')'ENDP' 38 << 39 THE FOLLOWING PARAMETER STATEMENT DEFINES THE MODE OF A PICTURE. 40 A PICTURE IS A POINTER TO ONE OF THE ITEMS IN THE PICTURE. HENCE 41 IT IS SIMPLY PARAMETERIZED TO'POINTER' MODE. 42 >> 43'PARAMETER''PICTURE''POINTER' *ENDP' 44 << 45 THE FOLLOWING STATEMENTS DEFINE THE GLOBAL VARIABLES USED BY 46 THE DEFINITION PACKAGE. 47 >> 48'DECLARE' DISPLAYN'INTEGER SHORT'; 49'PRESET' DISPLAYN:= 0; 50'DECLARE' QQSV'POINT'; 51'DECLARE' HEAD'POINTER'; 52'PRESET" HEAD:= 0; 53 << 54 THE FULLOWING BRINGS IN THE DEFINE FACILITY FROM THE FILE DEFFACILITY 55 >> 56'INCLUDE'' DEFFACIL TY " 57 (< 58 THE FCLLOWING DEFINES ThE STATEMENT B-l

59 60'CREATE POINT' POINT,XY 61 62 WHICH HAS THE EFFECT OF THE LIST OF STATEMENTS SHOWN 63 >> 64'DEFINE STATEMENT''CREATE POINT' POINT,X,Y; 65 "ALLOCATE' POINT; 66 POINT(l):= HEAD; 67 HEAD:= PT. POINT; 68 POINT(2):= (0 AS. ('POINTER) ); 69 DISPLAYN:= DISPLAYN+1; 70 POINT(3) = DISPLAYN; 71 PUINT(4) = 1; 72 POINT(5) = X; 73 POINT(6) = Y; 74'END STATEMENT'; 75 << 76 THE FOLLOWING DEFINES THE STATEMENT 77 78'CREATE LINE' LINEPIP2 79 8C WHICH HAS THE SAME EFFECT AS THE LIST OF STATEMENTS SHOWN 81 >) 82'DEFINE STATEMENT''CREATE LINE' LINE,PlP2; 83'ALLOCATE' LINE; 84 LINE():= HEAD; 85 HEAD:=.PT. LINE; 86 LINE(2) = (0.AS. ('POINTER-))-; 87 DISPLAYN = DISPLAYN+l; 68 LINE(3) = DISPLAYN; 89 LINE(4) = 2; 9C LINE(5):= PT. P1; 91 LINE(6) = PT, P2; 92'END STATEMENT'; 93 << 94 THE FOLLOWING DEFINES THE STATEMENT 95 96'CONNECT' PCINT'TO' PICTURE 97 98 WHICH HAS ThE SAME EFFECT AS THE LIST OF STATEMENT SHOWN 99 >) 100'DECLARE SYNTACTIC CLASS''TO''SAME AS',; 101'DEFINE STATEMENT''CCNNECT' POINT'TO' PICTURE; 102 QQ1:= PICTURE; 103'IF' (QQ1.AS. ('INTEGER')) C; 104 PICTURE:=.PT. POINT; 105 POINT(2):=.PT. POINT; 106'ELSE'; 1C7 QQSV.tVAL. PICTURE; 108 POINT(2) CCSV42); 1C9 QQSV2):= PT. POINT; 110'END'; 111 OEND STATEMENT'; 112 << 113 THE FOLLOWING MACRO DEFINES THE.POINT. OPERATOR AS A PASS UNE MACRO. 114 IT CAUSES.POINT. A TO BE TREATED AS A(4) = 1 115 >> 116'DECLARE SYNTACTIC CLASS'.POINT.'SAME AS'.ABS.; 117'EFINE'; 118 MACRC,.POINT.,T B; B-2

1 19 LOCALU; 120 TEMPORARYU; 121. TAG.,U9 B 9'LOCALL ITERAL' 4; 122 LN=,T,U,'LGCALLITERAL' 1; 123 MEND,.POINT.; 124 END; 125 << 126 THE FOLLOWING MACRO DEFINES.XOF. AS A PASS ONE OPERATOR. 127 IT CALSES.XOF. A TO BE TREATED AS A(5) 128 >) 129'DECLARE SYNTACTIC CLASS'.XOF.'SAME AS'.ABS.; 130'DEFINE'; 131 MACRG, XUF., T,A; 132.TAG. T, A'LOCALLITERAL 5; 133 MEND,9XOF.; 134 END; 135 << 136 THE FOLLOWING CAUSES.YCF. TO BE DEFINED AS A PASS ONE OPERATOR 137.YOF. A HAS THE SAME EFFECT AS A(6) 138 >> 139'DECLARE SYNTACTIC CLASS'.YOF.'SAME AS'.ABS.; 140'DEFINE'; 141 MACRC.YOF.,T A; 142.TAG.,T,A,'LOCALL[TERAL' 6; 143 MEND,.YOF.; 144 END; 145 << 146 THE FOLLOWING DEFINES.NEXT. A TO BE THE SAME AS A(2) 147 >) 148'DECLARE SYNTACTIC CLASS'.NEXT.'SAME AS'.ABS.; 149'DEFINE'; 150 MACRO,.NEXT.,T,A; 151.TAG.,TA,'LOCALLITERAL' 2; 152 MEND,.NEXT.; 153 END; 154 << 155 THE FOLLOWING DEFINES.OISPN. A TO BE ThE SAME AS A(3) 156 >> 157'DECLARE SYNTACTIC CLASS'.DISPN.'SAME AS.AtlS.; 158'DEFINE'; 159 MACRO,.DI SP.,TA; 160.rAG.,T,A,'LOCALLITERAL' 3; 161 MEND,.DISPN.; 162 END; 163'DECLARE SYNTACTIC CLASS'.ENDA.'SAME AS'.ABS.; 164'DEFINE'; 165 MACRO,.ENDA.,T,A; 166.TAG. T A,' LOCALLITERAL' 5; 167 MEND,.ENDA.; 168 END; 169 (< 170 THE FOLLOWING DEFINES.ENDB. A TO BE ThE SAME AS A(6) 171 >> 172'UECLARE SYNTACTIC CLASS'.ENDB.'SAME AS'.ABS.; 173'DEFINE'; 174 MACRO,.ENDB.vTA; 175.TAG. T, A'LOCALLITERAL' 6; 176 MEND,.ENDB.; 177 END; 178 (< B-3

179 THE FOLLOWING DEFINES.HEAD. A TO BE THE SAME AS A(Ul 180 >> 181'DECLARE SYNTACTIC CLASS'.HEAD.'SAME AS'.ABS.; 182'DEFINE'; 183 MACRO,.HEAD.,TA; 184.TAG. T, A'LOCALLITERAL' 1; 185 MEND.HEAD.; 186 END; 187 << 188 THE FOLLOWING DEFINES.ADROF. A TO BE THE SAME AS THE SEQUENCE OF 189 STATEMENTS 19C QQSV.EVAL. HEAD 191 Bl:'IF'.DISPN. QQSV = A,'GO TO' B2 192 QQSV oEVAL. (.HEAD. QQSV) 193'GO TO' B1 194 B2:'RETURN'.PT. QQSV 195 >> 196'DECLARE SYNTACTIC CLASS'.ADROF.'SAME AS'.ABS.; 197'DEFINE'; 198 MACRO, ADRCF., TA; 199 LOCALB1,B2; 200 LGCAL,T,T2 T3 T4,T5; 201 TEMPORARY,T,T2,T3,T4,T5; 202 FLAD,6B1B2; 203. EVAL., T 1,QQSVHEAD; 204 DES, 1; 205.DISPN.T2, QQSV; 206 LN=,T3,T29A; 207 TNLZBi2kT3; 208. HEAD.,T4, QQSV; 2C9.EVAL.,T5,%QQSV,T4; 210 GUTOUB1; 211 DESB2; 212.PT, T QQSV; 213 MEND, ADROF.; 214 END; 215 (< 216 END OF DEFINITIGNAL PACKAGE 217 >> END OF FILE B-4

Appendix C. Contents of File DEFFACILITY LIST DEFFAC[LITY 1 << 2 THE FGLLOWING DEf-INES TF-E NEW SIMPLE STATEMENT 4'DECLARE SYNTACTIC CLASS' A'SAME AS' B 5 6 WHICH GIVES THE SYMbOL A EXACTLY THE SAME SYNTACTIC DEFINITION 7 (CLASS,SYNTACTIC CLASS,LEFT PRECEDENCE,RIGHT PRECEDENCE) AS B. 8 A WILL NOW BE TREATED EXACTLY AS B BY THE SYNTACTIC SCANNER. >)> 10 I'ENE'; <<ESCAPE INTO THE MACRO LANGUAGE>> 11 SETUP,'DECLARE SYNTACTIC CLASS,14,3,4; << SIMPLE KEYW3RJ>> 12 MACRC,'DECLARE SYNTACTIC CLASS'; ((START THE MACRU DEF>> 13 LOCALA; << A IS SAVED IN THIS LOCAL>> 14 GTOSX; < THIS READS A>> 15 SETA,O,DSX; <<SAVE DSX OF A IN LOCAL SYMBUL>> 16. GTDSX; <<NOW READ'SAME AS'>> 17 JMPLOC+3,DSX ='SAMEAS'; <<BE SURE IT REALLY IS'SAMEAS'>> 18 MNOTE,"**** ONLY'SAME AS' IS ALLOWED"; 19 MEXIT; <<LEAVE HIM AT THE MERCY OF JSCAN>> 20 GTDSX; ((READ B>> 21 SET,IND.(A),1,SX1L); <<SET THE CLASS CODE OF A>> 22 SETt1ND.(A),2,DSX(2); S<<SET THE SYNTACTIC CLASS OF A>> 23 SET,IND.<A),3,DSX(31; <<SET THE LEFT PRECEDENCE UF A>> 24 SET, IND.(A),4,DSXK(4); (<SET THE RIGHT PRECEDENCE OF A>> 25 GTDSX; <<READ THE STATEMENT TERMINATOR>> 26 MEND,'DECLARE SYNTACTIC CLASS'; <<ALL DONE>> 27 END; ((BACK INTO MAD/I>> 28 (< 29 THE FOLLOWING DEFINES A SPECIAL PURPOSE DEFINITIONAL FACILITY 30 WHICH ALLOWS THE DEFINITION OF A SIMPLE STATEMENT. THE UEFiNITIONAL 31 STATEMENT IS OF THE FOHR 32 33'DEFINE STATEMENT' KEYWORD LIST OF VARIABLES 34 LIST CF STATEMENTS 35'END STATEMENT' 36 37 THE NEWLY DEFINED STATEMENT HAS THE FORM 38 39 KEYWORD LIST OF EXPRESSIONS 40 41 EACH EXPRESSION WHICH WILL OCCUR IN AN INSTANCE OF THE DEFINED 42 STATEMENT IS REPRESENTED BY A VARIABLE IN THE PROOTOTYPE F THE DEFINE 43 STATEMENT. IN ThE CGDE GENERATED FOR THE STATEMENT THE CODE FOR 44 THE EXPRESSIONS wILL BE CENERATED FIRST, FOLLOWED BY THE CODE FOR THE 4.5 MAD/I STATEMENTS SPECIFIEC IN THE DEFINITION. ALL OCCURENCES OF THt 46 VARIABLES CCRRESPCNDING TO THE EXPRESSIONS ARE REPLACED BY THE 47 RESULT OF THE CORRESPCNCING EXPRESSION. 48 >) 49'DECLARE SYNTACTIC CLASS''DEFINE STATEMENT''SAME AS''DEFINE'; 50'DEFINE'; <(ESCAPE INTO THE METALANGUAGE>> 51 CREATEDEFSTATLABDFSTLBCOOO,PERCLS(IVAL); <<SETS UP CRS>> 52 MACRC,'DEFINE STATEMENT'; 53 LOCAL,KEYWD, VLISTSLIST,NVLIST,IQ; 54 GTDSX; (( GET THE KEYWORD>> 55 SETUP,DSX,14,3,4; ((MAKE IT SIMPLE STATEMENT >> 56 SETKEYWDODSX; <(KEYWD POINTS TO THE KEYWORD>> 57 SETKEYWD9 1 INDCLS(dVAL); ((ANC IT IS INDIRECT>> 58 A: GTDSX; (< GET A VARIABLE NAME>> C-l

C-2 59 JMPBtDSX = LN;; (SEMICOLUN MARKS THE END>> 60 SETLST,VLIST SDSX; ~< PUT THE VARIABLE INTO VLIST>> 61 GTDSX; <( GET THE COMMA OR SEMICOLON>> 62 JMP,A,DSX -= LN;; <<THERE IS ANOTHER VARIABLE>> 63 B: CRS,UEFSTATLAB,NOTINDI(OEFSTATLAB); (< A NEW LIST TO HOLD STM>) 64 SET,SLIST90,DEFSTATLAB; <<SAVE THE LIST NAME>> 65 SETSLISTl,INDCLS(iVAL); (< MAKE IT INDIRECT>> 66 CRSDEFSTATLAB,NOTIN D(DEFSTATLAB); (<UNIQUE SYM FOR HIS VAR>> 67 SETLSTNVLIST,,DEFSTATLAb; <<BUILD A LIST OF THEM>> 68 JMPLOC-2,NVLIST(0) < VLIST(O); <<WANT ONE FOR EACH VARIABLE>> 69 C: GTDSX; <<READ A STATEMENT DSX>> 70 JMP,DDSX ='END STATEMENT'; <(CHECK FUR END OF DEFINITION>> 71 SETtI,0,i; (<NOW CHECK FOR IT IN THE VARIABLES>) 72 JMP,EVLIST(I(O)) DOX; ((JUMP IF FOUND IT>> 73 SETI,0, (0)+1; <<UP THE ANTE>> 74 JMP,LOC-2,I(0) <(= VLISTIO); <<CONTINUE IF STILL MORE VARIABLES>> 75 SETLSTSLIST*#DSX; << ADD HIS DSX TO THE STREAM>> 76 JMPC; << PROCESS THE NEXT DSX>. 77 E: SETNOTIND.(DSX),0,NVLISTI(0 ) <; <<PERFORM THE SUBSTITUTION>> 78 JMPLOC-3; (< AND NOW OC IT TO THIS>> 79 D: SETLSTSLISTt9,END'; ((PUT A'END' ON THE END >> 80 SETLSTSLIST, LN;; << AND FINISH UP WITH A SEMICOLON >> 81 MACRO,KEYWD; <<NOW DEFINE THE MACRO FOR THE KEYWD)> 82 DESIST; 83 SET,I,01; ~<GENERATE AN EXPRESSION SCAN FOR EACH VAR>> 84 JMP,LOC+10,OI(0 > VLIST(O); (< STOP IF END OF LIST~) 85 SETNOTIND. Q),C,NVLIST(I(0 ); <(Q WILL BE THE VARIABLE NAME>> 86 SETNOTIND.(Q),1, INDCLS( iVAL); 87 RESUME; 88 JSCAN,.TAG., LIST; <(SCAN OFF AN EXPRESSION>> 89 SET QtOyEXP.(1); <<MAKE THE VARIABLE THE RESULT>> 90 SETQ,1 INDCLS( VAL); 91 DESIST; 92 SET,1,0, (0)+l; <<UP TO THE NEXT VARIABLE>> 93 JMP,LCC-9; <( AROUND AND AROUND>> 94 RESUME; 95 SETGTDSXLIST,0,SLIST; << REDEFINE GTDSX FOR AWHILE >> 96 BLOCK; << THESE LOOK LIKE SCOPE OF STM>> 97 MENDKEYWD; <<ENO THE GENERATED MACRO>> 98 GTDSX; (< GET OUR SEMICOLON>> 99 MEND,'DEFINE STATEMENT'; 100 END; <<BACK INTO MAD/I>> 101 << 102 THE FOLLOWING REDEFINES THE PSEUDO OP FOR GTDSX. THE NEW GTDSX ACTS 103 EXACTLY LIKE THE OLD DSX EXCEPT THAT IT WILL INSERT THE CONTENTS 104 OF THE LIST POINTED TO BY GTDSXLIST INTO THE INPUT STREAM. THIS 105 ALLOWS A SEQUENCE OF DESCRIPTORS TO BE RETURNED TO JSCAN AS IF THEY 106 CAME FROM THE INPUT STREAM 107 >> 108'DEFINE'; 109 SETPREVGTDSX,0,GTDSX(C); ~< THIS IS NOW THE REAL GTDSX >> 110 SET,PREVGTDSX,1,GTDSX(1); 111 SETGTDSXLIST,;JSIZE,0; (< INITIALIZE GTOSX CHEAT LIST >> 112 SET,GTDSXLISTCO,O; <( USE REAL GTDSX FOR THE TIME BEING >> 113 MACRO,GTDSX; (( NOW REDEFINE GTDSX >> 114 JMP,LCC+3,GTDSXLIST(0) -:= 0; << JUMP IF INSERTIONS TO BE MADE >> 115 PREVGTDSX; <( USE THE OLD-FASHION GTDSX >) 116 MEXIT; 117 SET GTD SXLIST, SI ZbtGTD XL.IST (S IZE )1; << UP THE L IST INDEX >> 118 JMP,LOC5G 9 TDSXLIST SIZE) <( I ND.( <GTDSXL I ST( 0 ) ) ( 0);

C-3 IlS SETGTDSXLIST,SSIZE,0; << LIST PROCESSED SO RESET >> 12C SETGTDSXLIST O,0; 121 GTDSX; << NOW TRY READING AGAIN >> 122 MEXIT; 123 SET,NOTIND.(DSX,0,DSXCF( IND. (GTDSXLIST0)) )(GTSXLISTO(SILE))); 124 SETNUTIND.(DSX),1,INDCLS(O); (< SET UP DSX >> 125 MENCCTDSX; 126 END; 127 << 128 THE FCLLOWING MACRO CREATES A FLOATING ADDRESS CURRESPONDING TO 129 EACH PARAMETER 130 >> 131'DEFINEI; 132 MACRO,FLAD; 133 LOCALI; 134 SETI,0,1; 135 JMP,LOC+2,PAR. (0) >= I(0); 136 MEXIT; 137 CRStFLDNOTIND (FLD); 138 SETvFLDtlNCTIND.(FLD)(@MOD); 139 SET,PR. I C),0,FLD; 140 SET,PAR.l((C)) 1,INDCLS(0); 141 SET, 190,(0i+1; 142 JMP,LCC-7; 143 MEND,FLAD; 144 END; 145 < 146 THE FOLLOWING MACRO CREATES A TEMPCRARY CORRESPONDING TO EACH PARAMETER 147 >> 148 DEFINE'; 149 MACRO9TEMPORARY; 150 LOCALI; 151 SETI,0,1; 152 JMP,LOC+2,PAR. (0 >= 1(0); 153 MEXIT; 154 CRS, TMPNOTINO. TMP); 155 SETTMPl NOTIND,.(TMP)aMOD); 156 SET,PAR.( IC)) OTMP; 157 SET,PARA.( I) ), INDCLS(C); 158 SET,,0, (0)+1; 159 JMP,LCC-7; 160 MENDTEMPORARY; 161 END; 162 << 163 ThE FCLLOWING REDEFINES THE GETTEMP AND FREETEMP MACROS TO 164 GET AROUND THE PRGOLEM CF THE REASSIGNMENT OF THE STORAGE 165 ALLOCATION OF A TEMPORARY. 166 >> 167 "DEFINE'; 168 MACEXCTYPE 7; 169 MACDEFTYPE,2; 17C POPMACROGETTEMPFREETEMP; 171 ATR,< TEMP1,EXTENDED; 1 72 ATR,' TEMP2, LOCAL,20,4; 173 SET,TEMPLST, VAL,0; 174 175 MACROGETTEP, S,MODE,LEN; 176 LOCAL,I,J; 177 JMP,LCC+4,LEN <= 16; 1 7R ERR: MNOTE,"**** GETTEMP CALLED FOR MORE THAN SIXTEEN BYTES.";

C-4 179 DUMPOSXS MCODE,LEN; 180 MEXI T; 181 CLEAR,S; 182 SET, I sVAL,5; 183 SET, J AVAL C; 184 TEST: JMP,DCNE, I > TEMPLST; 185 JMP,LCC+3 vTEMPLST[ I )( aTMP2) — = 0; 166 SETJ,)VALI; 187 JMP,SEARCH; 188 JMPSEARCHTEMPLST (IJ (TtMP2) -= DSXOF (S); 189 GOOD: SET, TEJPLST ( I ), TEMP2,OpDSXOtF S); 190 SET,S,,XA,1; i 91 SETS,tMODE,MOOE(OiMUE); 192 ST T S 9iLE NLEN; 193 SET S, aVALTItMPLST( I; 194 MEXiT; 195 SEARCH: SET, I,)VAL I+,1; 196 JMP,TEST; 19 7 ONE: JMPNO,J = C; 198 SEI, IVAL,J; 19S JMPGOOD; 20C O: APNL)TEMPLST,1,; 201 SETTEMPLSTr VAL 1; 202 SPACE TEMPLST I) I16,8; 203 JMPGOOD; 204 MENUL),ETTEMP; 205 2C 6 MACRGFREETEMP,S; 207 LOCALl; 2C8 RELSYMEB S; 2C9 SET, I VAL 95; 210 JMPNCI > TEMPLST; 211 J'P,GCTITTEMPLST(I ) ( TEfP2) = DSXCF.(S}; 212 SE f I qVAL,1+1; 213 JMPLCC-3; 214 GOTIT: SET,TEMPLST ( I ), TTEMP2,0; 215 NO: SET,S,)VAL,0; 216 SET,S,@XA 1; 217 SETSSIZE,0; 218 SET,S,CLSNdTIND.(TMP)(aMCOD); 219 MtND,FREETEMP; 220 221 MACDEFTYPE, 1; 222 MACEXCTYPE,1; 223 ENC; END CF FILE

Appendix D. Contents of File -DATA $LIST -DATA 1 DISPLAY 2 POINT 3 10 10 4 POINT 5 10 40 6 POINT 7 40 10 8 POINT S. 40 40 10 DISPLAY 11 LINE 12 1 2 13 LINt 14 1 3 15 LINE 16 2 4 17 LINE 18 34 19 DISPLAY 20 MOVE 21 1 15 20 22 DI SPLAY 23 PICTURE 24 1 25 2 26 3 27 4 28 1 29 MOVE 30 1 20 20 31 DISPLAY END OF FILE D-1

Appendix E. Compilation of the MAD/I Program $CREAT SKETCHOBJ FILE ALREALY EXISTS $EMPTY SKETCHOBJ DONE. $RUN *MAUI SCARDS=SKt TCH SPUNCH=SKETCHOBJ PAR=L EXECUTION BEGINS E-1

MAD/I COMPILER OPTION ASSIGNMENTS: SOUKCE DECKtLIST SORMGIN= C019256 B FREEFORMCONTCHAR=+ SOURCETAB=006 S IZE=(0003 0255 ),COMPILE NOMAPNOXREF ATR OPL IST USER NOACDENCA MAO/I COMPILER VERSION AN049-134322. MAD/I COMPILER SOURCE PROGRAM LISTING...... *0001'PROCEDURE' SKETCH.; *0002 *0003'INCLUDE' "DISPLAYDEF" *0004 << *0005 DISPLAY DEF[NITIONAL PACKAGE *0006 *0007 THE FOLLOWING PARAMETER STATEMENT DEFINES THE COMPONENT STRUCTURE *0008 FOR A POINT. THE USER SIMPLY USES'POINT' AS A MODE NAME IN *0-09 EITHER A'DECLARE' STATEMENT OR AN @ CONSTRUCTION. NOTE THAT * 010 THE STATEMENT *0011'POINT' (VARIABLE LIST) *0012 WILL NUT WORK BECAUSE THIS IS SIMPLY A PARAMETRIC SUBSTITUTION. *0013 THE STRUCTURE OF A POINT IS *0014 1 POINTER PCINTER TO NEXT LIST ITEM *0015 2 PCINTER POINTER TO NEXT ITEM IN SAME PICTURE *0016 3 INTEGER SHORT DISPLAY ITEM NUMBER *0017 4 INTEGER SHORT DISPLAY ITEM TYPE (1 FOR A POINT) *0018 5 INTEGER SHORT X COORDINATE OF THE POINT *0019 6 INTEGER SHORT Y COORDINATE OF THE POINT *0020 >> *0021'PARAMETER''POINT''BASED''COMPONENT STRUCTURE'('POINTER', *0022'POINTER',' INTEGER SHORT','INTEGER SHORT', INTEGER SHORT', *0023 INTEGER SHORT')'ENDP' *0024 << *0025 THE FOLLOWING PARAMETER STATEMENT DEFINES THE COMPONENT STRUCTURE *0026 FOR A LINE. THE USER SIMPLY LSES'LINE' AS A MODE NAME IN EITHER A *0027'DECLARE' STATEMENT OR AN a CCNSTRUCTION. NOTE THAT THE STATEMENT *0028'LINE' (VARIABLE LIST) *0029 WILL NOT WORK BECAUSE THIS IS SIMPLY A PARAMETRIC SUBSTITUITION. *0030 THE STRUCTURE OF A LINE IS *0031 1 POINTER POINTER TO THE NEXT LIST ITEM *0032 2 POINTER POINTER TO THE NEXT ITEM IN THE PICTURE *0033 3 INTEGER SHORT DISPLAY ITEM NUMBER *0034 4 INTEGER SHORT DISPLAY ITEM TYPE (2 FOR A LINE) *0035 5 POINTER POINTER TO FIRST END-POINT *0036 6 POINTER POINTER TO SECOND END-POINT *0037 >> *CC038'PARAMETER''LINE''BASED''COMPONENT STRUCTURE'( POINTER', *0039'POINTER','INTEGER SHORT','INTEGER SHORTe,'POINTER', *0040'POINTER')'ENOP *0041 << *0042 THE FOLLOWING PARAMETER STATEMENT DEFINES THE MODE OF A PICTURE. *0043 A PICTURE IS A POINTER TO CNE OF THE ITEMS IN THE PICTURE. HENCE *0044 IT IS SIMPLY PARAMETERIZED TC'POINTER' MODE. *0045 >> *0046'PARAMETER''PICTURE''POINTER''ENDP' *0047 << *0048 THE FOLLOWING STATEMENTS DEFINE THE GLOBAL VARIABLES USED BY *0049 THE DEFINITION PACKAGE. E-2

*0050 >~ *0051'DECLARE' CISPLAYN' INTEGER SHORTI; *0052'PRESET' DISPLAYN:= 0; *0053'DECLARE' QQSV'POINT'; *0054'DECLARE' HEAD'POINTER'; *0055'PRESET' HEAD:= 0; *0056 << *0057 THE FOLLOWING BRINGS IN THE DEFINE FACILITY FROM THE FILE DEFFACILITY *0058 >> *0059'INCLUDE' "DEFFACILITY" *0060 < 0061 THE FOLLOWI[NG DEFINES THE NEW SIMPLE STATEMENT *0062 *0063'DECLARE SYNTACTIC CLASS$ A'SAME AS' B *0064 *0065 WHICH GIVES THE SYMBOL A EXACILY THE SAME SYNTACTIC DEFINITION *0066 (CLASSSYNTACTIC CLASSyLEFT PRECEDENCERIGHT PRECEDENCE) AS B. *0067 A WILL NOW BE TREATED EXACTLY AS B BY THE SYNTACTIC SCANNER. *0068 >> *0069'DEFINE'; (<ESCAPE INTO THE MACRO LANGUAGE>> *0070 SETUP,'DECLARE SYNTACTIC CLASS,14,3,4; << SIMPLE KEYWORD>> *0071 MACRO, DECLARE SYNTACTIC CLASS'; <(START THE MACRO DEF>> *0072 LOCAL A; << A IS SAVED IN THIS LOCAL>> *0073 GTDSX; << THIS READS A>> *0074 SET,A,09DSX; ~SAVE DSX OF A IN LOCAL SYMBOL>> *0075 GTDSX; (<NOW READ'SAME AS'>> *0C76 JMPLOC+3,DSX ='SAMEAS'; <<BE SURE IT REALLY IS'SAMEAS~>> *0077 MNOTE v**** ONLY'SAME AS' IS ALLOWED"; *0078 MEXIT; ~LEAVE HIM AT TFE MERCY OF JSCAN>> *0079 GTDSX; <<READ B>> *0080 SET,IND.(A),1,DSX(1); <SET THE CLASS CODE OF A>> *0081 SETqlND.(A),22,DSX(2); <(SET THE SYNTACTIC CLASS OF A>> *0082 SET,IND.(Ah,3,DSX(3); ~<SET THE LEFT PRECEDENCE OF A)> *0083 SETIND.(A)t4,DSX(4); ~SET THE RIGHT PRECEDENCE OF A>> *0084 GTDSX; <<READ THE STATEMENT TERMINATOR~> *0085 MEND,'DECLARE SYNTACTIC CLASS'; <<ALL DONE>> *0086 END; ~<BACK INTO MAD/I> *0087 << *0088 THE FOLLOWING DEFINES A SPECIAL PURPOSE DEFINITIONAL FACILITY *0089 WHICH ALLOWS THE DEFINITION OF A SIMPLE STATEMENT. THE DEF NITIONAL *0090 STATEMENT IS OF THE FORM *0091 *0092'DEFINE STATEMENT' KEYWORD LIST OF VARIABLES *0093 LIST OF STATEMENTS *0094'END STATEMENT' *0095 *0096 THE NEWLY DEFINED STATEMENT HAS THE FORM *0097 *0098 KEYWORD LIST OF EXPRESSIONS *0099 *0100 EACH EXPRESSION WHIC.k WILL CCCUR IN AN INSTANCE OF THE DEFINED *0101 STATEMENT IS REPRESENTED BY A VARIABLE IN THE PROTOTYPE OF THE DEFINE *0102 STATEMENT. IN THE CCOE GENERATED FOR THE STATEMENT THE CODE FOR *0103 THE EXPRESSIONS hILL BE GENERATED FIRST, FOLLOWED BY THE CODE FOR THE *0104 MAD/I STATEMENTS SPECIFIEC IN THE DEFINITION. ALL OCCURENCES OF THE *0105 VARIABLES CCRRESPONDING TO T-E EXPRESSIONS ARE REPLACED BY THE *0106 RESULT OF THE CORRESPCNDING EXPRESSION. *0107 >> *0108 ODECLARE SYNTACTIC CLASS''DEFINE STATEMENT''SAME AS''DEFINE'; *0109'DEFINE'; ~<ESCAPE INTO THE METALANGUAGE>> E-3

*0110 CREATEDEFSTATLA FSTL BOFOOOPERCLS @VAL); (<SETS UP CRS>> *0111 MACRO, DEFINE STATEMENT6; *0112 LOCAL,KEYkD,VLISTSLISTNVLIST, IQ; *0113 GTDSX; << GET THE KEYWORD>> *0114 SETUP,DSX,14,3,4; <(MAKE IT SIMPLE STATEMENT >> *0115 SET,KEYWD,C,DSX; -<KEYWD POINTS TO THE KEYWORD>> *0116 SETKEYWD1l,INDCLS(hVAL); <<AND IT IS INDIRECT)> *0117 A: GTDSX; << GET A VARIABLE NAME>> *0118 JMP,B,DSX = LN;; <<SEMICOLON MARKS THE END>> *0119 SETLST,VLIST,,DSX; << PUT THE VARIABLE INTO VLIST>> *0120 GTDSX; ~< GET THE COMMA OR SEMICOLON~) *0121 JMPADSX -.= LN;; <<TERE IS ANOTHER VARIABLE>> *0122 8: CRS,DEFSTATLAB,NOTIND.(DEFSTATLAB); << A NEW LIST TO HOLD STM>) *0123 SET,SLIST,0,DEFSTATLAB; <<SAVE THE LIST NAME>> *0124 SET,SLIST,1,INDCLS(@VAL); << MAKE IT INDIRECT>> *0125 CRSDEFSTATLABNOTIND. IDEFSTATLAB); ~<UNIQUE SYM FOR HIS VAR>> *0126 SETLST,NVLIST,,DEFSTATLAB; <<BUILD A LIST OF THEM>> *0127 JMP,LOC-2,NVLIST(lO < VL[ST(O); <<WANT ONE FOR EACH VARIABLE>> *0i28 C: GTDSX; <(READ A STATEMENT DSX>> *0129 JMP,DtDSX ='END STATEMENT'; <<CHECK FOR END OF DEFINITION~) *0130 SETI 0,1; <<NOW CHECK FOR IT IN THE VARIABLES>> *0131 JMP,E,VLIST((0O)) = DSX; <<JUMP IF FOUND IT>> *0132 SET,IO,I(0)+i; <<UP THE ANTE>> *0133 JMPLOC-2,I(0) <= VLIST(O); <(CONTINUE IF STILL MORE VARIA3LES>> *0134 SETLST,SLIST,,DSX; <( ADD HIS DSX TO THE STREAM>) *0135 JMP,C; << PROCESS THE NEXT DSX>> *0136 E: SET,NOTIND.(DSX),0,NVLIST( I(0)); <PERFORM THE SUBSTITUTION>> *0137 JMPLOC-3; << AND NOW 00 IT TO THIS>' *0138 D: SETLST,SLISTv,,ENDO; <<PUT A'ENDO ON THE END >> *0139 SETLST,SLIST,,LN;; << AND FINISH UP WITH A SEMICOLON >> *0140 MACRO,KEYWC; <<NOW DEFINE THE MACRO FOR THE KEYWD)> *0141 DESIST; *0142 SET,I,091; <<GENERATE AN EXPRESSION SCAN FOR EACH VAR>> *0143 JMP,LOC+10,I(0) > VLIST(O); << STOP IF END OF LIST.>> *0144 SETNOTIND.(Q),0,NVLIST1(0O) ); <<Q WILL 8E THE VARIABLE NAME>> *0145 SETvNOTI NO.(Q) 1, NDCLS(iVAL); *0146 RESUME; *0147 JSCAN,.TAG.,LIST; <<SCAN OFF AN EXPRESSION>> *0148 SET,Q,O,EXP.( ); (<MAKE THE VARIABLE THE RESULT>> *0149 SET,Q,1,INCCLS({VAL); *0150 DESIST; *0151 SET,I,0,l(C)+1; ~<UP TO THE NEXT VARIABLE>> *0152 JMPLOC-9; << AROUND AND AROUND>> *0153 RESUME; *0154 SET,GTDSXLIST,0,SLIST; (< REDEFINE GTDSX FOR AWHILE >> *0155 BLOCK; << THESE LOOK LIKE SCOPE OF STM>> *0156 MENDoKEYWD; <<END THE GENERATED MACRO>> *0157 GTDSX; (< GET OUR SEMICOLON>> *0158 MEND, DEFIbE STATEMENT'; *0159 END; <<BACK INTO MAD/I>> *0 160 (( *0161 THE FOLLOWING REDEFINES THE PSEUDO OP FOR GTDSX. THE NEW GTDSX ACTS *0162 EXACTLY LIKE THE OLD DSX EXCEPT THAT IT WILL INSERT THE CONTENTS *0163 OF THE LIST POINTED TO BY GTDSXLIST INTO THE INPUT STREAM. THIS *0164 ALLOWS A SEQUENCE OF DESCRIPTORS TO BE RETURNED TO JSCAN AS IF THEY *0165 CAME FROM THE INPUT STREAM *0166 >> *0167 DEFINE'; *0168 SETPREVGTDSX,0,GTDSX(O; << THIS IS NOW THE REAL GTDSX >> *0169 SETPREVGTDSX,1,GTDSX(1); E-4

*0170 SETGTDSXLIST@,SIZE9; << INITIALIZE GTDSX CHEAT LIST >) *0171 SETGTDSXLIST,t0 0 << USE REAL GTOSX FOR THE TIME BEING >> *0172 MACRO,GTDSX; (< NOW REDEFINE GTDSX >> *0173 JMPtLOC+3,GTDSXLIST(0) -= 0; << JUMP IF INSERTIONS TO BE MADE >> *0174 PREVGTDSX; << USE THE OLD-FASHION GTDSX >> *0175 MEXIT; *0176 SEGT DXLIST,GTDESXLSTGTDSXLIST(@SIZE)+l; << UP THE LIST INDEX >> *0177 JMPLOC+5,GTDSXLISTI(SIZEI <= (IND.(GTDSXLIST(0))I(0); *0178 SETGTDSXLIST,aSIZEO; << LIST PROCESSED SO RESET >> *0179 SETGTDSXLIST,0,0; *0180 GTDSX; << NOW TRY READING AGAIN >> *0181 MEXIT; *0182 SET9NUTIND.(DSX),0,DSXOF.((INDO.GTDSXLIST0) )(GTDSXLIST(adSIZE))); *0183 SETNOTIND.(DSX)1, INDCLS(O); (< SET UP DSX >> *0184 MENDGTDSX; ~*0185 END; *0 186 <( -*0187 THE FOLLOWING MACRO CREATES A FLOATING ADURESS CORRESPONDING TO *0188 EACH PARAMETER *0189 >> *0190'DEFNE'; *0191 MACROFLAD; *0192 LOCAL I; *0193 SET,I,0 1; *0194 JMPLOC+2,PAR. (0) >= 10); *0195 MEXIT; *0196 CRS,FLLD,NGTIND. FLD); *0197 SETFLDtlNOTIND.(FLD)t(MOD); *0198 SET,PAR.( 0 ),0,FLD; *0199 SET,PAR.(I ()O b,I NDCLS(0); *0200 SETI,OOI(0)+l; *0201 JMPLOC-7; *0202 MENDFLAD; *0203 END; *0204 << *0205 THE FOLLOWING MACRO CREATES A TEMPORARY CORRESPONDING TO EACH PARAMETER *0206 >> *0207'DEFINE'; *0208 MACRO TEMPCRARY; *0209 LOCAL I; *0210 SET,I,0,1; *0211 JMPLOC+2,PAR. (0) >= I(0); *0212 MEXIT; *0213 CRS,TMP, NOTIND. TMP); *0214 SETTMP,1,NOTIND.(TMP)('MOD); *0215 SET,PAR. ( I (C) ),0,TMP; *0216 SET,PAR.(I(O(0),1INDCLS(O); *0217 SET,I C,oIO 1 +1; *0218 JMPLOC-7; *0219 MENDTEMPORARY; *0220 END; ~*0221 << *0222 THE FOLLOWING REDEFINES THE GETTEMP AND FREETEMP MACROS TO *0223 GET AROUND THE PROBLEM OF THE REASSIGNMENT OF THE STORAGE *0224 ALLOCATICN CF A TEMPGRARY. *0225 >> *0226'DEFINE'; *0227 MACEXCTYPE 7; *0228 MACDEFTYPE 2; *0229 POPMACROGETTEMP FREETEMP; E-5

*02230 A TR, [L P 1 E X TLNCL; *0231 ATR,dTEMP2,LJUC AL 2^ 04; * 0232 SE I, TEMPL ST, VAL,0; *0233 *0234 MACRO, (G TTEMP, S,MDE,LEN; *0 23 LJCAL,,J; *0236 JMP,LUC*4,LEN <= 16; *0237 ERR: MNOTEt"'*** GETTEMP CALLED FCk MORE THAN SIXTEEN tYTES."; *0238 DUMPDSX,S,MODE,LEN; *0239 MEXIT; *0240 CLEAR,S; *0241 SET,I ~,VAL,5; *0242 SET,J,',VAL,C; *0243 TEST: JMPUONE, > TEMPLST; *0244 JMP,LOC+3,TEMPLST( I )(TEMP2) -= 0; *0245 SET,J, VAL,[I; *0246 JMPSEARCH; *0247 JMPSEARCHTEMPLST ( I )(@TEMP2) -= DSXOF.(S); *n248 GOOD: SET,TEMPLST (I ),2 iTEMP2DSXOF.(S); *0249 SET,Sa)XA,1; *0250 SET,S,a MCUE, MUOE ((iMCE); *0251 SET,S,LtN,LEN; *0252 SETSAJVAL TEMPLST(I ); ~*0253 MEXIT; *0254 SEARCH: SET, I,VAL, I+1; *0255 JMPTEST; *0256 DUNE: JMP,NOJ = 0; *0257 SET,I,aVAL,J; *0258 JMP,GJGlU; *0259 N: APND, TEMPLST, 1; *026C StT, TEMPLST,aVAL,; *0261 SPACE,TEMPLST(I),16,8; *0262 JMP, GU(J); *0263 MEND,GETTElP; 0 264 *0265 MACREFREETTEMPS; *0266 LOCAL,I; *0267 RtLSYbU, S; *0268 SErT,I,tVAL,5; *0269 JMPNUo, > TEMPLST; *0270 JMPGUTIT,TE^PLST(I ) ( Tt:MP2) = DSXOF.(S); *0271 SET,l, VAL o11; *0272 J;P,LOC-3; *C273 GUTIT: SET TEMPLST I ), TEMP2,0; *0274 NO: SET,S, VAL; e *0275 SETS, XA,1; *0276 SET,SSIZE,0; *n277 SET,S,@CLSNT IN.T ( P N U;TM U) *0278 MENDFREETEMP; *n279 *0280 MACDEFTYPE,1; *0281 MACEXC YPE,1; *0282 ENC; *0283 << *0284 THE FJLL(jWING DEFINES THE STATEMENT * 285 *0286'CREATE POINT' FPINT,X,Y *0237 *0288 WHICH hAS THE EFFECT OF THE LIST OF STATEMENTS SHOWN *o0289 >> E-6

*0290 DEFINE STATEMENT''CREATE PCINT POINT,X,Y; *0291'ALLOCATE POINT; *0292 POINT(1) H= HEAC; *0293 HEAD:=.PT. POINT; *0294 POINT(2) = (.AS. ('PCINTER )); *0295 DISPLAYN:= DISPLAYN+l; *0296 POINT(3) = ISPLAYN; *0297 POINT(4 = 1; *0298 POINT(5):= X; *0299 POINT(6):= Y; *0300'END STATEMENT'; *0301 << *0302 THE FOLLOWING DEFINES THE STATEMENT *0 30 3 *0304'CREATE LINE* LINE,P1,P2 *0305 *0306 WHICH HAS THE SAME EFFECT AS THE LIST OF STATEMENTS SHOWN *0307 >> *0308'DEFINE STATEMENT''CREATE LINE' LINE,PI,P2; *0309'ALLOCATE' LINE; *0310 LINE1):= HEAD; *0311 HEAD:= PT. LINE; *0312 LINE(2):= (0.AS. ('PCINTER')); *0313 DISPLAYN:= DISPLAYN+1; *0314 LINE(3):= CISPLAYN; *0315 LINE(4) = 2; *0316 LINE({5) =.PT. Pl; *0317 LINE6):=.PT. P2; *0318'END STATEMENT'; *0319 < *0320 THE FOLLOWING DEFINES THE STATEMENT *0321 *0322'CONNECT' POINT'ITC PICTURE *032'3 *0324 WHICH HAS THE SAME EFFECT AS THE LIST OF STATEMENT SHOWN *0325 >> *0326'DECLARE SYNTACTIC CLASS''TO' *SAME AS'; *0327'DEFINE STATEMENT''CCNNECT' POINT'TO' PICTURE; *0328 QQ1:= PICTURE; *0329'IF' (QQ.AS. ('INTEGER' )) =0; *0330 PICTURE:=.PT. POINT; *0331 PCINT(2) =,PT. PCINT; *0332'ELSE'; *0333 CQSV EVAL. PICTURE; *0334 PCINT(2):= QQSV(2); *0335 QQSV(2) =.PT. POINT; *0336 *END'; *0337'END STATEMENT'; *0338 <( *0339 THE FOLLOWING MACRO DEFINES TFE *POINT. OPERATOR AS A PASS ONE MACRO. *0340 IT CAUSES.POINT. A TO BE TREATED AS A(4) = 1 *0341 )> *0342'DECLARE SYNTACTIC CLASS'.POINT.'SAME AS'.ABS.; *0343'DEFINE'; *0344 MACRO.PGINT. T,8; *0345 LOCAL,U; *0346 TEMPORARYU; *0347.TAG.,UB,9LOCALLITERAL' 4; *0348 LN=,TU'LO]CALLITERAL~ 1; *0349 MEND,.POINT.; E-7

C 350 END; *0351 << *0352 THE FJLLLhING MACRO DEFINES.XUF. AS A PASS ONE OPERATOR. *0353 IT CAUSES. XUF. A TU BE TREATED AS A( 5) *0 354 >> *0355'DECLARE SYNTACTIC CLASS'.XLF.'SAME AS'.ABS.; *0 356.'DF INE; 0 35 7 MACRO,.XF.,T, A; *0358.TAG.,T,A,'LCCALLITE AL' 5; *0359 MEND,.X)F.; C0 360 END; *0361 << *0362 THE FULLG ING CAUSES.YOF. TC EE DEFINED AS A PASS ONE OPERATOR *0363.YUF. A HAS THE SAME EFFECT AS A(6) *03o4 >> *0365'DECLARE SYNTACTIC CLASS'.YCF.'SAME AS'.ABS.; *^366 ODEFINE'; *0367 MACRO,.YF.,TA; *0368.TAG.,T,A,'LUCALLITERAL' 6; *0369 MEND,.YOF.; *0370 END; *0371 (< *0372 THE FJLLUI[NG DEFINES.NEXT. A TO BE THE SAME AS A(2) *0373 >~ *0374'DECLARE SYNTACTIC CLASS'.NEXT.'SAME AS'.ABS.; *0375'DEFINE'; *0376 MACRU,.NXT., TA; *0377.TAG.,T,A,'LLCALLITERAL' 2; *0378 MEND,.NEXT.; *0379 END; *0380 C< * 381 THt FOLLOWING DEFINES DISPN. A 1 bE THE SAME AS A(3) *0382 >> *n383'DECLARE SYNTACTIC CLASS'.DISPN.'SAME AS'.AbS.; *0384'DE INE'; *0385 MACR,.DISPN.,T,A; *0386.TAG.,T,A,'LOCALLITERAL' 3; *0387 MENO,.DISP.; *C388 END; *0389'DECLAKE SYNTACTIC CLASS'.ENCA.'SAME AS'.ABS.; *0390'DEFINE'; *0391 MACRO,.ENCA.T, A; *0392.TAG.,T,A,'LOCALL I EAL' 5; *0393 MEN,. ENCA.; *0394 END; *0395 << *0396 THE FULLOWING DEFINES.ENCf. A TO BE THE SAME AS A 6) *0397 >> *0396'DECLARE SYNTACTIC CLASS'.ENCB.'SAME AS'.ABS.; *0399';EFINE'; *0400 MACRO,. ENB.,T,A; *n401.TAG.,T,A,'LUCALLITERAL' 6; *0402 MEND,.ENG8.; *04 3 END; *0404 << *n4n5 THE FOLLL JWIN(, DEFINES.HLAD. A TO BE IHE SAME AS A(1) *0406 >>'*04n7'DECLARE SYNTACTIC CLASS'.FEAD.'SAME AS'.AiS.; *0408'DEFINE'; *0409 MACRO,.HEAD.,T,A; E-8

*0410.TAG.,TA,' LOCALLITERAL' 1; *0411 MEND.HEAD.; *0412 END; *0413 << *0414 THE FULLOWING DEFINES.ADROF. A TO BE THE SAME AS THE SEQUENCE OF *0415 STATEMENTS 04-16 QQSV.EVAL. HEAD *0417 81: e F' DDISPN. QQSV = At GO TO" 82 *0418 QQSV EVAL. (.HEAD. QQSV) *0419'GO TO' 81 *0420 82:'RETURN',PT. QQSV *0421 >> *0422'DECLARE SYNTACTIC CLASS'.ADROF.'SAME AS'.ABS.; *0423'DEFINE'; *0424 MACRO,.ADROF.,T,A; *0425 LOCALB1,82; *0426 LOCAL TlT2 T3 9T4,T5; *0427 TEMPORARY, T 1,T2,T3, T4 T5; *0428 FLADl1,B2; *0429.EVAL. T l, QQSV HEAO; *0430 DESB1; *0431.DISPN., T2,QQSV; *0432 LN=,T3,T2,A; *0433 TNZ,2, T3; *0434.hEAD.,T4,%QQSV; *0435.EVAL.,T5, QQSV,T4; *0436 GOTOB1; *0437 DESB2; *0438.PT., TQQSV; *0439 MEN,. ADROF.; *0440 END; *0441 << *0442 END OF DEFINITIONAL PACKAGE *0443 >~ *0444 *0445'DECLARE''NORMAL MOCE''INTECER'; *0446'DECLARE' COMMAND'CHARACTER'(4); *0447'DECLARE' DISPLAY'FIXED ARRAY'(50,50)'CHARACTER'(1); *0448'DECLARE' (POINTPI,P2,P3)'POINT'; *0449'DECLARE' LE INE'LINE'; *0450 "DECLARE' PICTURE'FIXED ARRAY (100)'PICTURE'; *0451'DECLARE QQ1'POINTER'; *0452'DECLARE' QQ2'PCINTER'; *0453'DECLARE' (MM1,M2)'FLOATING'; *0454 *0455'PRESET' PICTUREN:= 0; *0456 *0457 *0458 SKETCH:'WRITE', "'OENTER A CCMMAND PLEASE.'*"; *0459'READ', "C4.4*", COMMAND; *0460 *0461'IF' COMIAND = "POIN"; *0462'WRITE' 9 "W ENTER X AND Y CUORDINATES:' *"; *0463'READ', "2I1*", XY; *0464'IF' 1 <= X & 5C >= X & 1 <= Y & 5C >= Y; *0465'CREATE POINT' POINTXtY; *0466b'WRITE' 9 " ASSIGhED DISPLAY NUMBER',HI4*",.DISPN. POINT; *0467 tfLSE'; *0468'WRITE' v "' POINT IS GUTSIUE RASTER RANGE.t*"; *0469'IND'; E-9

*0470 *0471'OR IF' CCMMAND = "LINE"; *0472'WRITE' "' ENTER DISPLAY NUMBERS FOR END-POINTS:'*"; *0473'READ', "21*" XY; *0474 P.EVAL..ADROF. X; P2.EVAL..ADROF. Y; 0475'IF'.POINT. P1 &.POINT. P2; *0476'CREATE LINE' LINE,PlP2; *0477'ELSE'; *0478 NOTPOINT:'WRITE", "' THOSE ARE NOT POINTS.'*"; *0479'END'; *0480 *0481 OR IF' CCMMAND = "PICT"; *0482'WRITE', " ENTER DISPLAY NUMBERS FOR ALL POINTS.'*"; *0483 PICTUREN:= PICTUREN+1; *0484'IF' PICTUREN > 100; *0485'WRITE', "n TOC MANY PICTURES.'*"; *0486'ELSE'; *0487 PICTURE(PICTUREN):= 0.AS. ('POINTER'); *0488 PICTA: "READ', "I*, X; *0489'IF' X.= 0; *0490 PI.EVAL.,ACROF. X; *0491'IF' -.POINT. P1,'GO TO' NOTPOINT; *0492 QQ2:= PICTURE(PICTUREN); *0493'CONNECTI P1'TO' QQ2; *0494 PICTURE(PICTUREN):= QQ2; *0495'GO TO' PICTA; *0496'END' *0497'END'; *0498 *0499 OR IF' CCMMAND = "MOVE"; *0500'WRITE', "' ENTER DISPLAY NUMBER OF POINT AND NEW X,Y'*"; *0501'READ','31*", DISX,Y; *0502 P1.EVAL..ADROF. DIS; *0503'IF' -,.POINT. PI,'GCTC' NOTPOINT; *0504 DX:= X-.XOF. P1; DY:= Y-.YOF. P1; *0505 (.XOF. PI):=.XOF. P1+OX; (.YOF. P1):=.YOF. P1+DY; *0506 QQ1:= P1(2); *0507'IF' QQl.AS. ('INTEGER') -_= O; *0508 P2.EVAL..NEXT. PI; *0509 MOVEA:'IF' ODISFN. Pl -=.DISPN. P2; *0510 (.XOF. P2):=.XOF. P2+DX; (.YOF. P2):=.YOF. P2 *0511 +DY; *0512 P2.EVAL..NEXT. P2; *0513 GOU TO' MOVEA; *0514'END' *0515'END'; *0516 *0517'OR IF' COMMAND = "DISP"; *0518'IF' HEAD.AS. ('INTEGER') = 0; *0519'WRITE', "' NOTHING TO DISPLAY.'*"; *0520 "GO TO' SKETCH; *0521'END'; *0522'FOR' I:= 1,1, >50,'FOR' J:= 1,1,J>50, DI'SPLAY(IJ):=" *0523 P1.EVAL. HEAD; *0524 DISPA: *0525'IF'.POINT. P1; *0 526 QL:=..XOF. P1; Q2:=.YOF. P1; DISPLAY(Q2,Q1:= "*"; *0527'ELSE'; *0528 LINE.EVAL. (.PT. P1); *0529 QQI:=.ENDA. LINE; P2.EVAL. QQ1; E-10

*353C Cl:=.ENDB. LINE; P3.EVAL. Qi1; *r531 X:= MIN..XOF. P2,.XUF. P3); *0532 X2:= MAX.(.XOF. P2,.XUF. P3); *0533'IF' XI = X2; *0534 Yl:= MIN.(.YGF. P2,.YOF. P3); *0535 Y2:= MAX.(.YCF. P2,.YUF. P3); c*536'FOR' Y:= Yl,1, Y > Y2, DISPLAY(Y,Xl):= *'"; *537 S'ELSE'; *0538:=.YOF. F3 -.YOF. P2; 0539 M2:=.XUF. P3 -.XUF. P2; *0540:= l /M2; *0541'Fu)R X:= X1,1,X > X2; 0 542 Q2:= M*(x -.XOF. P2) +.YF. P2; *0543 OISPLAY( G2X):= ""'; *0544'END'; *0545'END'; *0546'END'; *0547 w1:=.HEAD. P1; *0548'IF' Q01.AS. ('INTEGER') -= 0; *0549 Pl.EVAL. F.EAD. P1; *0550'0G TO' DISPA; *0551'END'; *0552'"RITE', "'1.',0('.')1"; *0553'FOR' I:= 50,-1, I < 1, *0554';RITE', "I3,52CI.1*'9 I'," ",".", *0555 DISPLAY(I,1)...DISPLAY(I,50); *0556'WRITE', "'.s 10('.*t; *0557 *0558'ELSE'; #0559'wRITE' t " ILLEGAL CCMMAND'*"; *0560'END'; *0561 *0562'GC TO' SKETCH; *0 563 *0564'PROCECURE' MIN.(X,Y); *0565'INTEGER S-ORT' (XY); *0566 MIN:'IF' X <= Y,'RETURN' X; *0567'RETURN' Y; *0568'END'; *0569 *057C'PROCEOURE' MAX.(AB); *0571'INTEGER SFURT' (A,B); *0572 MAX:'IF' A >= 6,'RETURN' A; *0573'RETURN' E; *0574'END'; *0575 *C576'END' E-ll

CRAGE ALLOCATICN OC0000.#4SKETCH CSECT O C470 ) O000001 + CCNST 1 000474 00000001 + CCNST 1 GC(478 000000064 CCNST 100 OC0480 00000002 + CCNST 2 00C484 00O0001 + CCNST 1 OC0488 o0000032 + CONST 50 00C48C 00000001 + CGNST 1 C0C490 0^000032 + CCNST 50 Oc0080 00000000 + CCNST C 000084 0000000 + CCNST 0 OCOB4 0000000 + CCNST C 00029C 7040C9D303C5C7C1 CCNST #' ILLEGAL COMMAND6*'* 0002AF 740404044004876B + CCNST "'.'O'.1*n 00C2C3 48 + CGNST ". 0CC2C4 C9F368F5F2C3F14 + CONST "13,52C1.1*" OO02CE 7DF1404040487D68 + CCNST "'1.,10.( )* 0C02E2 5C CCNST "C OC02E3 40 + CCNST " OC0O2E4 70400506E3C8C9D5 + CCNST "' NOTHING TO [DSPLAY.'*" 0002FB C4C9E207 + CCNST "DISP" OOC2FF F3C95C + CCNST "31*" 000302 7040C505E3C5D94 + CCNST I' ENTER DISPLAY NUMBER OF POINT AND NEW X,Y'*" 00032F 0.406E5C5 CC NST "MOVE" 000333 C95C + CCNST "*" 000335 7040E306D64)04C1 + CCNST "' TOO MANY PICTURES. *" 0(O034C 0000064 + CCNST 100 000350 7040C5D5E3C5D940 + CCNST "' ENTER DISPLAY NUMBERS FUR ALL POINTS.'*" C00379 D7C9C3E3 + CCNSI "PICT" OCC37D 7040E3C8U6t2C540 CCKST "' THOSE ARE NCT POINTS.'*" Of 0396 7040C5D5E3C5D940 + CCNST "' ENTER DISPLAY NUMBERS FOR ENO-POINTS:'*" OCC3BF D3C905C5 + CCNST "LINE" 0003C3 70400706C905E340 + CCST' POINT IS LUTSIDE RASTER RANGE.'*" OPO3E5 7040C1E2E2C9C705 + CCNST"' ASSIGNED DISPLAY NUMBER',HI4*" OCC404 00000032 + CLNST 50 OCC408 F2C95C + CNST'"21*" 000408 7040C5D5E3C5D94C + CCNST "I ENTER X AND Y COO)RINATES:'*" 000429 )7D6C905 + CCNST "POIN" 000420 C3F448F45C + CONST "C4.4*" 000432 70FOC5D5E3C5D94C + CCNST "'CENTER A COMMAND PLEASE.'*" 00C450 00000006 + CONST b 00C454 OO000C05 + CONST 5 0CC458 00300004 CCNST 4 00045C 30000303 + CCNST 3 0CC460 00000000 + CGNST 0 000464 00000002 + CCNST 2 000468 00000001 + CNST E-12

STORAGE MAP 00 03 0023 000003CO Y 00 03 002C 00000300 X 00 C3 0n30 OCC00)CO B 00 03 0034 OOOOOCO A 00 07 0010 OOOOOOCO P3 00 07 0014 n0000n00 P2 00 07 0018o 0003OO0 PL 00 C7 01C 0O3COCOO0 LINE 00 07 0020 OO00000 POINT 00 C7 0024 30003300C0'SV. 31 nl 0000 0O0O7OO00 Y2 01 01 0300 30000004 Y1 O1 01 000 3 C 00030C8 MAX 01 o1 03C00 on03010 X2 01- 1 0 000'1000C14.IN 01 01 0000; 003000 1C X1 01 01 0000 0000).320 2 0 O01 O0000'300030024 1 01 01 0000 30000028 DLSPA 01 C1 000"1 Q0 00)C30 J 01 01 000) nOn'33 O ) 34 [ 01 G 0003 ) 0000)38 MuVEA 01 01 0000 n3n0040 OY 01 01 0003 " 000 344 OX 01 01 0000 00000048 oIS 01 01 00 3) 00003034C PICTA 01 01 0000 O000 004 IUOTPOINT 01 01 0000 0000005C IUP 01 01h 00000 OOOq4 I1AlOREAD 0 1 01 000. 003390c06C END IP 01 01 C0000 30000074 FORMAT 01 01 000o0 C q0C7C MAUh I rT 01 O1 000'3)00 (0C38 4 P ICTUREN 01 01 0000 00C00088 M2 01 01 0000 00 3' 080C Ml 01 01 0003 3000C090 4A 01 C1 0000 30003C04 Q2 1 1 01O0 C 300:3n098 COMMAND 01 01 0000 0')303090C W1 01 01 000.COC-000A0'ENDSTAfEMENT' 01 01 C000') 3000COA4 Y 01 01 0000 300003A8 X 0C O1 00OO00 0 00')33AC SAMEAS' 01 01 00c3 C00o 360 HEAD 01 01 0000 C0000T4 DISPLAYN 01 Cl 0003 300300nL38 SKETCh 01 01 O0000 "0000 329C "' ILLEGAL CUOMANUL*4" 01 01 000'3'00002AF "'.',10('.* )"I 01 01 o00O f00002C 3 "," 01 O1 noon'003')024 "i 3,52C1.1 * 01 O1 COO 000! 2C E "'1,o 1'.' )*" 01 01 000 ") 00 )C32E2 "*" 01 01 o 0o0 300)02E3 " "E 01 CO1 OO0 3 000 C2E4' NOTHING TO jISPLAY.'*4 0 1 C1 OO O0 00 02 F H ") SP" 01 0000 1 I,00 O 2FF'3F 1 " 01 CI 003) r03303302 t' EN iTER DIlSPLAY NUMCBEK I, F PUINT AND NE. XY'*" E-13

nl 01 C0 0') 000)J 2 F'*MOVE" 01 O 00h 00^ nC0333 *1"i, 01 01 nOOr)O )000335 " TLC MANY PICTURES.'*" 01 1 01000') ri00o034 13 0 01 01 000' 00000350 "' ENTER DISPLAY NUMBERS FOR ALL POINTS.'*" 01 l ).0000) )0000379 "PICI 01 01 000 000000370 "'' IHLSE ARE NOT PuINTS.'*" 0l 01 0000 30000396 "' ENTER DISPLAY NUM8ERS FOR END-P INTS: *' 01 01 000' 00O03BF "LINE" 01 0100 00 000003C3 "' POINT IS OUTSIDE RASTER RANGE.'*' 0 01 01 COOO 000C3E5' ASSIGNED DISPLAY NUMEER',HI4*" Cl Cl 000 ) 000004C4 5C 01 C1 C0000 OOOG4C8 "21*" 01 Cl 0000 0000408 "' ETfER X AND Y COORDINATES:'*" 01 01 00C 000000429 "PU IN" 01 01 0000 00000420 "C4.4*" 01 01 000 030000432 "'OENTCER A COMMAND PLEASE.'*" 01 01 000? 00000450 b 01 01 0000 00C00454 5 001 0000 00000458 4 01 01 0000 000C45C 3 01 01 0000 0000046C 0 01 01 0000 00000464 2 01 01 0000 0000C468 1 01 01 0000 0000470 wDIM^rO2 01 01 0000 000004E0 D I C OOl 01 01 0000 00000498 PICTURE 01 01 0000 00000628 DISPLAY E-14

DICTIONARY WUIMOOOi'FIXEUARRAY' C0101OCO OOCCO480 CCMP.S LE=4 COMPONENT='INTEGER' 1D[IMO002'F XEDARRAY C10I100CC OOOC0470 CCMP.SIZE=4 COMPONENT='INTEGER''ENDSTATEMENT''INTEGER' O0101C00 C0OOOOAC'SAMEAS'' INTEGER' OCCCCO OOOCOOAC A'INTEGERSHORT' 0003C034 00OCO000 (FuRMAL PAR) B'INTEGERSHORT' 00030C300 300000000 (FRMAL PAR) COMMAND *CHARACTER' CICo100CO CCO0CC98 LENGT H=4 DIS'INTEGER' OlO00000 CCO0048DISPA'ENIRYNAME' OIC1OCCO 00,C0028 RESULT= INTEGER' DISPLAY'FIXEDARRAY' C1G1COO0 C0000628 CGMP.S IZE=1 D M.VEC.=%IM0001 COMPONENT='CHARACTER' LENGTH=1 DISPLAYN' INTEGERSHURT' C1010CCO CCOOO064 OX INTEGER' 01010000 0000q044 OY'INTEGER' O1n10OOCC 0CC.C0040 ENDIGP'ENTRYNAMEI 01 O1O0C 000(")C6C'EXTERNAL' RESULT=' INTEGER' FORMAT'ENTRYNAME' O1CIOCCO CCCOC074'EXTERNAL' RESULT=' I NTEGER HEAD'POINTER' C1010000 COOCOOBO I'INTEGER' 01010000 00000034 IOP'ENTRYNAME' 010100C C n0000005C'EXTERNAL' RE SLT=' INTEGER' J'INTEGER' 01010000 CCCCOO30C LINE'CUMPONENTSTRUCTURE' ro007r01C C03)O00C'BASED' SIZE=20 COMPONENT='PCINTER' COMPONENT='POINTER' COMFONENT= INTEGERSHORT' COMPONENT= INTEGERSHORT' COMPONENT='POINTER' COMFGNENT= "POINTER' M'FLOATING' 01C10000 OC((C(0090 MACREAD'ENTRYNAME' C1GlCCO OCOOC064'EXTERNAL' RESLLT= INTEGER' MADWRITE'ENTRYNAME' 0101COO 0OOOC007C'EXTERNAL' RESULT='INTEGER' MAX ENTRYNAME' COlOl-c o00 C3000008 RESLLT=' INTEGER' MIN' ENTRYNAME9 C10100CC COOOOC14 RESULT= I INTEGER' MOVEA'ENTRYNAME' 1OlICOCO OOCOC 03 RESULT=' INTEGER' Ml'FLUATIN' 0101000oll OCOOOC8C M2'FLOATING' OlCIOOCC CCCOOC88 NOTPOINT'ENTRYNAME' 01C10000 C.Gn(C 54 RESULT=' INTEGER' PICTA'ENTRYNAME' C0101CO OC OOOOC4C RESULT=' INTEGER' PICTURE'FIXEDARRAY' O1C1COOC C00CC49d E-15

CGMP.S IZE=4 0I M.VEC. =%O.M0002 COMPONENT='PUINTER' PICTUREN'INTEGER' OIC10iCO 00.0CC84 POINT rCOCMPUON NTSTRUCTURE' 0007002C OOOCOCCO'BASED' SIZE=16 COMPONENT= PCI NTER' COMPONE:T='PGINTER' COMPONENT='.L TEGERSHORT' COMPONE. T.= I NTEGERSHORT COMPONENT=.INTEGERSHURT' COMPON E T= I'NTEGERSHORT' P1'CCMPONENTSTRUCTURE' C0070018 CCOCOOOC'BASED' SIZE=16 COMPONENT='POINTER' COMPONENT='POINTER' COMPONENT= INTEGERSHORT' COMPONENT='INTEGERSHORT' COMPONEENT= * INTEGERSHORT' COMPONENT='INTEGERSHORT' P2'COMPUNENTSTRUCTURE' 00070014 00000000'BASED' SI E=16 COMPONENT='PCINTER' COMPONENT='PUINTER' COMPONENT= INTEGERSHGRT' COMPONENT:'INTEGERSHORT' COMPONENT=' INTEGERSHORT COMPONENT=' i TEGERSHORT' P3'COMPONENTSTRUCTURE' OCC70010 COCCOOOO'BASED' SIZE=16 COMPONENT=' PCNTER' COMPONENT= PCINTE' COMPONENT='INTEGERSHORT' COMPONENT=' I NTEGt RSHGCT COMPONENT='INTEGERSHORT' COMPONENT='I NTEGERSHORT' QQSV'COMPONENTSTRUCTURE' 00(70024 0OnO000'BASED' SLZE=16 COMPONENT='POINTER' CCMPONENT='PCINTER' COPPONENT=' INTEGERSHURT COMPONENT= INTEGERSHORT' CGOPCNENT='INTEGERSHURT' COMPONENT= INTEGERSHORT' QQl'POINTER' GoClCOO CC 00009C QQ2'POINTERE' C10100CO rCCCOOO4 QI'INTEGER' 0101000C CCC0024 Q2'INTEGER' OICIOQO' OCCO0020 SKETCH'ENTRYNAME' OI010 CO OCCOOOB8'ACCESSIBLE' RESULT=' INTEGER' X'INTEGER' lCICCCOO OC00OA8 X INTEGERSHORT' 00030C2C 00000000 (FORMAL PAR) Xl'INTEGER' 01Cion00 CCCOn1OIC X2'INTEGtR' OiCIOOOC CCCOIO Y INTEGER' O010COO0 COCOCOA4 Y'INIEGERSHORT' nCO3CC2E 0eCCO000 (FURMAL PAR) YV' INTEGER' OlCICOOC C0000004 Y2'INTEGER' 01ClO-J) CCCOOCO'" "'CHARAC ER' CClOI:OCC 000002E3 LENGTH=1."'CHARACTER' C1CICO(C COOrC2C3 E-16

L NG TH= I "' "'CHARACTLR' ClOln CO Cr0002E2 LENGTr= l "' *' 10('.')*"'CHARACTER' 01010000 000002AF LEN(TH=2^~ "' ASSIGNFD DISPLAY NUMbERS'HI4*"'CHARACTER' 01C10000 COOC03E5 LENGTH=31 "' ENTER DISPLAY NUMBER CF POINT ANC NEW XY'*"'CHARACTER' 0C10000 00000302 L ENGT H= 4 t' ENTER DISPLAY NUM8ERS FCR ALL PCINTS.'*"'CHARACTER' OlC;1n0^O 00000350 LENGTH=41 "' ENTER DISPLAY NiMBERS FCR ENC-PCINTS:'*"'CHARACTER' OlClOCCO 00000396 LENGTH=41 "' ENTER X AND Y COR-CINATES:'*"'CHARACTER' 0101C00C CCOCC4CB LENGTH=3 n "' ILLEGAL CUMMAND'*"'CHARACTER' CIC10CC 00C0029C LENGTH= 19 "' NOTHING TO DISPLAY.'*"'CHARACTER' 01C10000 000002F4 LENGTH=23 "' POINT IS UUTSII)E RASTER RANGE.'*"'CHARACTER' P101CCCO COOCr3C3 LENGTH=.34 "' THOSE ARE NOT PGINTS.'*"'CHARACItER 010100CC C000037D LENGTH=25 "' TCC MANY PICTURES.'*"'CHARACTER* 0C1CCO 00000335 LENGTH=22 "'FENTER A CCMMANL PLEASt.'*"'CHARACTER' C1010000 00C00432 LENGTH=27 "'1.',Ot('.')*"'CPARACTER' 01010CCC CCOOC2CE LENGTH=20 "C4.4*"'CHARACTER' 1OO1CCOO OC00042D LENGT H=r) "DISP"'CHAKACTER' 01CIOCCO 000002FB L ENGTH=4 "1*"'CHARACTER' 0101OOCC 000C0333 LENGTH=2 "i13,52C1. 1*"'CHARACTER' C1010000 C00002C4 LENGTH=1 0 "LINE"'CHARACTER' 01010CC CCCOO3eF LENGTH=4 "MCVE"'CHARACTER' CCl1CCCO 00C0032F LENGTH=4 "PICT"'CHARACTER' 01010c0 COC00379 LENGTHi=4 "POIN"'CHARACrER' )O11CCO 30000429 L ENG TH=4 "2 1*"'CHARACTE R OO 101CCC 000C04C8 LENGTH= 3 "31*"'CHARACTER' 0101COlCC 00O02FF LENG TH =.3 0'INTEGER' 01010003 CCC00460 1'INTEGER' 01C01(0000 COC00468 10^' INTEGER' Cl1CIOOC C000034C 2'INTEGER' 01 1 C00 CCOC464 3' INTEGER' C 1 1 OOO) C'C45C 4' INTEGER' 0101C000 COCCC458 5'INTEGER' 01010000 CO:CO0454 5C'INTEGER' OIC 10 OC CC0 o^404 6'INTEGER' 01C10003 )CCOrC450 E-17

EXTERNAL SYMbOL DICTIONARY (SYMBOLTYPE, C,ACER,LENGTH/LDID) ##SKETCH PD 01 OCOOfO) 0124C /SKETCH SD 02 OOOCOO OC166A MACSTACK RK 03 SKETCh LD CCO0t C(0 002 MACWRITE ER 04 FORMAT ER 05 ENCIOP E 06MACREAD ER 07 lOP ER 08 GETSPACE ER 09 LINSUB ER OA E-18

RELOCATION JICT IGNARY {P.o ID,R.D,FLAGS,ACCRESS) 01 C2 OC 000B8 01 04 1C 00007C 01 C5 1C 00C074 01 01 OC 000294 01 C6 1C 00006C 01 07 1C 000064 01 01 OC 000288 01 C8 1C 00005C 01 Cl OC 00027C Cl C OC 000270 01 C1 OC 000264 01 Cl OC 000258 01 C1 OC 00024C 01 C9 1C 001060 01 C1 OC 000240 01 C1 OC 000228 0 1 Cl OC 0C21C 01 C1 OC 000210 01 C1 OC 000204 01 C1 OC OOC1F8 01 C2 OC 000054 01 Cl OC 0001EC 01 Cl OC 0001EO O1 Cl C 000104 0'1 CA 1C 0010A4 01 Cl OC 001094 01 01 OC 001098 01 C2 OC 00004C 01 Cl OC OOC1C8 01 01 OC 00018C 01 C1 C0 001088 0 1 C OC 00108C 01 C1 OC 001004 01 Cl 3C 001008 01 C OC 000180 01 C1 OC 0001A4 01 C1 OC 000198 01 C1 OC 00018C 01 C1 OC 000180 01 C2 OC 0OC038 01 C1 OC 000174 01 Cl OC 00110C 01 Cl IC 001110 01 C1 OC 001114 01 C2 OC 000028 01 Cl OC 001130 01 Cl OC 001134 01 Cl OC 001138 1 Cl OC 00116C 01 01 OC 001164 01 C1 OC 001168 01 C1 OC 00119C 01 Cl OC 0011AO 01 C1 oC 0011A4 01 Cl OC 000118 01 G1 OC CG010C 01 Cl OC CO100 0 1 C l JC OOOCF4 E-19

01 C1 C0 000nE8 01 Cl OC 0^1 iC 0 1 C1 )C 00110C 01 C1 OC 0011C4 O1 C 1 oC O01LDS 01 Cl C 0 11DC 01 C C 1C 011EO 01' Cl 1.C "00 o0 01 Cl OC 000C4 01 C2 OC 000n14 01 C2 oC OnfC 8 02 Cl OC 001648 02 Cl OC 001584 02 Cl OC 000020 01 Cl OC O011FO 01 Cl OC 0011F4 01 C2 OC 0011F8 01 C3 IC QO11FC 01 C4 OC 001228 01 C5 OC 00122C 01 C6 OC 001Z30 01 C7 NC 001234 01 C8 OC3C 00 1238 01 Cl OC 00123C 01 C9 OC' 001240 01 CA OC 001244 01 C2 OC 001248 02 COCOO1 ENO SKETCH MAD/I COMPILER TIMINGS: 171.625 CPU SECCNDS. 326.CC3 ELAPSEC SECONDS. EXECUTION rERMI NATEO E-20

Appendix F. Run of the MAD/I Program $SET ERRUDOUMP=UN $RUN SKETCH0BJ MAP SCARDS=-DATA *.............. *. * *...... *......... 0.. ~ * * ~ ENTRY = O1CO00 SIZE L= OOA6B3 NAME VALUE T RF NAVE VALUE T RF NAME VALUE T RF GETSPACE 011610 * FREESPAC 0118A2 * SYSTEM 0167A4 * ERROR 0167CE * PGNTTRP 018E8C * LOAD 018EF2 * GETFC 0197E0 * SCARKS 019A80 * SPRINT 019A92 * SPUNCH 19AA4 * SERCOM 01<iAB6 * READ 019834 * WRITE 019B50 * LCSYMBOL 01A5E8 * GLAP 130C8 OFFA6O LINSUB 103648 103tb48 MADIG 1C3C70 1C3C70 MADREAD 1C3C7C MACWRITE 103C9E FORMAT 1C3C3 A I P r 3FC ENDIOP 103E42 ##SKETCH 10OA0C 1CAOOO IOPKG 1.0E250 103250 ROPEN 1(331E RCLOSE 10t3398 POPEN 10 3C4 PCLOSE 106410 MDIOPSCT 10ED50 10B9E8 SPIE 10BDE8 10'lDE 8 #SKETCH 10CO00 1OCOOO IUH360 11 l00 11100C IOGHN' 1110FO i[HOUT 111114 ICHETC 1113C UNEi)ATlM 11192C IOHERP 115000 110F18 MADSTACK 117000 117(00:. ~. eo ~....................... e,11.. *., I.... o...* 0: *.'........' 0l,.. ~... EXECUT ION BEGINS ENTER A COMMAND PLEASE. NOTHING TO )ISPLAY. ENTER A COMMAND PLEASE..ENTER X AND Y COCRDINATES: ASSIGNED DISPLAY NUMBER 1 ENTER A COMMAND PLEASE. ENTER X ANO Y COORDINATES: ASSIGNED )ISPLAY NUMBER 2 ENTER A COMMAND PLEASE. ENTER X AND Y CUOODINATES: ASSIGNED DISPLAY NUMBER 3 ENTER A COMMAND PLEASE. ENTER X AND Y COURDINATES: ASSIGNED DISPLAY NUMbER 4 ENTER A COMMAND PLEASE. F-1

50 49 48 47 46 45. 44. 43 42 41 40. 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 * * * 9 8 7 6 5 4 3. 2 1 ENTER A COMMAND PLEASt. ENTER DISPLAY NUMBERS F-OR END-PCINTS: ENTER A CJl4MAND PLEASE. ENTER DISPLAY NUMBERS fCR iNOD-PCINTS: ENTER A CUM1AANO PLEASE. F-2

EN"TER "'Af SPLAY NUM8ERS FR NUL-PGI iNT S: tNTER A COMMAND PLEASE. ENTER DISPLAY NUMBERS FOR END-POINTS: ENTER A ClIMMAN4 PLEASE. F-3

50 49 48 47 46 45 44 43 42 41 40 * $ *I~ 4* ** 4c ^ 6(<C 4> 39 * 38 * 37 * 36. 35 * 34 * 33 32. 31 * 30 * 29 * 28 * 27 * 26 * 25 * 24. 23 * 22 * 21- * 20. * 19 * 18 * 17 * 16 * 15 * 14 * 13 * 12* * * 112 * 10 * 9 8 7. 6 5. 4 3 2. 1. *.. *. *. *.. I ~ ENTER A CUMMANO PLEASE. ENTER DISPLAY NUMBER CF PCIT AND NEW X,Y ENTER A CUMMAND PLEASE. F-4

* 0 0 0 * * * *0 * * 0 5C 49 48 47 46 45. 44 43. 42 41 40. ** *** *** ** *< 39. * 38 ~ 37 * 36* * 35. 34. * 33 * 32* * 31 * 30 * 29 * 28. * 27 * 26 25. * 24 * * 23. 22 * 21. * 20 * * 19. * * 18 * * 17. ** * 16. *** * 15. ** * 14~ ** * 130 ** * 12. *** * 11. ** * 10. 9. 8. 7 6. 4. 3. 2. 1. ENTER A COMMAND PLEASE. ENTER DISPLAY NUMBERS FOR ALL PCINTS. ENTER A COMMAND PLEASE. ENTER DISPLAY NUMBER GF POINT AND NEW XY ENTER A CUOMMAND PLEASE. F-5

50 49 48 47 46 45 44 43 42 41 40* **3'*4'**4** 39 * 38. * 37. 36. * * 35 ~ 34. * 33.* 32. * * 31. 4 30. * 29. 4 28. * * 27. 26 * 25 * 24. * * 23 * 22. * 21. * 19. ** * 18 ~ ** * 17..* * 16. ** * 15. ** * 14. **. * 13. ** * 12 ** 11. * * 10. * 9. 8. 7 6. 5. 4. 3 2. 1. ENTER A COMMAND PLEASE. 4*** ALL INPUT DATA HAS bEEN PRUCESSEC - AT LOCATION 1C3UE8 EXECUTION TERMINATED F-6

26 UNCLASSIFIED Security Classification DOCUMENT CONTROL DATA - R & D (Securitv classifi.cation of title, body of' ),,tract,-d;ziruc'.x'.:','';;rorofro n nmu.'.' et':c.../::;:. t':'i- overall report is classified' 1. ORIGINATiNG ACT IVTY (Corporate author} 2a. REPORT SECURITY CLASSiFICATiON Unclassified | UNIVERSITY OF MICHIGAN Unclassifie [ b. GROUP CONCOMP PROJECT i, _.._____________, ____,_..................:..- -...,,..,.............,,,,. 3. REPORT TITLE AN EXAMPLE DEFINITIONAL FACILITY IN MAD/I 4. DESCRIPTIVE NOTES (Type of report and inclusive dates) Memorandum 5. AUTHOR(S) (First name, middle initial, last name) Ronald J. Srodawa 6. REPORT DATE'a. REPO ETOAL N'. OF PAGES 7b. NO. OF REFS August 1970 25 3 8a. CONTRACT OR GRANT NO. Ea. ORIGINATOR'S REPORT NUMBER(S) DbAJojiEo083 OSA-3050 Memorandum 32 9b. OTHER REPORT NO(S) (Any other numbers that may be assigned this report). 10. DISTRIBUTION STATEMENT ] Qualified requesters may obtain copies of this report from DDC. 1. SUL;P EMENTARY NOTES 12. SPONSORING MILITARY ACTIVITY __ J Advanced Research Projects Agency 13. ABSTRACT The MAD/I language is a procedure-oriented algebraic language which is a descendant of ALGOL 60 and 7090 MAD, similar in power and scope to PL/I. The MAD/I compiler is implemented using the MAD/I facility, a flexible translator-building system whose dynamic nature allows compilers to be extended during the compilation process. This paper demonstrates the extension of MAD/I to include several graphics-oriented statements and operators through a lucid example. D D, Nov 6,1473 Unclassified Security Classification

L / rS~ -cu,.i- ctior' -... Security Classification 14. LINK A LIN KEY WORDS ROLE ROL WT ROLE WT MAD MAD/I Programming Language Extensible Language Statement Definitions Operator Definitions Security Classification