<<

iiii~(i i~4,!i

( /)

S. GORN, Editor; . W. BEMER, Asst. Editor, Glossary & Terminology E. LOHSE, Asst. Editor, Information Interchange R. V. SMITH, Asst. Editor. Programming Languages

A Correspondence Between Introduction Anyone familiar with both (~hurch's X-calculi (see e.g. ALGOL 60 and Church's Lambda- [7]) attd ALTO], 60 [61 will have noticed a superticial re- semblance t)etween the uay variables tie up with the X's Notation: Part I* in a nest of X-expressions, and the way identifiers tie up wiltt the headings in a nesl, of procedures and blocks. Some its- P. J. I,~XDtN} J may also have observed that in, say {\f.f(a) + f()} [Xx.:c2 + px + q]

This paper describes how some of the of ALGOL the two X-expressions, i.e. the operator and the opcr~md, 60 can be formalized by establishing a correspondence play roughly the roles of Mock-body and procedure- between expressions of ALGOL 60 and expressions in a declaration, respectively. The present paper explores this modified form of Church's n-notation. First a model for com- resemblance ii~ some detail. puter languages and computer behavior is described, based on The presenlal~ion falls into four sections. Tim first see- the notions of functional application and functional abstraction, Lion, f(illowing this introduegi(in, gives some moi;ivation but also having analogues for imperative language features. for examining lhe e(n'respondenee. The second section de- Then |his model is used as an "abstract object language" into scribes mt abstxaeL language based on Ctmreh's X-calculi. which ALGOL 60 is mapped. Many of ALGOL 60's features This abstrae( language is a development of the AE/SECI) emerge as particular arrangements of a number of struc- system presented in [3] and sontc acquaintance with thai; tural rules, suggesting new classifications and generalizations. paper (hereinMter referred to as [SiEE]) is assumed here. The correspondence is first described informally, mainly by The third seclion describes inforlnally, mMnly by illus- illustrations. The second part of the paper gives a formal lral;ions, a correspondence between expressions of ALCOL description, i.e. an "abstract " into the "abstract object 60 and expressions of the abstract language. The last language." lhis is itself presented in a "purely functional" see(ion formalizes tiffs eorrespondenee; i( first describes notation, that is one using only application and abstraction. a sort of "abstracl~ ALcol, 60" and then presents Lwo func- tiotts that map expressions of ~bstraet AL(alL 60 inlo, on l;he one hand, AL(~OL 60 texl;s, and on the other hand expressions of the abstrac{; language.

Motivation Collten [S It seems possible that the correspondence might: form /ii (Part J) Tlhe ('onstants and Primitives of the basis of a formal description of the semantics of AL(;OL Introduction ALGOL 60 60/ As presented here it reduces the problem of specifying Motivatioi~ [[lustrat[otl~ of the (.~ortespon(lenee ALt,;OL 60 semani.ies t,o t.hal~ of specifying t)he semantics of [ ,O lit-tel" Ill Prospects Identifiers Short-term Aims Variables a sLrueturalty simpler language. The formal treaLment of Ex pressions [mper~ttive Applieativ(! ]!]Xl)r(~ssions the latter problem is beyond the of this paper, and A Gener:dization of ,Imnps Blocks IIItrodlleillb~ (;Ollllii}~ilds into a I"Llne- Pseudo blocks hence likewise a formM t)roof l~hat~ the correspondence de- Declarations tii/tlal S(:}i() IIL(~ scribed here is eorrecl). [1~ is hoped that~ the informM at- Tim Sllaring Machine Statements ALGOl, 60 as Sugared IAE8 Labels and Jumps count of the semantics of the abstract "object language" Informal Presentation of the Corre- Own Identifiers S !~)()II(]ellCe (Part H) * Part I[ of this paper, which gives bite FormM Presenta- Brief Ou'Hine The DomMn of Reference of I"ormal Presentation of the Con'espoud~ tion of the Correspondence, will appear in the March, 1965 issue ence AI,GOL 60 of the Communications of the ACM. Abstract ALGOL Fo>lists The Synthetic Syntax I"unction Present address: Univac Division of Sperry Rand Corpora- Streams The Soma, lille IFtlltctioli lion, Systems Programming Research, New York, New York. Types (:(melllsion * This view is expanded in [10].

Volun, e 8 / Number 2 / February, 1965 Conmutnieations of the ACM 89 Secondly, we shall give many examples of the usc~ of Al,;s will t)e enough to justify the choice of correspondence in all as a descriptive tool, and in particular some that exhibit in but a few details. AEs features that correspond (o the sequencing control of LONG-TERM PROSPECTS conventional programming la ,guages.. lit emer,,'es., ~, lhat the choice of an AE from a certain ('lass of similar AEs is There at'(', two ways in which this work might be rele- rather like the choice of an order for a set ot7 assign- vant to the job of providing software. ments, and tlmt the issue of whether or itol. this choice (1) Formal syntax has been used to practical advan- tage by language designers and implementers. There might affects the outcome has an analogy in terms ot' AEs. For example, it follows from the definition of tim "value" be analogous advantages in formal semantics. (2) If several languages are being used concurrently by of an AE that the users of a computer, a common formal basis for them ~(a ~ O)(J, 1/a) might help in intermixing them (e.g. referring in one lan- guage to program that originated in another). and Clearly, significance in these fields depends on the possi- bility of applying to other languages the technique illus- g(a =< 0)(X( ).a 2,a( ).1).~)( ) trated here in respect to ALGOL 60. So far only sketchy are not necessarily equivalent; if a = 0 the first is u> trials have been made, since even for ALGOL 60 the present defined. This difference is reflected in ihe behavior of the state of the investigation is not satisfactory. Discussion of SECD-maehine. In evaluating the first it attempts to otimr languages is largely beyond the scope of this paper, evaluate bolh a 2 and l/a, whereas in evaluating the second, but the sketchy trials confirm what will be obvious to the both X( )-expressions are evaluated but only one of thdr present reader---that the method is at its best with lm> bodies. The use of X, and in particular (to avoid an ir- guages that, rely mainly on elaborate "descriptive" forms, relevant bound variable) of h(), to delay and possibly and at, its worst with those that rely mainly on elaborate avoid evaluation is exploited repeatedly in our' model of "imperative" forlns. Thus it favours what currently tend ALGOl, 60. A function that requires an argument-list of to be called "advanced" languages---those with good deft- length zero is called a none-adic function. nition facilities, localized naming, and reeursive structure On the other hand, AEs illunfinate the structure of of right-hand sides and programs. It has little value with a ALGOL 60. fixed-format, absolute-address language that makes exten- Firstly, the definitive description of ALGOL 60 is split sive use of sequencing and of state-indicators that modify into sections headed "syntax" and "semantics." The syn- the effect of subsequently executed instructions. tax is described formally, the semantics raainly by nm'ra~ tive. This paper provides a way of formalizing some of the SHORT-TERM AlMS semantics by associating semantic features of AL(~OL 60 In [MEE] it was shown how certain features of program- with syntactic features of AEs. (More precisely, we should mint languages can be modeled in a modified form of say structural features of AEs, since AEs have an existence Church's X-notation. More precisely, a model language, independent of any specific written representation.) based on X-calculi, and called applicative expressions (AEs) Secondly, the analysis leads to a classification of the was described in abstract terms, that is to say, independ- grammatical units of ALGOL 60 that provides a unified ently of any particular written representation. It was framework for such features as (i) the fact. lhat array shown how AEs provide facilities essentially equivalent to bounds are necessarily specified in terms of nonlocals (and auxiliary definitions, conditional expressions and recur- hence, for instance, cannot use a procedure declared ill sion, and that with a suitable choice of written representa- parallel); and (it) the commonly observed similarity be- tion these facilities take on a familiar appearance. Further- tween procedures and actual parameters called by name. more, an abstract machine, called the SECD-machine, was More generally it shows that many features of AL(~OL60, described capable of "interpreting" AEs. Still more pre- including call by name, declarations, own, for-lists, and cisely, there is a Jhmily of languages and a matching family labels, have parallels in a language that lacks assignment, of machines, each characterized by an "environment," i.e. arid are hence not essentially related to "imperative" lar~- a set of named objects that are related to one another by guages. Also, mainly by default, it suggests a new view of rules concerning the results of applying them one to an- own 2 other'. The present paper' is based on a development of this Thirdly, the analysis brings out certain respects in which scheme, intended to incorporate ALGOL 60. ALGOL 60 is "incomplete," in that it provides differing fa- The attempt to fit ALGOL 60 into the AE/SECD frame- cilities in situations that are closely analogous. It dictates work can be considered from two sides. On the one hand, what extensions (and small changes) are required to re- for someone familiar with ALGOL 60 it may clarify some of move this incompleteness. Whether or not "eomplel(mess," the features of AEs. Firstly, the analysis of ALGOL 60 in in the technical sense that emerges below, is a desirable at- terms of AEs illustrates the distinction made in [MEE], be- tween "applicative structure" and "." 2 Developed in [10].

90 Communications of the ACM Volume 8 / Number 2 / February, 1965 ll'il)ul(~ el p '()gralni~lits~ l~mgttag(.~ will liot be discussed whose bound variable is x and whose X-body is X; this is dirocily ill 1,his p:~por t)(,yo~ld lho following i.'elli{~rks. the AE thai: in a rnore rigid notation is written In ils hi, vor i l ,ali })c said tSal, given (:olnplel(mess, many Of lho prol)os~ls for ('xl(:~i/si()llS thai)are put forward with {xz.x}[z] r(~fel'ei~oe go ctirro/~ t pr()graitu~iing ]angtiages become mere In this paper we use another piece of "syntactic sugar" s!/ntaclic pr<)pos~fls, i.(< proposals for wriling in al:l allegedly for the same AE structure, namely, illoFe eonvellieiit way sonic particular k,ind of expression that is ~fli'eady ii~ the langu'~ge. There is art important let x = Z; X (lualifiem ion io ti~is: such a proposal niight have some coo- or, letting layout obviate punctuation, lion/it ovorlones; i.c,. il; might be a sy'ntactic proposal Dliat helps the machine to recognize when special "cheap" tech- let x = Z ~tiques arc appropriate, or it; nfight deter the user from X writing forms of expression that at'(: expensive to imple- Here is a typical form of AE, presented both informally ment. and formally. The above c/aim for complete languages sounds like one ellen made to rebut a proposed language extension--"gou leta = A {x(a, b, f). can do that already merely by writing .... " The question and b = B {X(g, h). and f(x, y) = F {Xk.X} {X(u, v).Xz.K}) therofor(~ arises whether a complete language forestalls its let tee g(x) = G [ YX (e, h). (Xx.(L x (y, z).H} } extensions in any more significant sense than do Turing and h(y, z) = H [A, B, X(x, y).F] machines, Marker , built-in instruction codes let k(u, v)(x) = K of gei~eral-purpose computers, or programming languages X wiih Am~oL-like procedure facilities. We shall not pursue The only consideration in choosing between let and where this questior~ here. will be the relative eonvenienee of writing an auxiliary Fourthly, the analysis of A LCOL 60 in terms of AEs sug- definition before or after the expression it qualifies. gests a new way of comparing various run-time setups for The use of comlnas for denoting lists, ~ for conditional ALGOL 60, and displays the interactions between run-time expressions, arid let arid where for auxilia W definitions, selup and l he exlensions mentioned above. provides a way of representing AEs on paper, i.e. one par- titular "syntax" for' AEs. Though this syntax has not been hnlperative Applicative Expressions rigorously defined, enough has been said to ensure that We now describe the abstract language used later to each formula could be rewritten in a rigid, prefixed oper- model ALto-eL 60. We give a formal account of its structure ator, fully bracketed notation (rewritten, that is to say, in (i.e. its "abstract syniax," to use McCarthy's phrase [5]) at least one way arid possibly several equivalent ways). trod an informal account of its semantics--very much what Another way of saying this is that if we know how to trans- the oftieial description does for ALGOL 60. The semantics of late ALGOL 60 into a language based on just operator/ this absl tact language are described in terms of art abstract operand eombination, conditional expressions and auxiliary machine for interpreting it. This language consists of ex- definitions (including function definitions and recursive pressions we call imperative AEs (IAEs), and tim machine definitions) then we effectively know how to translme is called the sha'~'ing machine. The IAE/sharing machine ALGOL 60 into AEs. We shall use this fact to make the in- system is a development, of the AE/SECD system de- formal discussion here less technical than it otherwise scribed in [MEE]. However there is art important way in would be. which the relationship of IAEs to the sharing machine In the formulas of [MEE], AEs play two independent differs from that of AEs to the SECD-machine. The se- roles. First they are part of the subject matter in the sense manlics of' AEs can 1)e specified formally without recourse that certain subexpressions denote AEs. Second they are to a machine. In fact. this specification provides a criteriolt the language in use, since all the expressions are to be con- for .iudging the "correctness" of a machine that purports to sidered as written presentations of AEs. This dual role is evahmte AEs. The SECD-machine satisfies this criterion maintained in the present paper. It is fortuitous in the but it is not the only (abstract) machine to do so. With sense that we might have used some other means of ex- IAEs on (,lie other hand it appears impossible to avoid pressing what we have to say about AEs, or we might: have chosen some other topic and nevertheless have used AEs. specifying semantics in terms of a machine. A relationship was established in [MEE] between AEs However, the coincidence is designed in the sense that our and certain informally introdu('ed pieces of notation; for interest in AEs springs partly from their success in de- example, we ('onsider scribing their own features.

X where x = Z A GENERALIZATION OF JUMPS We introduce into the SECl)-maehine an operation de- as a way of writing the operator/operand combination noted by 'J', that is applicable to funclions, or more pre- whose operand is Z and whose operator is a X-expression Communications of the ACM 91. Volume8 / NiJmber 2 / February, 1965 cisely Co closures, attd modifies their subsequent exit larged se~ as t'olkms. behavior. AiD. h~perativ,~ applicative e×prcssi.o~ (IA E) is For example, consider a definition of j' as follows: either' ~m ident'tfier, or t~ X-ea:pression (Xezp) and co:asist.s of f(z) .... g(-.-, -.-).,, its boundva'riable part (by), which is :~. lisg.~strueture of idmlti. where g = JX(u, v). tiers, a~,d its X-body (bodg), which is an IAE, where Cite subexpression g(..., " ') may occur at any or an assiqner, which consists of X-depth within the right-hand side, and itt any context. i{;s leflhandside (lhs), which is a:a IAI!], and its riohthan&ide (rhs), which is an IAE, If during an application of f this subexpression is evalu- or a combination, which consists of ated, its value will immediately become the result pro- its operator (rater), whielh is an iliA]'], :rod duced by f. This is relniniscent of art alarnt exit from a its operand (rar~d), which is aa IAE. . In fact the generalization of labels to permit arguments may be a useful way of providing for alarm We adopt, informally, the following notatioH for as- exits in At, GeL-like languages. signers, I*'urlher, to define precisely the meaning of 'J', we extend lhs ¢= rhs the class of possible results of evaluation by inCroducing a new kind of object, a bundle of information called a This extension of the notion of all expression brings in its "program-closure." When J is applied to a oh)sure it train the problem of extending the notion of tile meaning o~' transforlns int;o a program-closure. an expression. The next subsection is an informal appr0aell The resulting program-closure, like a closure, includes to this Cask. It is hoped a more exact account will be set the current environment (for subsequeItt installation) and forth for publicalioa elsewhere, and Chat enough is said an expression (for subsequenC evaluation). I{owever it also here to define all buC the details of the main purpose of this includes the current dump, and when the bundle eventually pN:)er--explainirlg ALGOL 60 in terms of IAEs. comes to be activated, this dump is also installed. This process is to be contrasted with the activation of a closure, THE SHARING ~[ACIHNE in which the dump is used to record the current state in In [MEE] we described an abstract machine, the SECD- order that it may be resumed later. machine, capable of evaluating an AE. Although the value We call an expression of the form of an AE was defined independently of this machine, it was a(xr,.S) given a more definite status by being backed up by specific machine. The notion of the meaning of an IAE, a "progrmn@oint. ''3 IloughIy speaking, ALGOl, 60'S labels on the other hand, is completely dependent on an abstract are a special case of program-points. They are paramete> machine, the "sharing mactfine," for executiTtg IAEs -the less, and the Kbody is typically a functional product whose word "execute" seems more appropriate than "evaluate" terms correspond to the statements following the label. irt the case of IAEs. The sharing machine is an elaboration Moreover, references to both closures and program-clos- attd an ext.ension of the SECD-maehine. The elaboration ures are restricted in AL(~OL 60 in a way that prevents is concerned with modeling the fact that distinct state- them from being carried outside the scope in which they positions having equal occupants might "share" the same are produced. (In LISP [4] references to closures are free representation and hence get updated collectively. The of this restriction, hence the need for a chained stack. extension is concerned with the execution of the two new However program-closures art more severely constrained feaCures, namely assigners attd ,l (covered above), in that they cannot t)e carried into an inner scope.) The Transition Rule oj" the Sharing Machine. The main features of the elaboration are the following four specific INTROI)UCING. COY/MANI)S INTO A FUNCTIONAL SCHEME rules governing whether or not two state positions "share." Any attempt to tit most current programming languages For, each state of the sharing machine is characterized by into the AE/SECI) scheme involves the questions: Are an SECD-state together with an equivalence relation, commands to be construed as subexpressions and, if so, namely "sharing," among its component-positions. In the : what do they denote? In particular, what does an assign- straightforward computer representation, each equivalence merit denote and what does a jump denote? We postpone class corresponds to an address. For each slep we must these questions here (although claiming to leave them say how this equivalence relation changes. rather more clearly formed than we found them) by using When at, identifier is scanned, the stack head is left shar- another family of languages similar to the one associated ing with the environment position holding the identifier's with the AE/SECD system but differing as follows. value. Also wheu a closure is apt)lied , the youngest levelof The notion of AE is extended to comprise one new for- tlte new environnmnt shares wiCh any sm'viving "co- mat that models assignment. We characterize the en- sharers" of the old stack-head (i.e. the argument). As a eonsequen('.e of these two provisions a function can achieve a [ think this term is due to Peter N~mr. nonlocal effects by assigning to its formals (i.('. argunle~ts

92 Communications of the ACM Volume 8 / N,.nl,er 2 / Febr,,arY, 1965 m'(: c~Jlcd by "siz~q)h~ m~.l,m" [8] rechristened "reference" characterized by (a) the result produced by applying it to Jut (]1)[, [I 15 this is tim tl~ode used for arguments of Ii~oa'rRAN" each abstract object that is amenable to it, and (b) the re- fum:li(ms). 'Fh(T ~l,ls()e~lsure that no special provision is sult yielded by subjecting it to each abstract object that is re>coted for s(:mmil,g m, id(mli~ier when it occurs as the lhs applicable to it. o.1' nit ~ssigamr. Since (:.Ira classitic~,~t;ion of identifiers into With [AEs the situation can be very much more compli- (:o~sta, nis and variables is t~ot reNected in the behavior of cated. For each case of application the question arises, not, t;h(, machin% cot~slm,ls are not ir~vulnerable 1;o resetting. merely what result is loaded onto the stack, but also, for A l lfir(1 rule is lhal wh(m a closure is applied, the eom- each possible pattern of sharing throughout the current poHet~{,s of older levels (ff tlm r~(,w environlnent share with state, how it is changed, tIowever, in the case of the primi- corresponding cemponenls of the ettvironment from which tives we use to model ALGOL 60, it is possible to overlook it was derive(1. As :~ cons(,(tuetme of this provision, a func- most of this complication. All but two are straightforward tiot~ can achieve noldo(',td effects by assigning to its free functions without side-effects. The two exceptions are sepa- iclet/liiiers (inclu(tir~g (o constants). rate, and assignandhold, which is a dressed-up version of I/ourthly, whert a control string is exhausted the new the assigner format. For present purposes we can roughly sl;ack-head is left sharing with any surviving co-sharers of say that the meaning of an IAE has two aspects, a descrip- the old stack-head. This provision ensures that an appliea- tive and an imperative aspect, of which one or other may lion of a funclion cart be appropriate as a lhs, e.g. be unimportant. The descriptive aspect corresponds to the value, or denotation, of art AE. The imperative aspect cor- {x:,,. 'i]' (:~ = 0) (x, b)}[a] ~= --. responds to the change of machine state caused by execut- (x(). <.~)() ~ ..... ing the IAE.

7'he Function "separate". There is a function separate ALGOL 60 AS SUG~RED IAEs that (mables us to avoid nonlocal effects at will. That is to say, suppose tim c,urrent stack-head has been obtained by The sharing machine provides a precise criterion for the loading some environ men t component (e.g. the value of an correctness of the correspondence between ALGOL 60 and identifier of subscripted identifier); then if it is later in- IAEs, namely that they should have corresponding effects corporated in a new environment the above-mentioned when executed in corresponding enviromnents. On account provisions ensure (:hat any assignment to its new position of the absence of specified input/output facilities in ALGOL will also reset its old position. This is avoided if it is sub~ 60, the meaning of this criterion is less clear with regard to jetted to separate before incorporation in a new environ- whole programs than it is with regard to subbloeks, operat- menl. (There are other suggestive names for separate that ing on, and producing, the values of declared variables. are rejected here since ti~eir suggestiveness does not en- However, input/output devices can be modeled as named lists, with special, rather restricted functions associated. tirely avoid misleading: copy is used in Lisp [4] to mean Reading is modeled by a procedure (or function) that copying all components "down to the level of" atoms, i.e. operates on a list, resets it by removing some initial seg- components named by variables (as opposed to constants), ment, and also resets other variables with values derived whereas we postulate that separate insulates every com- from the initial segment (or, if a function, produces these ponent from future resetting; value as used in ALGOL 60 values as its result). Writing is modeled by a procedure coincides with separate in the ease of operands that are that, operates on a list, and appends a new final segment suitable lhs's, but has acquired too many mutually in- derived from other variables. (Alternatively, a purely con~patible connotations in discussing three relationships functional approach can be contrived by including the that we wish to delineate clearly, namely the relation be- transformed list among the results.) So no new principle is tween expressions and their denotations, between functions raised by input/output, nor hence by whole programs. and their resulls, and between slate-positions and their We give later a forinal presentation of a function that occupants.) associates an IAE with each ALGOL 60 program. This func- Executing an assigner. The lhs and rhs of an assigner tion is intended to satisfy the criterion stated above. Dis- can be evaluated in the same way as each other. The only covering whether it does or not is a task that can be ap- difference is that, (o be appropriate on the lhs, an IAE proached in two ways: either experimentally, using an nnts{ denote some previously produced object, for example implementation of the sharing machine; or with pen and a named object or component of a named objec|. Every paper, developing a proof. The length of what one accepts intermediate result of evaluation occupies a certain posi- tion i~ the curret,l s(ate of the machine; hence a lhs ex- as a satisfactory proof will depend on his intuitive grasp of pressi(m detern~ines a state-pnsition. Scanning an assigner component ideas used in the formalization. - resets this stale position and also every state-position This formalization determines the "syntax" of ALGOL t30 sharing wilh it; it leaves a nugatory result on the stack, in the special sense explained above. The identifiers oc- .amely nullist. curring free in the IAEs that model ALaOL 60, will be the 51'Ire "meanb~g" of an [A E. In the AE/SECD system, "constants" of AL(~OL 60 in our special sense. They con> each A I!] denotes an abstract object that is completely prise the nine standard hmction identifiers, the score or so

Vol,,nc 8 / Numl}er 2 / Fel,r,ary, 1965 Conummications of the ACM 93 of such symbols as +, < arid A, the mnnerical, Boolean either denotational or state-transformational. If the former and character-string constants, ~ handful of functions to it denotes either an integer, a real (we postulate two dis- deal with AL(~OL 60'S array and iteration facilities, and jtmet classes of absl?ract objects---so 3 and 3.0 are not another handful that are so unproblem-oriented that they equivalent), a truth-value or a character-string; or a list, are probably implicit in any tolerable language (in the array or function. State-transformational IAEs model sense that they would be needed were it subjected to the statements and labels; a switch is related to such IAEs it: treatment that ALGOL 60 gets here). much the same way as a vector is related to numerical By saying what each constant denotes, we shall be say- expressions. ing what are the "primitiw~s" of ALGOl, 60. The closure 4 Declarations are considered as giving initial values to under application and abstraction of this set of primitives the local identifiers. For instance integer and real identi- is the "universe of discourse" of AL(~OL 60. Actually, the tiers are initialized respectively to integer zero and real syntax of ALGOL 60 is such that some IAEs have no written zero. A Boolean is initialized to false. Switches and pro- representation, and even such thai) some meml:)ers of the eedures are initialized to vectors and functions respec- universe of diseoursc (for example flmction-produeing tively (and not subsequently reset). functions) are not denoted by arty text. Lists are characterized by the following structure deft- nition. Intbrmal Presentation of the Correspondence A list is either null, We now give a detailed but infornlal description of a or else it has a head (h), correspondence between expressions of Ar~eOL 60 and IAEs. and a tail (t) which is a list. The interest of this particular correspondence is that it is "correct" in the sense put forward above; i.e. correspond- TABLE 1 ing expressions executed in corresponding environments have corresponding outcomes. Subsequently we formalize ALGOL 50 IA Es the correspondence. However the informal treatment in- Identifiers, operator symbols, Identifiers also sonm special words and eludes some material not covered by the formalization, configurations namely a description of the " AL(mL 60 environment", Local identifiers Variables bound in a X-expres- i.e. the primitive objects whose names appear in the IAEs sion occurring as opert~tor that model ALGOL 60. If out' formalization were to not FormM parameters Variables bound in a X-expres- merely specify the correspondence but also prove its col sion occurring as opcrand Function designator, sub- Operator/operand combination rectness, then it would have to include a formM specifica- scripted w~rial)le, and pro- tion of these primitives. cedure statement There is often considerable choice of IAEs to model a Procedure X-expression particular ALGOL 60 expression. This is true even when the Actual parameter called by ( )-expression :I primitives and the "constants" that name theln have been naffle Occurrence of a formal called Application to null operand 6( chosen. In particular there is a conflict between using IAEs by name list that correspond naturally in each individual ease, and VMue part, of a procedure dee- Auxiliary definition qualifying using a uniform and easily specified rule. For this reason laration the procedure body, rede- the illustrations in our informal account sometimes de- fining some of the formals viate from the general rule presented it* the formal account Specification part Auxiliary definition qualifying the procedure body, redefin- !e that follows it. ing sot,m of tile formals 0[ Combination whose operator is BI¢IEF OUTLINE the block-body, and whose Table 1 gives a rough indication of the correspondence. operand denotes the (pos- There are two featureg of ALaOL 60 that give rise to par- sibly concocted) initial val- ues of the locals tieularly clumsy IAEs. Statement Expression denoting a none- 1. Own identifiers declared other than in the head of the adie function, changing the :i body of a globally declared procedure. enviromnent by side-effects eu 2. Conditional statements that are entered unnaturally Compound statement Functional product of none- (i.e. by a go to) and exited naturally (i.e. other than by adie functions Label Identifier defined by a none- a go to). adic program point Labeled seglnent of program Program point whose body, de- THE DOMAIN OF REFERENCE OF ALGOL 60 notes a none-adic function The corres'pondence given in this paper associates with go to--statement Last (i.e. outer) term of a time- i each ALGOL 60 text an IAE whose principal significance is tional product Switch Vector of progranl closures Conditional expression or Selection of an item from a 4 In the usual algebraic sense, not the special sense attributed statement listing to this word by me here and in [MEE].

94 Communications of tile ACM Volume 8 / Number 2 / Febrnarv. 1965 I~ our model every procedm'e, switch and array operates These are "pared down" to finite vMues at the first entry

(,valuated in tile right-to-left order. Hence in transcribing Folk-LIsTs from AL(;OI, 60 to IAEs tire order of the items of every listi~g (including the implicit listings of operands of +, Let us use the term "control-list" to mean the list of suc- =, eic.) must be reversed. This minor complication is cessive values assigned to the controlled vm'iable during avoided here by adopting a different arralysis of listings, by one execution of a for~statement. The point of departure of which our treatment of for-statements is that a for-list might roughly be said to "denote" the control-list, with each :/br- (a'+b, c+d, e-f-f) list-element denoting one segment of it. This suggests the following incorrect rendering. is (:(msidered as a convenient way of writing for v := a step b until c, forty, s~ Uix (e+ f) (sujlix (c+d) (su fflx(a-f-b ) 0)) d, concatenate (step(a, b, c), e while p unitlist (d), (1) mighl alternatively have been avoided by varying the do T while(e, p)), cvahlatiou me(:hanism so as to evaluate operators before T) op(~rands. In view of the limited form of operalor occurring i!~ AL(;OL (i0 such a change would have few other reper- where jbr, concatenate, step and while are defined as follows. ~ vus:dons. ) reefor(v,S, 7') = if -7 nullSthen [v := hS; There is no fealure of the eorrespondence that "explains" 7'; ilw [eft-lo-right rule of ALGOL 60. IIl this respec.t the for (v, t,g, T)] ('or~'e('tness of tire model depends on a similar rule for ree concatenate S = null S --~ ( ) null(hS) ~ concatenate (tS) IAEs. We can put this another way. The correspondence else --~ h2S :concatenate (t (hS) :tS) pr(stmted i~ this paper "explains" semantic features of reestep(a,b,c) = (a - e) X sign(b) > 0 --~ ( ) :\L(~o~, 60 i~ lerms of syntactic , or more precisely strue- else -) a:step(a+b, b, c) luraI, feaiures of IAEs. But the left-to-right rule is a rec while(e, p) = p --~ c:while(e, p) s

Volume 8 / Numl)er 2 / February, 1965 Communications of the ACM 95 ftowever, the user of a purely functional system (i.e. ing of ewfiuation. The best that can be done is to introduce AE/SI)X?D rather titan iAE/sharing machine) would have a new syntactic device whereby for any two expressions L, no way of telling whether his intern lediately resulting lists M were in fact being streamed or not, since the only differ- L:*M stands for X().(L,M) enccs in outcome arc concerned with the amount of store used, or the range of jobs possible with a given size of We now define functions that correctly mirror A.LC0L store. On the other hand, the introduction of imperatives 60'S three kinds of for-list-eleme~lt. makes it possible to write list-expressions whose outcome tee step*(a, b, c) = is affected by whether they arc represented as streams or X().[(a'-c') X sign(b') > 0] -, ( ) not. Hence it) t)ecomes necessary to introduce a new sat of else ~ [a', step*(X( ).a'+b', b, c)] identifiers that play tile same role for streams that h, t, where a', b', c' = a( ),b( ),c( ) etc. play fort' lists. The next subsection is concerned with unitlist*(a) = a( ) :* nullist* these operations. ree while*(e, p) = X( ).p' ~ [e', while*(e, p)] else --~ ( ) where #, p' = e(), p( ) STREAMS There is a relationship t)etween lists and functions that The matelfing definitions for concatenate* and Jbr* should be obvious. is used here in modeling for-statements (and would be used The above formulas reflect certain choices of AL(;OL 60'S to model input/output if ALGOL 60 included such). In this designers, e.g. relationship a nonnull list; L is mirrored by a none-adic (a) that all parameters are evaluated "when they are function S that produces a 2-list consisting of (1) the corme to," rather than e.g. evaluating the parameters of a head of L, and (2) the function mirroring the tail of L. step-element (arithmetic progression) all together; The common functions, etc. associated with lists are (b) that the decision whether the current iteration is mirrored as follows. the last is taken after it, not before it; (c) that arty resetting of the controlled variable during wullist X(). ( ) null (b) null (S ( ) ) the execution of the for-body affects its subsequent values. head(L) 1st(S( ) ) That is to say, had different choices been made in these lail(L) 2nd(S( ) ) matters, then a different IAE, or different definitions of pr~fix(x)(L) X( ).(x, S) tile auxiliary functions involved, would have been needed cons(x, L) x( ).(*, S) to mirror for-statements. unitli.st(x) x( ).(x,x( ).()) lit is easy to see tihat the first five expressions on the TYPES right satisfy tim four relationships that characterize "nullist, Roughly speaking our model deMs with types "]nterpre- null, h, t and prefix. tivcly." Specifiers in ALGOL 60 affect the prescribed out- null (nullist) null ( {X (). ( ) }[ ]) come of a program only by causing transfer between real -qnull(pr~fix xL) --nnull({X( ).(x,S) }[ ]) and integer, or by rejecting an argument outside the h(prefixxL) = x lst({X().(x,S)}[ ]) = x specified class. We suppose that associated with each t(p,'efix xL) = L 2nd({X( ).(x,S)}[ l) = S specifiable (:lass there is a transfer function whose range This correspondence serves two related purposes. It is within that class. For instance, float is defined for num- enables us to perform operations on lists (such as generat- bers, i.e. for reals and integers, and leaves reals unchanged; ing them, mapping them, concatenating them) without similarly with unfloat, which is prescribed in the Ar~oo~, 60 using an "extensive," item-by-item representation of the report to be defined by intermediately resulting lists; and it enables us to postpone unfloat(x) = entier(x q- 0.5) the evaluation of the expressions specifying the items of a list until they arc actually needed. The second of these is The transfer function for truthvalues is merely a very what interests us here. limited form of the identity function that is defined by The expressions that make use of this technique can be rejectallbuttruthvalues(x) = Boolean(x) --~ x made slightly clearer by using the following definitions. (Here Boolean designates the class--or predicate, we do nullist* = X( ).( ) not distinguish--whose members are the trutllvalues. A null*(S) = null(S()) h*(S) = 1st(S()) conditional expression none of whose conditions hold is U(S) = 2rut(S()) taken as undefined.) More generally we define a functiortl However, the analogous definilions for the constructors in as follows: cannot be used since they would not preserve the sequenc- in(A) (x) = A (x) -~ x

96 Communications of the ACM Volume 8 / Number 2 / February, 1965 ro&i so ~hat if ..t is tt (:lass the(, i'nA is a filter that rejects non- fornling and string-forming functions as: decimal(re,n)= lOre + n; qttoge(s) = concatenate(u' r , ~, 'u' " ').) ior~S members of A. For example bz(Boolean) is the function rejectal~bullrutkvalue.s" defined above. So the transfer func- Group 2 consists of symbols and identifiers whose meaning ~s laid down in the ALGOL 60 report, and also a number of identifiers tions for Booleatls and strings are respectively in(Boolean) coined by us and explained above. We assunm that any collisions and in(string). between these coinages and Ar~aor, 60 identifiers are avoided by The ftm(',tion defined by some device such as the use of a different typeface, e.g. italic instead of roman. /loat,es.lt (f) (:~:) =/teat (f (:r ) ) +, -, X,/, +, T, +~r, -~z, <, =<, =, ~, >, ~, -~, A, V,

transforms any number producing function into a real- abs, sign, sqrt, sin, cos, a,'etan, In, exp, e'ngier produ(:ing function. (This definition exploils the fact that The infixed operators are taken as (applying to 2-lists, either 2- we consider any function as operating on a sz:ngle argument nulnbcr-lists or 2-Boolean-lists. Numerical functions are applic- allbeit a list.) More generally, it' t is the transfer function able to both reals, and integers; if n andfloat(n) are both amenable to a fimetion then they yield the same result. The coinages are for some class A, then the traHsfer function for A-pro- for, concatenate*, step*, anitlist*, wh.ile*, expandtoarray, ducers is Bt, where B (Curry's combinator B [2]) is de- arrange~asarray, parearray, float, .w~tJtoal~ [n> real, integer, fined by Boolean, string, atom Gro~tp 3 consists of names for very basic objects. ho~£ Bq?: = t@c) null, nullist, suffi.x, {f, B, K, [, Y, separate, assignandhold null is the predicate that tests whether a list has zero length. ~ 60 So for instance Bfloat is the function floatresult defined nullist is a list of length zero. above. The transfer functions for type-procedures are s'u~x makes a list one longer, e.g. ya therefore Bfloal, Burtfloat and B(in(Boolean)). Since ar- s'aflix(x) (a,b,c) = (a,b,c,x} if satisfies the following: 0i: rays are treated as functions these also serve as transfer if(true) = 1st ftllletions for arrays. if(false) = 2nd o~} Imperatives arc treated as nullist-producing furmtions; B forms a functional product so it would appear that the best we can do fern transfer B(t)(f) = hx.tff(z)) 2i'i~: function for lahels is B(bt(null)). Hence the transfer fune- It is used lit dclaying transfer functions for type t)roeedures and formals called by name. ]t1~ (.ions for nontype procedures and for switches (which are K produces "constant functions" ;|le! considered as arrays whose elements are program-closures) K (x) (:/) = x is B(B(in(null))). So for instance K3 is a function whose result is 3 for any argu- M~, The effect of the at)eve provisions for checking argu- ment; it is used to tidy up assignments. ments is tht~t a mismatched procedure, array, label or I is the identity function, defined by [ (x) = x switch is not itself immediately rejected. Instead it is modi- it plays tim role of dummy statenlents. fied so that any result it produces, whenever and if ever it Y is the "fixed-point finder." In so fat' as it is reasonably repre- is applied, is rejected. Hence our model is overtolerant in sentable it can be defined by pr~ that a mismatch will not lead to rejection if the procedure Y(F) = let z = separale(nullisl) at1*:- is never applied, or if it is exited unnaturally and thus let z' = F(z) 2nd((z~z') ,z) tea evades producing a result. Furthermore, a label denotes a This definition relies on the fact that when a function-trans- t,~i,: program-closure and so even when its result, namely former is applied to the (arbitrarily chosen) argument nMlist, a,5: nullist, is produced, the context is never resumed and so rejection does not occur unless, or until, the argumcnt is n~: the cheek never occurs. Hence tile identity function serves actually applied. tli equally well as transfer function. separate avoids unwanted side-effects; it is used when parameters are called by value. ed: assigmtndhold is defined by THE CONSTANTS AND PRIMITIVES OF ALGOL 60 assignandhold(x) (y) = let x = real y -~ float x integer y --~ unfloat a: The correspondence given in this paper associates with Boolean y --~ in(Boolean)x each ALGOL 60 text an IAE in which the identifiers occur- 2nd((y~x),x) ring free are drawn fi'om the following three groups. In this subsection and the four preceding ones we have Group I consists of the arithmetical, Boolean and string con-- slants. An arithmetical constant is an unsigned number as defined characterized the abstract objects comprising the "domain in the AlmoL 60 report, and designates an integer or a (rationM) of reference" that our analysis imputes to AL(~OL 60. The real. However the integers also include '-~' and '+ co ', used in characterization has been partly formM and partly in- the initiM array bounds of own arrays. The Boolean constants are i; formal, taking for granted such things as numbers, propo- 'true' and 'false' and designate the truthvMues. The string constants are certain character-strings whose first and last items sitional relations, ere? Ia the next subsection we turn to the are ' ~ ' and ' " ' , respectively; such a constant designates the main (.epic of this paper, namely how ekLGOL 60 texts can string obtained by removing its first and last items. (It would be be construed as IAEs referring to these abstract objects. possible to avoid an infinity of primitives by considering each written tmmbcr and each charaeter-string as having internal r In [9], BShm is concerned with the formal treatment of this applicative structure. These might conveniently use such nmnber- topic.

Volume 8 / Number 2 / February, 1965 Communications of the ACM 97 not every occurrence of the charael~er-striug 'a÷b' i~t ILI,USTI{ATIONS OF THE (JORRESI?ONI)ENCE Ai:OOL 60 corresponds Io (he IAE "+(,,, b )" -witness if ~ tb l';aci~ example bek)w illustrates the correspondence be- 'cXa+bXd'). 1we(',t a pariicular fealuve of MX;OL 60 and a p~rticular Variables. The (,rea(ment~ of individual idea(fliers has ~0 tb( f(~alm'e of IAEs. That is to say, each example illustrates a already been explained. In summary rule tk)r eliminating a particular feature of ALGOL 60 in *k se (('rms nf IAEs. In order (o turn a piece of Aix~oL 60 into all Iformal called by name x( ) /;lo, {type procedure as lhs x* ~d~0se IAE it will usually be necessary to make marw successive x Jparameterless procedure x( ) applications (if (hesc rules. Ii,1 some of the examples the ~own identifier xt,x +), etc. i id~0s( lr.at~sformalion iulo an IMi; has been only partiMly per- (strMghtforward z i L?as~I for,ned lo [)el,ler emphasize the particular poin(~ being If all the identifiers i~lvolved are straighlforward the { c0flc0 made by th(' examt)l('. So (he right-hand half of aft illustra- treatment of subscripted idetttifiers and funet, ion desig- ~ eedtlr lion nla.y not always c(mtail~ au [AE, but, it always con- ' itliiia; nators is as follows. lains somelhing ihat is nearer to one of the four forms of A [i + j , k} All+j, k) nle~lt~ I:\E lh:m the h,fl-hm~d, A[:a~L 60 expression. f(a;+y, Z) f(k( ).X@-y, X().Z) )d'[ [deat(fic:r.~. Exeepl; for the (realment of individual oc- Tt le transformation of actuM parameters into none-adie 'e.~.~' curr(~,mes ()f idenlifiers, the correspondence is context in- array depend(~n[. Th(,, IAE corresponding to each occurrence of functions is associated with the possibility that a pro- 0at,1 an Aid(at[, 60 i(le,difier dep(mds oft (he way the identifier ccdure might call its formMs by name. It is conqfiemcnted locals by a peculiarity in the treatment of proeedure decla'a- is declared or otherwise introduced, as follows. Heat I. Whe,,eve,' a local declared to identify a type pro- tions as noted below, de~JI cedure occurs as a leftdumd side wilhin its declaration, it If the identifiers involved are all formals called by name then the transcription (o .t~ r~s is is tel)laced by a vm'iant i(lcntifier, indicated here by dote- ihey ruling it with an aslevisk. We call this the result variant of A( )(i( ) +.i(), :c()) "self lhe procedure i(le~lilier. ~leeO 2. Every ocem'r(qme of a formal not specified by value, f( )(x( ).x( ) + y(), x( ).~()) d~,~ or of a h)cal dechu'ed (.o identify a parameterless pro- ¢leel~ cedure, is (pt'ovided I does no(apply) modified by attach- In the las(~ example, 'X( ).z( )' can be replaced by 2'. h~ future illustrations all occurrences of' identifiers are as- ing an emply op(!rand listing to i(. This is indicated hero by a~ia, a, empt.y bracket pair. Thus we t rea( actual parameters sumed to be straightforward unless the reason for non- s(,raightforwardness is contained in the example. Any ~0~ ca/led by t,tttue, and l)arant(~t(wh~ss procedures, as Ii()ll(}- B adie hmctio,s. nonstraightforwardaess would involve superimposing the 3. ()wns m'e {;rea{ed as globally declared and are replaced appropriate treatment on any other transformations that by variams to avcd collision between two (:lcclara.tions of are. needed, are Expressions. tile3 the same identifier. These wwianIs ~r(~ eMled own variants ii0~) of the identifier appearing in (:he (cxt and are indicated a + b + (su.Nz b (suEz a ())) I)r0, here by decorating il. with (me or more daggers. (This is one of the two (msat;isfacl;ory fealures of (;he correspond- In future illustrations (as in previous ones) the trcatmet/t ?l~( enee between A L(am 60 and IAEs. Which party is to blame of argument lists, as also usually of infixed operators, will beg is a (tuesliot~ we return Io later.) be taken for granted. [[ere is an example of these substitutions, --a + b +(--M(a), b) begin begin The symbol --M designates the monadic function %egate." L own iul:eger a; ow~t integer ai; / ,}. real proeedurefOc,y,g); own real aH; a+b-c+d + (- (+ (a,b),c),d) value x; real :c; real procedure f(x,y,g); This example shows how "left association" is reflected ' begin value x,y,g; 12. own real a; begin (as opposed to the left-to-right rule which is quite in- :~,:=*+g(y)+a; y( ):=z+g( )(y( ) )+act; dependent). The following examples show how the "pre- .f:-=k(f,(l,f(z,Y,J)) f*:=k(f,g( ),f(x,y(),j)) cedence" rules are reflected. end e,~d real proee(lure h; real procedure h( ) ; cXa+bXd + (X (c.,a), X (b,d)) h:=k(f,j,h); h*:=k(f,j,h( )); a:=fO,h,f) at:=f(at,h (),f) a-b/c ~ d - (a,/(b, T (c,d))) 'l'I end end aTb/c-d -(/(~ (a,b), c), d) ~0]iol With the exception of these provisions each subsequent pAqVrAs V(A (p,q), Aft,s)) (~1 example is self-contained; timt is to say- the given bit of Conditional expressions use the funeti(m if, such that /'e AL,OL 60 corresponds to the givea IAE whatever its context (provided it is grouped sensibly--for instance, if true = 1st i~ if false ~ 2rid 98 Comntunieations of the ?kC~t,| Volume 8 / Number 2 / February, 19~i5 I~ l'seudoblocks. ~Fhere are three contexts that may or ifp Ih,m a else b (V p) (k( ).a, ,all.b)() may not be occupied by blocks, but are in any case like bloeks in the treatment of labels. These contexts are pro- So (b(, ('valu:~,ti<)J~ (>l' tl)(~ :/bov(~ /AI,; irlVOlVeS selecting ()n(~ cedure-bodies, tbr-bodies and whole programs. We call from a lisl <>l' lw() i~()H(>~Mic [un(:li()ns arm tlmll applying them pseudoblo&s. Whole programs must also be qualified the s(q('('i(,d (m(, t() the mtllis[. by a conglomeration of all the own-declarations that, occur li&c/,.w. Eacll (t(,(:/~rali()tl is (~or~sirued as a definition in the program. Their role in a pseudobloek is the same as whos(~ (l(qi,~(,(~ consist s of (me or more local i(tc,d.ifi(~rs and that of the nonrecursive declarations in a block. whose (t(,IiHic~s (h,t~ol(>s i~fitial values for (henl. In the Declarations. case of lypc atl(l arrtty (hwAarations die initiM value is conco(.~(~ swil(:h and pro(:e(ture ideatitiers.) Array decl:~rations are ini(ializcd in terms of nonlocals By initializing every local identifier, IAEs impute meaning (e.g. a procedure identifier declared in parallel with an to certain ALl,eL 60-like programs to which the ALGOL 60 report prescribes no lneaning. The use of separale prevents array carmel be used in the array bound expressions). subsequent assignments from altering the environmental On the other hand swilches and procedures may refer to objects designated by '0.0', '0' and 'false'. locals, i.c. to arrays, reMs, etc., and also to each other. ttence tsrray defiuiiions (tualify switch and procedure real array all:j, k:l] let a = expandtoarmy((i,j), (k,1)) definiiions (as well as tit(, blo('k body). Whereas switch (o.o) integer array a, b, c[i:jll let (a,b,c) = and proce(ha'e delinitiotts do nol quMify array definitions, (separate A, separate A, they do qualify themselves; that is to say they may be separate A) "sclf-referetdial," i.e. "circular" or "recursive." We where A = expandtoarray accordingly speak of "recursive" and "nonrecursive" (u (i,j)) (0) definiiions or declarations. This dichotomy leaves type array a, b, ell:n], d[l:r,l:s] let ((a,b,c),u(d)) = declarations uncommitted since they contain no initializ- ((separate A, separate A, ing expressiom If {hey (lid it would be difficult to meeh- separate A) where A = expandtoarray allize sclf-referet~tial :initializations (e.g. tee x = x~--k }); (u (1,n)) (z), SO We class (,tleIll as nortrecursive. unitlist (separate A) 1)efinitions can also arise front the block-body----their where A = expandtoarray definees being (he labels that are local to tim block. These ((1,r), (1,8)) are defit~ed itt terms of locals, inehtding each other, and (x)) where x = 0.0 they may be referred to by procedure and switch declara- switch S := L, M, N let S = arrangeasarray lull,3)) tions. Hence labels ,nust be grouped with switches and (L,M,N) procedures as a single simultaneously re('ursive definition. The overall treatment of a block is therefore as follows. A procedure declaration is treated as a definition whose defiifiens is a X-expression. Our treatment of actual param- begin real a; let: a = qst eters matches that of formals called by name. So if a array A 6~ ; and A = ~2 formal is called by value the procedure body needs some procedure t" 4,a ; let tee P = ~a switch S r& ; and S = 44 decoration. ¢~ ; andL = q~6 procedure f@,y,z); let f(x,y,z) = let x = separate@()) L: ¢~ ; andM = ¢7 value x, z; and z = separate (z()) M: ¢7 ¢~ i.e. let f = X(x,y,z). i.e. {x(x,z).¢l [separate (x ( ) ), separate (z ( ) ) ] {X(a,A). {X ( I',S,L,M).@,} If separate were omitted the effect would be that of "calling [ YX (P,S,L,M). (6~,0.,,0~,00] } by simple name." [¢~,6d Specifiers also involve decorating the body. q'he d(qailed structure of the 4's is ttle subject of the procedure f(x,r,p) ; let f(x,r,p) = followi~g sections. In the last example, and in some that wdue x, r, p; let x = separate@()) follow, the [AE was prese, d('d twice, in a less and more real x; and r = sepmute(r()) formal ~aota/iou. This emphttsizes the fact that the cor- integer r; and p = separate(p()) Boolean p; let x = float(x) respon(hmce being illustrated is between ALl, eL 60 texts S(x+r, p) and r = unfloat(r) and (.,erlmn abstract ()t)jects, not written representations of and p = in(Boolean) (p) them. S(x( ).x+r, x().p)

~olume 8 / Numl)er 2 / Fel)ruary, 1965 Communications of the ACM 99 The specification of a formal called by name involves Since the execution of the IAE assigner format makes no ! thee preparing to transfer its result. provision for type transfer, assignment statements are beinl rendered in terms of assignandhold. i 01 procedure f(x,r,s,P); let f(x,r,s,P) = see0] value x; let z = separate@()) a := b-{-c x( ).K( ) (assignandhold(b+c) (at) real x; let x = float(x) a[i,j,k] := b÷c X( ).K()(assignandhold(b+c)(a(i,j,]c))) ifp integer r; and r = Bu,nfloal(r) string s; and s = 13(in string)(s) The operator K( ) is needed to ensure that an assignment L~ real procedure P; attd P = B(13float)(P) produces nullist. h'0n~ p(x+~., .9 t'( )(x( ),z+r(), x( ).,X )) iS re, a := b := c := d+e X( ).a := t0 s', This treatment of procedures as arguments might be clari- assignandhold(assig'mt~thold(d+e)c)b ad fied by observing that it suggests a particular extension of ALGOL 60, by which, for example Compound sta(ements are considered as functional products (which we indicate informally by infixed dots). ~oih if a

letf(y) = ay~ + by + c if p then begin P; Q end if(p)(x().x().Q(p()), bloel else begin R; S end X( ).X( ),S([~())) ail~( There are two provisions needed in general for rendering () Z~r0 AIXrOL 60 that are otiose in this particular example: (i) of t:t Here some abbreviation is possible, namely the ability to reassign to the result variable and to include assignments to other variables, arid (it) the ability to call if(p) (x( ).Q(P( )), 8I parameters by name. x( ),s(~())) %k Slatements. Each statement is rendered as a 0-list- But this is not always so. For example in transformer, i.e. a none-adic function producing the nullist for its result. It achieves by side-effects a transformation of if p then P(x,y) if(p)(X( ).P(X( ).x, X(),y), else R(u,v) X( ).R(X( ).u, X().v)) the currenl state of evaluation. () lO0 Comnmnications of the ACM Volume 8 / Number 2 / February, 1965 f01/, a ~:: tile eorresponding f~bbreviation would result in both arms procedure would share their own's or not, accorditLg as mi:,~ bei~g exeeut:ed. they were activations of the same life of {lie procedure or : ()tie-armed conditionals are filled out with dummy of two nesting lives. This meaning of own almost exactly S~'COlld gI'lllS ; coincides wilh lhe generally accepted meaning, if own's if p then begin P; Q end if(p)(X( ).Q(P()), I) are restricted to the heads of (he bodies of procedures declared in the head of the whole program.'-' g~, l,c~belaand J'ump.s'. The treatment of jumps springs from the observation that the symbol 'go to' in AL(~OL 60 Conclusion is redundant, and could be ignored by a processor. That is {~) say, there is a considerable similarity between labels Oile little SUl/g use of ALGOL 60 has been as a standard grad the identifiers of parameterless not,type procedures. with which to describe and compare olher languages. Its i{i} I~ is possible to use the same "calling mechanism" for suitability for this role arose fi'om being described with ..o;!~ t,oih, leaving any differenees lo be made by the thing that, remarkable precision, and from its greater power and is "called." Thus there is a natural meaning to be given to elegmme, so that its own idiosyneraeies and limila|ious a program that, at, different |in-ms, substitutes labels and did not overshadow those of the languages being measm'ed procedures for the same formal, e.g. against it. el:2 pr( eedure P; The language of IAEs is put forward here for eonsidera ria if p then go to M; lion as a further step in this direction, and the supporting evidence is a detailed mapping of A[~(a)L 60 into IAEs. So L:.. far in this paper we have Iaid the groundwork for the .... f(P) .,.f(L)... mapping, namely a description of the "primitive objects" l i might therefore be supposed ~hat labels can be elimi- it refers to, and we have given specific instances of ils ~mled formally by considering each labelled segment of application. The remainder of lhe paper is devole(t lo its formal characterization. pl'ogram as a t)arameterless procedure declaration (and 7e, helme as a definition whose definiens is a X()-expression). REFEI~ENCES ?, The present purpose is semantic specification, not cheap ~.~ rulming. So this device is not invalidated by the fael that 1. BArtRON, I). W., BUXTON, J. N., H~t.lt'rI,l.',y, 1). F., Nlxox. F,., i~ involves aeeumulating a pile of "resmnption points," +~ml) STI{ACItE'(, C. The night features nf ('1+1,. Co+~+p++t,+1+ o~le for every exeeuted jump, that are never taken up. 6, 2 (July 1963), 134-143. 2. C[~[tlCC, H. B., AND FE'~'S, l{. Combinalortl Logic, l'~d. 1. tlowever, the device only yietds a valid treatment of pro- North [lolL'm(1, Amsterd~un, 1:)58. (>(lure exits at the cost of abandoning the facility for B. LANDtN, P. J. The mechanical ewdu:tt.i semantics. Presented at IFIP Working Conf., Baden, Sept. ruinous with the life of their procedure (which may include 1964. 12. C()NWAY, N'[. ]!'~. I)csign of a separable trartsition..diagram zero of more activations of the procedure). One consequence compiler. Comm. ACM 6, 7 (July 1963), 396-408. ()f this would have been that two nesting activations of a

s In [11] van Wijngaarden meets this point by using an explieib 9 For fuller discussion of the present approach to labcls ~nd " )k: ~ as an extra parameter to each procedure. own's see [10l.

~, ohtmc 8 / Number 2 / February, 1965 Communications of the ACM 10/