Re: LISP Metalanguage

Michael Dyck <dyck@cs.sfu.ca>
Fri, 24 Jan 1992 11:32:20 -0800

          From comp.compilers

Related articles
LISP Metalanguage slimick@unix.cis.pitt.edu (John C Slimick) (1992-01-19)
Re: LISP Metalanguage preston@dawn.cs.rice.edu (1992-01-23)
Re: LISP Metalanguage dyck@cs.sfu.ca (Michael Dyck) (1992-01-24)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Michael Dyck <dyck@cs.sfu.ca>
Keywords: Lisp, syntax, history
Organization: Compilers Central
Date: Fri, 24 Jan 1992 11:32:20 -0800

preston@dawn.cs.rice.edu (Preston Briggs) writes:


> Oh, here we go...
>
> The LISP 2 Programming Language and System
> Paul Abrahams, et al.
> Proceeding of the Fall Joint Computer Conference, 1966


I found this in our departmental library. Here's an excerpt:


------------------------------------------------------------------------


        LISP 2 was designed to maintain the advantages of LISP 1.5 while
remedying its deficiencies. The first major change has been the
introduction of two distinct language levels: Source Language (SL) and
Intermediate Language (IL). The two languages have different syntaxes but
the same semantics (in the sense that for every SL program there is a
computationally equivalent IL program). The syntax of SL resembles that of
ALGOL 60, while the syntax of IL resembles that of LISP 1.5. IL is
designed to have the same structure as data, and thus to be capable of
being manipulated easily by the user (and system) programs. An advantage
of the ALGOL-like source language is that the ALGOL algorithms can be
utilized with little change.


        The second major change has been the introduction of type declarations
and new data types, including integer-indexed arrays and character
strings. At a future time, packed data tables, which can presently be
simulated through programming techniques, will be added. Type
declarations are necessary to obtain efficient compiled code, particularly
for arithmetic operations, but by using the default mechanisms, a
programmer may omit type declarations entirely (albeit at the cost of
efficiency).


        The third major change has been the introduction of partial-word
extraction and insertion operators. Further, an IL-level macro expansion
capability has been included, which makes possible the definition of
operations in terms of a basic set of open-coded primitives. These changes
made it possible to write the entire system in its own language without
loss of efficiency. At the same time, the compilations of user programs
are more economical in time, and to some extent in space, than they would
be without these facilities. Furthermore, the knowledgeable user can
trade space against time through appropriate redefinition of system
functions.


        A fourth major change, the introductin of pattern-driven data
manipulation facilities, along the lines of COMIT and METEOR, is still in
the process of implementation. Because of the open-ended nature of LISP 2,
these facilities can be added without disrupting the existing system
structure. We mention this facility here, despite the fact that it does
not yet exist, because it is an integral part of the over-all design of
the language. Since the specifications are not final as of this writing,
however, we shall not discuss them further.


        To orient the reader toward the exposition of the language, we present
a short example at this point. Further examples will be given later. The
following program is written in SL:


        % RANDOM COMPUTES A RANDOM
            NUMBER IN THE INTERVAL (A,B)
          OWN INTEGER Y;
          REAL FUNCTION RANDOM(A,B);
                REAL A,B;
          BEGIN Y<-3125*Y;
                  Y<-Y\67108864;
                      RETURN (Y/67108864.0 * (B-
                            A)+A)
          END;


        The only significant difference between this program and the ALGOL
original is the use of the reverse slash "\" to indicate the computation
of the remainder. The corresponding program in IL is:


        (DECLARE (Y OWN INTEGER))
        (FUNCTION (RANDOM REAL)
            ((A REAL) (B REAL))
            (BLOCK NIL (SET Y (TIMES 3125 Y))
                (SET Y (REMAINDER Y 67108864))
                (RETURN (PLUS (TIMES (QUOTIENT
                        Y 6.7108864000E+7)
                    (DIFFERENCE B A )) A))))


--
Michael Dyck
School of Engineering Science
Simon Fraser University
Burnaby, BC, Canada, V5A 1S6
dyck@cs.sfu.ca
(604) 291-4369
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.