APL\3000

APL\3000 was an APL implementation for the Hewlett-Packard HP 3000 Series II minicomputer. Its design and new features were published in the July 1977 issue of HP Journal. Marketed as "the first time a large-machine APL has been available on a small computer" (that is, not a mainframe), APL\3000 followed the original APL\360 model closely, and featured exactly the same set of primitives. However, it featured the new implementation techniques of a dynamic compiler and subscript calculus, usability features like a workspace transparently backed by disk space and improved interactive debugging, and the first commercially available APLGOL implementation. The development of APL\3000 was led by John Walters, and Rob Kelley worked on the compiler and APLGOL design. Larry Breed and Phil Abrams assisted in developing the APL compiler.

Implementation
APL\3000's implementation was an early example of dynamic compilation or just-in-time compilation. Every function was compiled on its first invocation, resulting in both executable code for that invocation and "signature instructions" to test whether the same code could be used for later invocations. On later calls to the function, the signature code would be run first: if it failed, then the function would be recompiled with less strict requirements so that the compiled code would work for the new invocation as well as previous ones. Compilation and recompilation were both performed using stored abstract syntax trees for statements called "D-trees". The compiler targetted a stack-based "software/firmware" instruction set including typical low-level instructions as well as APL scalar functions.

The system implemented Phil Abrams' subscript calculus by storing the rank and shape of an array, along with delta and offset vectors, separately from its data—that is, the ravel, but not necessarily in ravel order. This system allowed Take, Drop, Reverse, Transpose, and Reshape to be implemented only by manipulating the shape and other fields, not the data itself. In combination with APL\3000's reference counting system, this allowed even arrays with different shapes to share the same data. Arrays whose data was a linear function of the index were stored as arithmetic progression vectors, omitting the data entirely.

Multiple functions could be combined into a single step using dragalong and beating, also designed by Abrams. Dragalong was implemented by walking up a syntax tree to propagate rank and shape information before compilation, while beating refers to subscript calculus optimizations performed during this process. Combined functions such as, produced from two adjacent Shape functions, and  , from multiple copies of Catenate could be generated in this step.

APL\3000's unlimited workspace size was implemented using a virtual memory system capable of paging parts of the workspace to disk. The least recently used page was always chosen to be paged out.

Four internal data types were used: 8-bit characters, packed 1-bit Booleans, 16-bit integers, and 64-bit floating-point values. APL\3000 had a maximum rank of 63 and a maximum bound of 32,767 (the maximum value of a signed 16-bit integer).

APLGOL
In addition to the traditional APL language, APL provided an implementation of APLGOL, which incorporated ALGOL's structured programming as advocated by Dijkstra as a replacement for Branch-based control flow. APLGOL shared its underlying implementation with APL.

The following control structures were provided in APLGOL:

Functions were written with the  command: An  command was also provided to allow the programmer to check conditions during execution. The  parameter allowed for inline execution.

Publications

 * HP Journal (pdf)
 * Ronald L. Johnston. "The Dynamic Incremental Compiler of APL\3000". APL79. doi:10.1145/800136.804442.
 * Alan M. Marcum. "Secure application environments in APL\3000". APL79. doi:10.1145/800136.804470.
 * Dave Elliott. "Programming for performance in APL\3000".
 * Alan M. Marcum. "Multiple execution environments in APL". APL80.