Bell SAP(ID:5635/bel003)

SAP with conditional and recursive macros 


SAP extended to include conditional and recursive macros: the beginning of the great macro-language tradition at Bell Labs (everything from L6 and AMBIT to C)

Places
People:
Related languages
Macro SAP => Bell SAP   Evolution of

References:
  • Eastwood, D. E. and McIlroy, M. D. "Macro compiler modification of SAP". Bell Telephone Laboratories Computation Center, 1959. view details
  • Arden, Bruce W. review of McILroy 1960 view details Abstract: This paper describes a form for defining new operations in terms of a basic assembly-like language and other defined operations. The use of such macro-instructions provides a concise way of describing complicated procedures The author describes and illustrates with examples the important features of these definitions such as (1) the ability to refer to other definitions, (2) the indication of a reference hierarchy by parentheses, (3) the ability to conditionally include or exclude instructions, and (4) the ability to create floating addresses. An application of these techniques to writing algebraic compilers is briefly indicated. This application deals only with fully parenthesized expressions and it is not clear how remote symbolic references (floating addresses) within definitions are handled.
    It is interesting to this reviewer to observe the gradual coalition of the structure of macro-assemblers (or compilers) and algebraic compilers. The author's description of the coding that must be added to a programming routine to make it a macro- instruction compiler also constitutes a description of the essential portion of an algebraic compiler. This similarity suggests that an alternate approach might be to start instead with a base program which contains a syntactical scanner, a storage allocation procedure, and a mechanism for handling remote connections.

          in ACM Computing Reviews, January-December 1960 view details
  • McIlroy, M. D. "Macro Instruction Extension of Compiler Languages" view details Abstract: Macroinstruction compilers constructed from a small set of functions can be made extremely powerful. In particular, conditional assembly, nested definitions, and parenthetical notation serve to make a compiler capable of accepting very general extensions to its ground language. DOI
          in [ACM] CACM 3(04) April 1960 view details
  • Feldman, Jerome and Gries, David "Translator writing systems" p77-113 view details Abstract: A critical review of recent efforts to automate the writing of translators of programming languages is presented. The formal study of syntax and its application to translator writing are discussed in Section II. Various approaches to automating the postsyntactic (semantic) aspects of translator writing are discussed in Section III, and several related topics in Section IV. Extract: Extendible Compilers -- Basic Concepts
    Extendible Compilers -- Basic Concepts
    Many attempts (starting with McIlroy [McI1 60]) have been made to embed macro features in compiler systems. One approach was to retain the macro syntax form but add a number of built-in features which are compiler-like. The SET system [Ben 64a] included a skeleton compiler with input-output, symbol manipulation, table handling, and list processing features. These built-in routines were combined with translation time operations (action operators) in the attempt to build a TWS. A more successful approach has been to use the structured syntax of high level languages as a basis for extension.
    Many existing compilers (including PL/I [IBM 66]) incorporate simple forms of macro expansion, the first probably being JOVIAL [Shaw 63]. The most primitive form is pure text replacement without parameter substitution.
    For example, in B5500 ALGOL one could define a macro with the statement:
    DEFINE LOOP 1 = FOR I ~ 1 STEP 1 UNTIL N
    and later write statements like
    LOOP 1 N DO A[I] ~ 0
    which would be expanded into
    FOR I ~-- 1 STEP 1 UNTIL N DO A [I] ~-- 0.
    The next step is to allow a macro definition with parameters.
    This facility has been included in the AED-0 compiler [Ross 66], among others. In AED-0 one might define a macro with the statement:
    DEFINE MACRO LOOP (P1, P2) TOBE
    FOR P1 ~-- 1 STEP 1 UNTIL P2 DO ENDMACRO.
    In this case, one could get the same result as above with the shorter statement
    LOOP(I, N) A[I] ~-- O.
    These two simple macro forms would form a useful addition to any high level language, and one might imagine developing mechanisms which parallel more sophisticated macro techniques. Although AED-0 does permit arbitrary strings as parameters, and nested definitions, features like conditional assembly do not seem to have been widely used in high level languages. One reason for this is that compilers normally depend heavily on the structure of the text; the next two sections describe the complexities that arise in trying to extend compilers with macro techniques.
          in [ACM] CACM 11(02) (February 1968) view details
  • Holbrook, Bernard D. and Brown, W. Stanley "A History of Computing Research at Bell Laboratories (1937-1975)" Computing Science Technical Report No. 99 1982 view details Extract: History
    In the late 1950s. several symbolic assembly languages, such as SAP, had become available, and by 1957 some of these, including IBM's SCAT and SAP for the 704 machine, permitted users to define macroinstructions (often called macros) as shorthand for frequently occurring sequences of machine instructions. Then in 1959, M. Douglas McIlroy and Douglas E. Eastwood of Bell Labs introduced conditional and recursive macros into SAP, and in 1960 described how macros could be used to extend any programming language to meet the user's own special requirements.
          in [ACM] CACM 11(02) (February 1968) view details