R eview A~~ A P L C o m p i l e r , by T i m o t h y B u d d developed by Perils and Rugaber (Figure 2.8) that produce Stanislav Ulam's "Spiral of Primes". This example plays a key role latter in the text, because these functions are used to produce a complete C program generated by this APL function. In section 3.1. Demand driven evaluation, Budd gives a nice example of a parse tree in which each node represents an automaton. The nodes (automata) are connected to each other by paths or edges over which they can communicate with each other by sending messages back and forth. He discusses in detail the example of the expression A ÷ +B+C, gives the syntax tree for the expression, and discusses the many messages that pass from one node to the other in the evaluation of the result. An example of the '"time versus space" tradeoff is presented in 3.3 When not to use space efficient evaluation in a clear and understandable way. The reader is made to understand why a choice has to be made and why the choice was made the way it was. A major section of the book is spent in discussion of space efficient algorithms and generation of code. Again the presentation is clear and many examples of pseudo-code are given. This is the main part of the book and just what one would expect of a book on the compilation of APL. Again, in Budd's style, things are clear and understandable. Section 8.1. Machine model has a discussion about a hypothetical vector machine, similar to hardware like the CRAY, CDC STAR-100, or IBM 3090. In his imaginary machine, in addition to the usual machine instructions one would expect to find in a modem computer, Budd assumes the existence of instructions for performing primitive operations on two vectors to produce a vector result, as in g * /I+B, where A and B are vectors, and the existence of instructions for performing primitive operations on a scalar and a vector, as in the above, except that B is a scalar. The one further assumption in the hypothetical machine is an operation that takes a vector of machine addresses and produces a vector of values stored in those addresses. One hopes that hardware with this capability is coming in the near future. Today this capability is present in the CRAY-1 in the special case that the machine addresses are in arithmetic progression. These are the publication details: An APL Compiler Timothy Budd Springer-Verlag, 1988 New York Berlin Heidelberg London Paris Tokyo ISBN 0-387-96643-9 ISBN 3-540-96643-9 The book sells for US $22.50. Review by Leroy J. Dickey This book is the outgrowth of a suggestion made by Richard Lipton in 1977, when Lipton was on leave from Yale University to the University of California at Berkeley. It tells the author's Oddessy in the development of his compiler. The book is organized into chapters Why a compiler The inferencing pass Code generation overview simple space efficient functions Further space efficient functions Structural functions space inefficient functions Compiilng for a vector machine Epilogue. Appendices include: The language of the APL compiler A simple example A longer example. Forty six references and 15 illustrations are given. From the back cover: "This book presents in detail the results of an investigation into the issues raised by the development of a compiler for APL, a very high level computer programming language. APL presents a number of novel problems for a compiler writer: weak variable typing, run time changes in variable shape, and a host of primitive operations. For this reason, many people have maintained the position that compiler for the language was inherently impossible and that only an interpreter provided the necessary flexibility. One result of An APL Compiler is to cast a great deal of doubt on this position. Though the integration of several recently developed compiler construction techniques, such as data flow analysis, and a novel and space efficient demand drive or lazy evaluation approach to code generation, the author has been able to produce a true compiler for the language while still maintaining the flexibility and ease that are the hallmarks of APL." A section that I found to especially interesting is 2.4. In this section, Budd discusses why dataflow analysis is needed and shows how function calls are characterized as a pair of "branches" and how the two-level scoping rules of [ISO] APL simplify the task. To illustrate the technique, he gives APL functions Interprocedural dataflow analysis. A P L Quote Q u a d 18 4 June 1988
/lp/association-for-computing-machinery/review-an-apl-compiler-by-timothy-budd-YIHtgWsA00