APL\3000: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
m (APL.SV is more precise than APL\360 here)
No edit summary
Line 31: Line 31:
In addition to the traditional APL language, APL provided an implementation of [[APLGOL]], which incorporated [[wikipedia:ALGOL|ALGOL]]'s structured programming as advocated by [[Dijkstra]] as a replacement for [[Branch]]-based control flow. APLGOL shared its underlying implementation with APL.
In addition to the traditional APL language, APL provided an implementation of [[APLGOL]], which incorporated [[wikipedia:ALGOL|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:
The following [[control structure]]s were provided in APLGOL:
* <source inline lang=apl>BEGIN statement list END</source>
* <source inline lang=apl>BEGIN statement list END</source>
* <source inline lang=apl>IF test DO statement</source>
* <source inline lang=apl>IF test DO statement</source>

Revision as of 09:48, 19 July 2020


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.[1] 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.

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 RANK, produced from two adjacent Shape functions, and POLYCAT, 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:

  • 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 command:

PROCEDURE header: statement list END PROCEDURE

An ASSERT command was also provided to allow the programmer to check conditions during execution.

ASSERT level: boolean expression

The level parameter allowed for inline execution.

Publications

References

  1. Hewlett-Packard. Hewlett-Packard Journal, July 1977.


APL dialects [edit]
Maintained APL+WinAPL2APL64APL\ivApletteAprilCo-dfnsDyalog APLDyalog APL Visiondzaima/APLGNU APLKapNARS2000Pometo
Historical A Programming LanguageA+ (A) ∙ APL#APL2CAPL\360APL/700APL\1130APL\3000APL.68000APL*PLUSAPL.jlAPL.SVAPLXExtended Dyalog APLIverson notationIVSYS/7090NARSngn/aplopenAPLOperators and FunctionsPATRowanSAXSHARP APLRationalized APLVisualAPL (APLNext) ∙ VS APLYork APL
Derivatives AHPLBQNCoSyELIGleeIIvyJJellyK (Goal, Klong, Q) ∙ KamilaLispLang5LilNialRADUiua
Overviews Comparison of APL dialectsTimeline of array languagesTimeline of influential array languagesFamily tree of array languages