
/ f .. X X THE COMPILER-COMPILER IN A TIME-SHARING ENVIRONMENT t J. A. Feldman Massachusetts Institute of Technology ft Lincoln Laboratory* Lexington, Massachusetts J.E. Curry Adams Associates Massachusetts It has become increasingly clear that in the Definition of a Compiler-Compiler future the use of near creative computers A compiler-compiler is a program which will deal almost exclusively with interac- will produce a translator (compiler) for a tive time-shared systems. value The of in- programming language from a suitable def- teractive has been programming estab- inition of that language. A generalized lished, and cost considerations make time- block diagram of a compiler-compiler is sharing of large machines the best current in Figure, 1. a compiler for for such .shown When vehicle systems. The central ques- some language L, is required, the formal tion is how to improve the services a us- to syntax ol L, expressed in a syntactic meta- er keeping cost while the of compulation language, is fed into tin; Syntax Loader. within bounds. In this paper we will con- sider the role of a compiler-compiler in This program builds tables which will con- lowering the costs and extending the cap- trol the recognition and parsing of pro- abilities of an interactive time-shared sys- grams in the language L. Then the seman- tem. tics of L, written in a semantic metalan- guage, is fed into the Semantic Loader. The discussion will be based on the ex- This program builds other tables contain- of the compiler-compiler, VITAL, ample ing a description of the meaningof state- within executive; as it functions the sys- ments in 1.. These tables are imbedded in on al Lin- tem,APEX, lhe'l'X-2 Computer a Basic Compiler which consists ol code coln Laboratory. Although llie examples generators,inpul-oulpu Iand auxiliary rou- are specific, we will concentrate on points tines. which seem lo be ol general interest. VITAL has been running since early in 1 .66 and has been used for designing some Tin; resulting compiler is a table-driven special-purpose languages. It is based on translator based on a recognizer using a t the coiripiler-eom. filer, I'SL, developed by single pushdown slack. Each element in i one of the authors al Carnegie Institute ibis slack consists ol two machine words of Technology. Since the structure (2,.i) one lor a sy lilac lie construe! and Ilie oilier and.use (6) of I'SL have been reported in holding the semantics of Ihe construct. .Mime detail elsewhere, we will present When a particular syntactic construct is only a capsule description ol Ibis com- recognized, its semantic word and llie se- piler-compiler. mantic tables determine whal actions the translator will lake. Operated with support from llie U.S. Air Forr c Bedford, .. I SOURCE CODE IN L T A SYNTAX OF L SYNTAX LOADER B L E_ BASIC T COMPILER SEMANTIC A SEMANTICS OF L LOADER . B L MACHINE CODE E > Figure 1 A COMPILER-COMPILER The syntax of the language L, is described i Now suppose 'X' isrecognized in an arith- in a form of Production Language (3,4). metic context, say '+X\ The associated The semantic metalanguage FSL, is not as semantic routine might be: well known and will be discussed briefly TEMPOSYMBOL .DATUM, SEMANTICS} here. The semantic description of a trans- IF TEMP IS FLOATING THEN lator is a program in the metalanguage DATUM«-TF.MP ELSE FAULT 1 containingstatementswhich generatecode, The datum is looked up in the symbol ta- slate translator, or both. change the of the ble and the matched row is selected. The SEMANTICS(second)entryof thematched row is stored into the temporary cell. If Semantic Statements ibis word has been laggedor. 'FLOATING', il is assigned as the local meaning of 'X' Let us consider the semantic statements and translation continues. If the identifier which might be associated wilh various is of the wrong data type or is not in the constructs in a simplified ALGOL. The table at all, the statement FAULT 1 is ex- semantics of a declaration 'REL X might ecuted. This causes the printing of an er- be expressed: ror message on the listing of the program ENTERLSYMBOL, DATUM, being compiled. The semantic, statement (STORLOC | FLOATING)}; would actually have to be augmented to STORLOOSTORLOC + 1 treat constants and other legal arithmetic data types. Thisslalcsthatan entry (row) istobemade in the symbol table. This row will con- Finally, let us consider the semantics of a sist of the datum (X in this case) and the statement "(Y + X)". The parenthesized contents of STORLOC lagged as a float- addition is complete, so a compiler would ing-point number. Then STORLOC, the presumably generate code at this point. system pointerfor datastorage, isincreasetl The semantic language statement by one. The entire routine has the effect CODE (DATUM 1 + DATUM 2) of assigning a location, to be kept in float- has precisely that effect Tint code brack- ing-point form, as the local meaning ol ets "CODE ("and")" play an essential rob; the identifier 'X. in the compiler-compiler and warrant fur- r .—"' ther discussion. Any construct enclosed utives are being developed for machines in code brackets specifies an action to be which incorporate many features designed performed at run time; any construct not for this purpose. For example, consider- so enclosed specifies an action to be per- able effort has gone into making the state formedat translate time. An example may of the machine easy to save and restore. help clarify this point. One of the most significant hardwarefea- FSL Translation tures is dynamic memory allocation. Since the system must rapidly alternate control In FSL as in many translators, the seman- amonguser programs, it is important that tics usually associated with an operand is as many of these as possible be in main a lagged machine address. If the FSL ex- memory. Further, since the mix of these pression 'DATUM 1 + DATUM 2' appeared programs is not predictable, the memory outside code brackets, the two addresses sharing cannot be scheduled in advance. would added. be This might be used in a By providing suitable hardware one can al- compiler for computing a new address to low the compiled addresses to be trans- and as in be lagged used. If, th*. example, formed and checked at every access [1 ]. the. expression were 'CODE (DATUM 1 + In such a scheme, programs may be dis- DATUM 2)', an mean- entirely different tributed in memory at addressesother than ing would result. In this ease the addition those in the compiled code. would be at run-time, the addends being the run-lime wjntenls of tin; twoaddresses. Most FSL constructs will have two mean- APEX System ings dependingon whether or not they are inside code brackets. The TX-2 time-sharing system, APEX, is based on one such scheme. The particular The major innovation in FSL was tint ma- address transformation used in APEX has chine-independent description of seman- been discussed in [ 5 |. It is based on a tics. Several other compiler-compilers have thin-film memory which contains a trans- been implemented |9], and il is not our form for every page (256 register block ) purpose here to compare them. What we active in a user s symbolic memory. The will examine is the advantages gained and symbolic memory is divided into maps difficulties encounteredin embedding such (130, 672 registers) each consiting of 16 a program in a second- generation lime- books. A file is a named entity which may sharing system. occupy one or more books. A user program I lardwareDifferences will be dealing with only one map at a given moment,but changing maps is easily The distinction between generations of accomplished. The memory-sharing feature time-sharing systems can be made most of APEX and any comparable system is clearly in terms of hardware. Any time- closely related to the swapping scheme. sharing executive embodies an attempt to Oik; of the unusual features of APEX is provide last response and v.ariely of user that entire files arc swapped. This proce- services without excessive overhead; these dure is followed because there is no differ from the conventional multi-proces- swapping drum and is not generally advan- sing monitor mainly in tin; rapid switching tageous. The APEX page at 256 words is ofusers that isrequired. Tin; early systems closer to the common unit ol memory [8, 11] were implemented on machines swapping. This peculiarity of APEX will, which were designed for batch-processing however, allow us to measure directly and thus had limited capabilities and goals. certain parameterswhich would otherwise The second generation time-sharing exce- only be availableon a statistical basis. t -—► In addition to the hardware modifications, individual compilers, but also among all^ several programming developments have compilers within the system. To illustrate aimed at reducing the cost of switching this sharing we will consider a particular users. The most significant of these is the example in some detail. widespread use of programs which modify only a fixed block of working storage Program Sharing execution. pure during These so-called The example is based on the construction (reentrant) procedures can be shared by and use of a subset of ALGOL called the many users; switching the user of a pure Small Language [2, 3]. The three basic procedure involves only the swapping components of VITAL as depicted in (relativelysmall) working storage area. Figure 1are the Basic Compiler, the Syntax. Loader and the Semantics Loader. Each of Pure procedure techniques are especially these is assigned a separate APEX memory valuable for large programs, which are map,schematicsof whichform Appendixes used by much of the user community.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages8 Page
-
File Size-