You are on page 1of 29
IL-1 ‘execution diagran! CHAPTER 7 EXECUTION AND EVALUATION OF PRIMITIVES AND THE IDLING PROGRAM THE SCOPE OF EXECUTION This chapter is concerned with the erenmatical rules for the execution and evaluation of TRAC language primitives, In the last chapter, the discussion ended after a brief illustration of the execution of the nested print string primitives, We saw that execution takes place when the sean pointer arrives at a right parenthesis: //) . We also found that the scope of the primitive extends back from the scan pointer to the location of the nearest marker #( or ##( . In this shapter, a new notation will be intreduced to assist in following the details of executing and evaluating the primitives. Consider what happens in scanning: L/#(23,0a7) The scan pointer moves to the right, eventually arriving at the close parenthesis: Ho Ps" CATL/) Exeoution is about to take place, We now introduce the new notation, called the ‘execution diagram’, It shows the scope of the prinitive being executed: Lad ) In effect, the sean pointer has "expanded" to show the entire scope of execution of the primitive. ‘The underline, together with the slant lines Copyright (C) 1972 Rockford Research, Inc. ALL rights reserved. wi-2 at the ends, bracket all the characters in the neutral strings and the syntactic markers of the prinitive, Ths execution diagram shows the complete scope of the primitive. When the execution diagram is fully formed, execution takes place, The string CAT is now printed out: printed oute CAT When execution is completed, there is nothing left in the workspace fron the P3 primitive. Sverything within the underlined scope disappears, The Scanning pointer now collapses to its original form, which is: // ‘The diagran for this entire sequence can be shown, ineluding the indication of the printing action: Laps, cat) # Les cat / printed outs car u In the mora general situation, 4 primitive will be buried in some other string of characters, or will be nested inside sone other primitive. ‘The scanning process is not altered: (L/saat(s, 006 House) BBB AaaL/#(PS,00G HOUSE) BER ne ) Aaa P5' Do HOUSE /BBB printed outs 0G HOUSE AaAL/SBB aaaseal/ "null value" VII =3 "value! value string! The print string primitive is a member of the class of primitives called ‘null valus' primitives because they do not leave a string of characters, called a 'value', in the workspace after they are oxecuted. All primitives are not in this class. For example, the read string and ‘the call primitives are very useful because they do leave a ‘value string’ of characters in the workspace when they are exsouted. We shall now see how this go Consider the following: Lfaaa$( PS) BBB HH) Ana] RS / BBB The processor 1s now waiting for something to be typed in, The text HELLO' is now typed: typed in: KELIO" The string HELLO becomes the value string produced by the R3 primitive, The apostrophe " meta character signals the end of the input typing. The string value HELLO is now inserted into the workspace at the place formerly narked out ty the read string prinitive, The read string prisitive disappears. If more room is needed for the value string, the characters in the workspace are moved to the right. Space is closed up, Af necessary, to make things fit. The new value string is placed in the workspace ag shown ty the diagram: AAA /HELLO/BBB The two slant lines without a connecting underline bracket the new string. The question now is, where should the scan pointer be placed? Should it “resume nerker™ VIE - 4 go to the left or to the right of the new string value which was just ‘brought {n? SINCLE AND DOUBLE SHARP SIGHS The nex position of the scan pointer is always determined by the one or two sharp signs in the syntactic marker group at the front end of the execution diagram. A ‘resume marker’ is placed at the foot of one of the two slant lines to show where the scan pointer is to resume scanning, For #( the resume marker goes to the left end, while for ##( the resune marker goes to the right endr “axecution ™, - Rule giagren with #( = besones {value string’ “execution fule gj with ##( becones f “value string" / Scanning is then resumed from the location of the resune marker. Bue / "value string / becomes Uf “value string” Rule / “value string" / becomes “value string” // ‘The following examples illustrate thess two casest Case #( L/a# (RS )BB ec) AA{_RS_/BB typed int HELLO" Marker put. AA/HELLO/BB at left end. AAL/SBLLOBB AAHELLOBE// Sase #o( (L/As##(RS)BB fe) ‘Aa RS. /pE typed in: HELIO" Marker put AA/HELLO LEB at right ond. AAHELLO/BB AAHELLOBE// In cases like these, where the string value is composed of ordinary alphabetic characters, it really makes no difference whether a single or double sharp ocours, On the other hand it makes @ great deal of difference ‘when the new value string contains executable primitives, as the following example shows: L/#(8,#(88)) HH Ps RS//)) HC ps"7 es /) The processor is now ready to execute the RS primitive and to accept text from the keyboard. Notice that exeoution of the 35 primitive takes place before execution of the PS primitive, The TRAC processor ds now waiting for something to be typed in at the reactive typewriter. A string is typed ins typed int #(DS,C2 MOUSE)" ey PS /#(Ds,cz,MoUSE)/) Since the read string primitive had a single sharp sign, the resume marker ‘null string" vo -6 4s placed at the left end of the nav value string. The sean pointer reappears at this end, and scanning resunest eH y PS c2_mouss /) ‘The define string expression which had just been typed in is now fully parsed and is ready to execute, It executes, placing the string MOUS in memory with the nane + The define string primitive is 4 null valued primitive, so that after execution nothing remains in its Place in the workspace, The diagram for what happens 46: stored: MOUSE name: G2 aos. FH) Ha) PS. printed out: “null string! u The string of no characters, the ‘mull string* was printed out, Finally only the sean pointer is left in the workspace. A very different action takes place in the case of two sharps in the read string primitive, We will take the same example, with everything the same except for the two sharps in the read string primitive: L/#( PS, A#(RS)) a Hw) psf RSJ) typed int #(DS,C2,MOUSS)* oe ‘PS /#(DS ,CZ MOUSE) /) ‘The resune marker now goss to the right hand end of the new value string. VII =? ‘neutralized’ Seanning is resumed at the right hand end: a, PS #(DS,C2,MOUSE)//) #( ) Ps_#(DS MOUSE) ‘The two neutral strings forming the two arguments for the print string primitive ares PS #(DS C2 MOUSE) Although the second string is a complete primitive, it does not execute because it is a neutral string, It is te the left side of the scan pointer. Tt is sald to be 'neutralised", Its characters are treated just as if they were ordinary alphabetical characters. Therefore, this entire second atring is printed out without change: printed out: #(DS,C2,MOUSE) Fanallyt “ ‘No strings are left in the workspace, and nothing goes into storage. By use of two sharp signs with the read string primitive, the proo sor was able to read in, and to print out, an executable expression, and to do so without causing its execution. The reason for having the two methods of execution in TRAC language, with the single and double sharp signs, is to allow sone value strings to ‘be executed, while allowing other value strings to be dealt with without their being executed, In later chapters, we will see how. ‘THE WORKSPACE MARKERS Until now we have not considered the fact that the workspace for the strings has a left end and a right end. The right ond of the ‘typewriter signal! vIr- 8 workspace 1s to the right of every character of the active string. It is marked with /= see ABC) f= The left end of the workspace is marked with =/ and it 1s to the left of all the neutral strings and syntactic markers: os feo Lf In both these diagrams, the ellipsis .., indicates any string. The ‘empty workspace, which occurs when everything in the workspace has been executed and ali that remins is the scan pointer, is indicated by: fhlf= In the action of the scanner and the processor for TRAC language, what should happen when we arrive at this diagram? ‘THE IDLING PROGRAM When an empty workspace cccura, the TRAC processor automatically loads @ new string, according to the following rule: Rule ltff= ‘becomes =///# (Ps (CREF) (P54 (RS) )/= Execution of the first prinitive in the string produces an innediate CRLF which signals to the person at the reactive typewriter that this rule 1s being followed, This signal is called a "typewriter signal’, and it positions the printing element of the typewriter to the beginning of a new line. The workspace now contains the string nf L/#(PS,#(RS) f= with the scan pointer at its left end. VIE-9 ‘fdling progran* "echo! If we did not have this automatic action of the TRAC processor to load ‘the new string, then after all the atrings in the workepace had been used up, there would be nothing in the workspace to cause new strings to be taken in from the typewriter, The only way the TRAC language processor can reasive strings is by taking them in according to one of ‘the input prinitives, like read string RS, Without an AS primitive, everything would cone to a conplete stop. ‘The nested expression #(P5,#(RS)) which 1s automatically inserted into the workspace is called the "idling program’ . It gets this nane ‘because it is usually in the workspace when the reactive typewriter 1s idle and waiting for the person at the keyboard to type something in, Of course, as soon as the idling program is inserted with the scan pointer at the left end, the parsing action goes forward until 1t stops ati a a) =/ Fs /_ Rs /)/= ‘The TRAC processer 1s now waiting for some character string to be typed at the keyboard, When the characters are typed in, they will replace the read string expression, A nunber of things which were deseribed in earlier chapters of this Manual now bacome clear, Take the case of the 'echo", When AAA’ ie typed in, there is an echo, with the string AAA being typed out, We can now see exactly why this happens; We begin with the idling program, Thent ‘typed int AAA ae =f PS {AMA/)/= ( a, =/ PS //AMA)/= VII = 10 a.) =/f_ 35 AAA f/= printed out: AAA “ile This 1s the echo, The typewriter signal now occurs, and the idling program 1s autonatically reloaded, And avay wa go again. Whenever we have to untangle sone complex expression, and to find out exactly what will happen in the processor, it 1s always necessary to ‘begin our analysis with the idling program. Our analysis of the echo 18 & good illustration of this requirement. Everything that happens 1n the workspace actually takes place inside the print string expression of the idling progran. Also, in ost camea, the final output at the typewriter is provided by the print string Primitive of the idling progran, In Chapters 4 and 5, we studied the four prinitives, print string, read string, define string, and call, tut we did not take into account, the action of the idling program, We simply assumed, for example, that we could type a define string expression, and the DS action would take Place. Now, knowing about the idling program, we can understand in detail what happened. The #(RS) expression of the idling program was there waiting for something to cone in. Because of the single sharp of the #(RS) expression, the scan pointer was set to the left end of the new string, Thus the new string was scanned and executed. When we typed in the call expression, the call ws executed and it caused text to come from storage. This text then becane the second argument of the print string of the idling program, and this text was vil - ii printed out by the typewriter, Some examples will help to show the details of these actions, We begin with the idling program, and then type in a define string expression: =/L/#(P3 .#(88))/= a el of es" fas) nfm # typed ins #(DS,CXZ,(#(PS,HELLO)))" =/ PS" /p(DS,CXzZ, (#(PS,HELLO)))/)/= The sean pointer is now set to the left ond of the new string: Ho =/ PS //#(DS,CX2,(#(PS HELLO) )))/= aA oe wy ) =/ PS {_DS GX2 $(PS,HBLIO) /)}/= ‘The define string primitive is now executed, a form is created with the name CXZ with the stored string #(PS,HELLO) - stored: #(PS HELLO) name: GHZ. The define string primitive has a null value, so it does not leave any string behind in the workspeo , alts pe “/ ras - printed out: "null string’ alle At this time, the TRAC processor types out the typewriter signal GiLF, reloads the idling program, and starts over. Now we can type in a call to this stored string naned CXZ: WIT = 12 oe oA vs’ (as y= *« typed int #(CL,cxz)" =/ ps ip(cL,cxz)/)/= oe =/ PS L/#(CL,cuz))/= ete e/ PS {ch ck /)/= The string retrieved from storage ty the call goes inte the workspace te replace the call expression: es =/ PS [#(PS ,RELIO)/)/= fi. =/ PS L/W PS,HELIO))/= oiss'f' v3" (os uae’ /y/= « printed out: HELLO =f ¥s"L)/= eC) =/Lps_fl= printed out; “null string" =/L/ l= We would get quite a different effect 4f we type in the sane cali, * ‘but with a double sharp sign on the call: typed int A(CL,CXZ)" we =/ ps Lpe(ch.cx2)/)/= =/* ps" i/oe(cu.cx2) /= ols fy texe. pS {Sh ckz //= The value string with name CXZ is again retrieved from stotage and ié VIE = 13 put into the workspace, However, the resume marker is set to the right end of the new string. Thus the new string is neutralized, and goss directly into the neutral strings area to the left of the scan pointer. ac s/ PS /#(PS,HELLO))/= a, =f PS #(PS,HELLO)//)/= A. ) =//_ PS #( PS HELD) //= printed out; #{PS,HsLLo) -/Ui= In other wards, the double sharp call brought from memory the character sequence exactly as it was stored in the memory, prevented it from being executed, and caused it to be printed out unchanged, The double sharp call can be used inside any other primitive to produce « neutralized string value. A good exanple of how this might be useful is given ty typing in the expression: typed in: #(DS,NEW,#e(CL,CX2))! what happens next is shown by the following diagrams: ec. =f PS Lp (DS, NeWyFe(CLCAZ))/)/= eC a =/ PS 0S NeW //##(CL,Cx2)))/= The define string primitive is not executed just now. Instead, the call primitive is executed first: oe UG a) =/ ps’ ps’ new" cuore /))/= VII = 14 ‘The neutralised value string provided by the call is put in the workspace: BCC =/ PS DS NeW #(PS HALLO)/))/= aC AC a ) =/ pS / DS NEW #(PS,KELLO) /)/= The define string expression is finally executed. stored: #(PS,HELLO) names NW What we have done is to create a duplicate copy of the string #(PS,HELIO) named CZ, The stored duplicate copy of the string is named MEW. The eld string with name CXZ is still in the memory, The processor continue: a, =f Ps" [df= a) =/{_ps’ f/= printed out: "null string" slits What we have done is often useful, We have sade a new form with the name NEW which holds a duplicate copy of the string from the form naned CXZ, We frequently need to use forna which are identical except for their names. ‘The double sharp technique provides a very useful method for getting any kind of troublesome string into the memory, We begin by using the expression: typed ini #(DS,NAME##(RS))" The processor scans this, coning to the RS primitive and then waite for hore input fron the typewriter. Now we can type such a string ast typed int )))" VIT = 15 ‘The typed-in string is not ucanned, so the define string expression uses this string as the atgunent string for ite third argunent, The define string action then takes place in the typed-in string: steredi —))) namet NAME, If wa tried to store the string ))) directly, with the DS primitive, we would not get the result desired. This is what would happen: typed int #(DS,NBW,))))" What we would get would ber stored: “null string” name: ay To see why this happens, wa must diagran the action stage by stage. We start with: ac a) =/ Ps {RS /)/s The processor ts waiting for a atring. typed in: #(DS,NAME,))))" a, =/ PS /#(DS,NAMB,))))/)/= aC a yD) =/ Fs /_DS NAME /))))/= We see that the parsing action picks up the firet end parenthesis of the define string to cause execution of the primitive, The define string is executed, even though the third argument in the prinitive 1s a mull string: stored: “null string” names = NAME What is left ist a, =/ Ps L/))))/= VII = 16 Ho) =/Ls_/ l= Printed owt: "mull string" whet is left in the workspace is: fle Now what? We can't use the execution rule for primitives because neither of the syntactic markers #{ or ##( remains to the left of the scan pointer, We are stuck. We don't have a rule for this situation. Ws can't predict what the processor will do, Clearly, we need rules for all exceptional cases, In the next section, we will get three new rules, SACHSS AND MISSING PARRNTHESES So far, in our discussion of the scanning process, we have always ein the workspace assumed that there were a correct nunber of parenth so that the workspace became eupty when the last print string primitive was executed. This need not be so. There can be ary combination of parentheses, and the processor must have rules to deal with #11 cases, There are also other irregular situations, and these must also be taken care of by rules for the scanner. In thie section, we will learn three new rules which will cover all possible situations which have not yet been treated. With these new rules, together with the parsing rules of the last chapter, we will have parsing rules to cover every possible combination of characters in the workspace. The first rule ig the transformation rule: Bale =/ “anything” [//= vecones —/ff//= This rule states that if the sean pointer gets to the right end of the vIn - 17 ‘pathological atrings" workspace, and 4f there 1s anything whatsoever still in the neutral string area, or in the syntactic marker area, it is deleted. ‘The workapace 18 completely cleared of everything except the sean pointer. What 1s left is s/i{/=. ks a result, what next happens ia that the typewriter signal CALF is given, and the idling program 1s reloaded into the workspace, ‘The second new transformtion rule is: “string with Rule “anything” //( no matching end /= vecomes = ////= parenthesie" Ler ‘This second new rule says that if the scan pointer meets a begin parenthesis which has no matching end parenthends, the workspace is again conpletely cleared. The third new transformation rule 1s: “no syntactic Rule o=/ markers #{ or ##( //) = “anything" /= becomes =////= to left of pointer" This rule deals with the case where neither of the aroups #( or #4#( 4s present ag a syntactic marker to the left of the scan pointer. This rule 4s nesded because when the sean pointer meets an end parenthesis, tt is necessary to find the head of some primitive in order to proceed, If such a head cannot te found, then no execution diagram can be formed, and no primitive can ba executed. The only thing to do ts to clear the workspace. Sone examples of the application of these rules can now be givens In each example, wa presume that the idling program 1s loaded and 1s waiting for input. Consider first what happens when the ‘pathological string’ AAA( ie typed in, This is called a pathological string because At is “eick", that 1s, 1t is not the kind of string that we usually WIT = 48 use with a TRAC processor. We find out what happens with this input string by diagramming step-by-step the action of the scanner: ae} of ps fas /)/= “ typed in: AAC? af Ps" LAA )/= wo =/ ps //aaa()/= (ie =f PS ARAL/O)/= The san pointer has now come to a pair of protective parentheses, but the protected string is the mull string with no characters. The disappear, The null atring of no characters protective parenthe! is moved to the neutral string, that 43, nothing is moved to the neutral string. We now have: Aree] =/ FS AAAL//= The print string primitive cannot be executed because its grammar requires an ond parenthesis for execution, All the primitives do. The sean pointer cannot move ahead, since there are no more characters. We apply the first of the new transformation rules, and we get: ile ‘The partially-forned print string primitive is simply ignored, and everything in the workspace 4s deleted, In the next atep, the processor automatically Feloads the idling program and starts over again. string such The second new transformation rule comes into play when as (((! ts typed at the typewriter. This 4s what happens: VIE = 19 “ typed ins (((* =f Bs" ACU M= a. =/ ps UCO/= The second rule must be applied because there 1s no matching end parenthesis for the begin parenthesis just in front of the sean pointer, The third new transformation rule handles the case where there are too many end parentheses, such as with a typed-in string }))' . This is how dt goes: a =/ Ps DY a. =/ ps4) aC.) =/Les_/))e printed out: "null string!" all) = At this point, the third new rule is applied, to give: =iLfl= and the idling program 1s reloaded. ‘We have now learned all the syntactic rules of TRAC language. In the next chapter, we will learn what happens when an expression locks like a primitive, but either has some defect in its arguments or is really not TRAC language primitive. VIII - 1 “primitive! CHAPTER § DEFAULT CASES FOR ARGUMENTS AND EXPRESSIONS ‘FINDING THE ARGUMENT STRINGS In natty cases, either by accident or by intent, a einple expression will have the appearance of being a well-formed primitive expressions, but on closer examination 1t is found to have some defect or unusual feature in its argument strings. Fer example, what action is to be taken with expressions like ##(DS)" or #(#())' ? In the first case, the define string primitive ordinarily has three argunent strings, but here only one is present. As the seccnd example shows, other unusual situations ean occur. In this Chapter we will learn some additional rules which will conpletely cover all such cases. These Tules are in keeping with one of the main objectives of TRAC language, which is have the language so well defined that a person can always predict what the processor will do with any string. We begin our study by asking, what is a "prinitive'? We have now done a lot of things with TRAC language prinitives, but we haven't really defined 'primitive', I now define the word "prinitive’ to mean “the simplest form of executable expression in TRAC language which has a mnemonic". According to this definition, an expression beginning with a #( ora ##( and terminated by a matching end parenthesis is a prinitive when all of ite argunents have been reduced to neutral strings and when the first argument is a two-letter TRAC menonic, Copyright (C) 1972 Rockford Research, Inc. All rights reserved. VIIE - 2 ‘The reason for insisting upon neutral strings for all the argunents is that we just don't know what the arguments are until all the executable expressions inside 2 Brinitive have been executed and the results of the execution have been put inte the neutral string area, To illustrate, consider the following actions: typed in: #(DS,12,(PS,THREB))* This causes the storage of a form with the name string 12 + stored! PS,THREE namer = 12 Now type in the peculiar expression #(#(CL,12))’ , It 1s seen that the outer expression dces not seem to have an argunent string of any kind that we have seen before, The nested call #(Cl,12) is clearly executable, but before its execution, the outer expression doss not have any mnexonic or other character strings. Despite its peculiarity, the expression #{#(CLy12)) 4s a well-formed TRAC expression, To see what happens to it, we diagram the steps as the scanning and execution process goes forvard, typed int #(#(CL,12))* ee sf PS (e(#(CL,12))/)/= f* ofl 9C =/ Ps esti yy i recalls string: PS,THRES ors [5 ,THREB/))/= ee, ) =! Ps 1 ps amas’ /)/ # printed out; THREE =f 'ps'L/)/= AC) =f f= Printed out: “null string” all vill - 3 As this example denonstrates, the arguments of an expreséion may not be visible when the expression is first encountered. The arguments as well as the syntactic parts == the sharp signs, the commas, and the parentheses -- may all be supplied at sone later tine during the evolving action of the processor. Here two argument strings and the syntax comma ware supplied by the call and inserted inte the enclosing expression. INSERIGD NULL VALUE EXPRESSIONS Another kind of irregularity in the formation of an expression is Allustrated by the following: typed in: #(PR(PS,AA)S,BB)" Hore the PS mnemonic is split by another expression. Will thie cause trouble? In what sequence will the output strings appear? What happens and why becomes clear when the action is diagranmmed, a =f ‘ss LAC PHCPS ,AA)S,BB)/) f= eH) s/ PS Pi_pS aA /5,BB))/= printed out: AA “# PS ‘3/8 ,38))/= (oe) =f 's'/ ps ep /)/= printed out: BB printed out: "null string” aliiiz ‘The conclusion which wa draw from this last example is that any expression which hae a nui value (which includes expressions Like VIII = 4 the define string and print string primitives) can be inserted almost anywhere among the sequence of characters making up the argunents of sone other expression or primitive. Such an inserted null value exprossion will disappear entirely upon execution, There are only two situations where s null value expression will not disappear in this way. ‘The first exception is that if a null value expression is inserted within # protected string, it will not be executed, and consequently it will not disappear. WATCH OUT FOR DOVBLE SHARP SIGNS The second exception is more subtle. If the null value expression is inserted between the two sharp signs of a syntactic group, thet is, between the sharp signs of the group ##( , then the inserted expression may seize and use the first of the two sherp signs in the process of its execution, let us see how this will happen, We will use the double sherp call ##(CL,12) whieh should bring forth the string PS,THREE. However, ‘we will insert the expression #(PS,"**) between the two sharp signs of the call. Thus, we type in: typed ins ##(PS,*#*)#(CL,12)" Without going further, we can plainly see whet will happen. ‘The string °™* will be printed out first, Then the call will be executed inside the print string ef the idling progran, but since it is now only & single sharp call, the scanner will act upon the value string. ‘The type in produces: wo af ‘es Lpe(Ps,+#*)}#(CL,12)/)/= After the string 4s printed out, we have: aCe af PS /#{ch.12)/)/= VIII = 5 a, =/ PS (pS, THRBE/)/= a #/ PS PS THRES//}/= Hoey) (Les ps Tepe //= Here wo must remember that only the second argument string of the print string primitive 4s printed cut. Thus: Brinted outs PS If At had not been for the fact that the expression ¢(PS,***) hed seized the extra sharp sign on the call, we would have gotten this result: = os" et chl2)/)/= of 5' es, mmao/)/= = ars ceas[))/= etd’ es'ps J fim Now the second argument of the print string primitive 1s PS,THRES and we get: printed out: PS, THREE l= In conclusion, we must be careful about putting expressions between the sharp signs of the #{ syntactic marker, ‘EXTRA ARGUMENTS AND MISSING ARGUMENTS GF PRIMITIVES Moat of the TRAC language primitives are defined for a apécified nunber of arguments. (See the table on page INDEX-2.) ‘The first neutral string argunent of a primitive always indicates which printtive is Ili - 6 represented by the expression. If it is a valid primitive, the first argument alvays has exactly two characters which are letters of the alphabet. Whenever the reactive typewriter keyboard has the capability for both upper and lower case letters, either case may be used for either of the two letters designating the prinitive. Thus in the case of the define string primitive, the letter pairs ds, DS, Ds, and aS are all equivalent in their effect, This accommodation, which permits either upper or lower case lettets indifferently, prevails only for the letters of the nnenonie for the primitive. For all other situations, including even two-letter combinations in the first argument which do not designate a prinitive, the upper and lower case distinction 1s preserved. For a TRAC language primitive which is defined as having a specified nunber of arguments, any additional arguments found in the neutral strings of the scope of the prinitive are ignored, Such extre argunents are discarded, working from the right-hand en? of the series of arguments. However, this discarding of the extra arguments is not done until all the active strings within the scope of an expression have been scanned, and executed when necessary. For example, all the active strings in the following expression are executed before the extra neutral string argunents are discarded: #(PS, ,AAA,#(PS\SS))" The inner print string is executed, and $$ prints out. Then the AAA in the third argument position in the snclosing print string is discarded. ‘The enclosing print etring primitive finally prints out a null string, Hule Additional arguments in a primitive, beyond those specified in its definition, are ignored, working from right to left. VIII -7 ‘null string’ Tf a TRAC language primitive expression 4s ready for execution, but At is found that there are not enough arguments marked out, or that certain arguments ate ‘null strings', then what happens? There are several cases to consider. Tne first case is where there © not enough arguments marked out, as for example with (08). In such « case, wo use the rile: Rule Mull string argunents are assumed and inserted during execution in all instances where an argunont is missing according to the definition of the primitive. Therefore in our example with #(0S) , the arguments during execution are taken to be: DS “null string "null. string" The primitive is now executed with these arguments, and we get: stored: "null. string" name: Moull string In other words, the form is actually sot up, though the text of the form ds the mull string, and the nano of the form is the mull string. Such a name de a perfectly good name in TRAC language, and such a form is a perfectly good form, Sometines there are even useful things that you ean do with this peculiar form. according te this aew rule, we get the sane result from any one of the expressions: 400s)" #(DS,)' Sa ordinarily when it is desired te produce a form with a null string for its text string, and vith a null string for its name, the expression (D8. 4)! "default call! VIII - 8 would be used. The two commas, with no character between, is usually used to indicate the null string in an expression. The comma and the end parenthesis also mark out the null string in the third argunsnt, THE DEPAULT CALL Tt will often happen that when an expression 4s ready for execution At 4s discovered that the first ergunent is not one of the mnemonics for any of the primitives currently in use in the processor, or any primitive in TRAC language. What happens then? An example is: #(Xy,cat)* The string XY does not designate any of the primitives of TRAC T-O4 Language. However, it is possible that at some earlier time the following define string operation may have been executed: typed dn: #(05,01,(#(PS,D0a)))* Of course the result of this is: stored: #(PS,D0G) name: Xt ‘If this had been done, and then #(XY,GAT)' 4s typed dn, the ‘default call’ action takes over. This occurs whenever the first neutral string argunent is net one of the two-letter mnemonics of a TRAC primitive in the processor. ihon the processor finds that the two-letter argument is not one of its primitives, it then attempts to execute the expression by using the first argument as the nase string in 4 call primitive. Here the first argunent is the string XY. In this example, the string CAT is not needed and 4s Agnored. In a later chapter, we will see thet the call primitive nay take any number of arguments. The new default call is able to do the same, VIL - 9 There is one big difference between the default call expression, such as #(XY,CAT) , and the cal] primitive, In the default call axprassion, the single versus double sharp distinction is dropped, Both expressions are treated in the TRAC 1-6 language as 1f they wore converted to a single sharp primitive. This means that the scan pointer is always reset to the left end ef any value string produced by a defsult call, ‘The default call is now Sllustrated by making use of regular and default calls to the form named XY of the preceding illustration: typed in printed out (KE CAT)" Dog ##(X¥ CAT)" boa #(CL,XY,CAT)* ‘DOG #e(CL XY CAT)! #(PS,006) It is seen that the first three examples are equivalent in their execution. For operation of the default call, it is not necessary that the first argument be limited to only two characters. A character string of any length may be used. When execution is attempted, if there is no form 4n storage with a nane which is the same as the nane string in the default call, the value string produced is the null string, exectly the same as with the call, The rule for the default call is the following: Rule In the attenpted execution of an expression as a primitive, Af it is found that the first argument does not match any two-letter mnemonic of « primitive currently operational in the processor, then execution 4c attempted by taking the first argument as the nane string in a call primitive, using VIII = 10 the following arguments as the corresponding arguments of the call primitive. If a value string is produced, in all cases the sean pointer is reset to the left hand ond of the new value string. With this chapter we have finished most of the abstract rules of TRAC Language. In the next chapter, we will begin to learn how to do things with TRAC language scripts. EXERCISES 1, What rules apply to the expression #()' 7 What happenst 2. What ds the result of #(DS,,YOO-H00)" 7 wow what will *O)' produce