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 APL.SV 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.
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
RANK, produced from two adjacent Shape functions, and
POLYCAT, from multiple copies of Catenate could be generated in this step.
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).
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:
BEGIN statement list END
IF test DO statement
IF test THEN statement ELSE statement
WHILE test DO statement
REPEAT statement list UNTIL test
CASE expression OF constant BEGIN ... END CASE
Functions were written with the
PROCEDURE header: statement list END PROCEDURE
ASSERT command was also provided to allow the programmer to check conditions during execution.
ASSERT level: boolean expression
level parameter allowed for inline execution.
- 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.
- Hewlett-Packard. Hewlett-Packard Journal, July 1977.
|APL dialects |
|Maintained||APL+Win (APL*PLUS) ∙ APL2 ∙ APL64 ∙ APL\iv ∙ April ∙ Co-dfns ∙ Dyalog APL ∙ dzaima/APL ∙ GNU APL ∙ NARS2000 ∙ ngn/apl|
|Historical||Iverson notation ∙ A Programming Language ∙ A+ (A) ∙ APL# ∙ APL.68000 ∙ APL.SV ∙ APLX ∙ APL\1130 ∙ APL\360 ∙ NARS ∙ openAPL ∙ Rowan ∙ SAX ∙ SHARP APL∙ VisualAPL (APLNext) ∙ VS APL ∙ York APL|
|Derivatives||AHPL ∙ APL\iv ∙ ELI ∙ I ∙ Ivy ∙ J ∙ Jelly ∙ K (Q, KDB+) ∙ LYaPAS ∙ Nial ∙ RAD|