APLGOL
APLGOL is the shared name of a series of experimental languages developed in the 1970s that organize APL expressions using ALGOL control flow. These designs are not compatible with APL because they remove Branch and make syntax changes such as ignoring line breaks in favor of the statement separator ;
. However, the shared semantics make it relatively easy to compile APLGOL to APL or a shared target. APLGOL was first implemented in 1972 in APL\360 as a compiler to APL. This design was incrementally improved, with APLGOL-2 announced in 1974. APL\3000, released in 1976, featured APLGOL with equal support to APL: each function in a workspace could be written in either language.
History
APLGOL was designed by IBM Palo Alto Scientific Center employees John Walters and Robert Kelley, motivated by a 1971 class at Stanford University that Walters taught and Kelley attended. Walters taught with APL and found that the students, who were more used to ALGOL-W, disliked APL's Branch-based control flow.[1] Another influence came from Phil Abrams:[2] in his Stanford Ph.D. dissertation, "An APL Machine", Abrams uses "an informal dialect of APL" featuring ALGOL-like control structures IF
, CASE
, and REPEAT
.[3] Kelley implemented the first compiler in 1972, and continued to make improvements with Walters at Palo Alto, including adding a reverse compiler to undo the APLGOL to APL compilation. By 1974 the pair had begun working at Hewlett-Packard, where they announced the APLGOL-2 system.[4] At HP, both would work on APL\3000—with Walters as development lead—joining with Phil Abrams for compiler development. APL\3000 provided equal implementation support for the two languages by compiling both APL and APLGOL functions to a shared "S-code" representation.[5]
Syntax
While the purpose of APLGOL was to support control structures and remove Branch, it also featured other changes to make the syntax more like ALGOL.
- Defined function begin with
PROCEDURE
preceding the header, and end withEND PROCEDURE
. - Statements are separated with
;
, while line breaks can be freely placed like spaces. - Comments are written with a starting and ending
⍝
rather than starting only.
The specific control structures added and their syntax changed with different iterations of APLGOL. In most versions, each control word began with an underlined character, but this was not the case in the APL\3000 implementation.
Implementation and usage
In all implementations, APLGOL was interoperable with APL: a given function had to be written either entirely in APL or entirely in APLGOL, but the two types of functions could freely call each other. Some versions had an APLGOL-specific editor to support creating APLGOL functions.
In APL\360, functions were compiled from APLGOL to APL using a compiler implemented initially in APL, and later in APLGOL as well.[2] In order to store the APL code only, avoiding the need to re-compile APLGOL source or store two copies, a back-compiler was implemented that could convert APL output by the compiler—not APL source in general—to an APLGOL input that would produce the same code.
In APL\3000, either APL or APLGOL could be converted to "S-code", a branch-based intermediate representation suitable for further compilation. While the target hardware's branches were more like APL's Branch than control structures, compiled APL required the argument to Branch to be range-checked to have the correct semantics, while branches produced by APLGOL didn't need this check and thus evaluated more quickly.
APLGOL compilers also translated the code to a "canonical form" with one statement per line and indentation for control structures, much like modern auto-formatting. This formatting is introduced by the back-compiler as a side effect of storing the compiled (as APL or S-code) representation rather than the source code. This process was also able to correct some minor errors in the input source.[4]
References
- ↑ Harwood G. Kolsky. APLGOL a structured programming language for APL. Programming Methodology. IBM, 1974.
- ↑ 2.0 2.1 R. A. Kelley. APLGOL, an experimental structured programming language. IBM Journal of Research and Development, Volume 17, Issue 1. 1973-01.
- ↑ Phil Abrams. An APL Machine. SLAC. 1970-02. Appendix B, p. 143.
- ↑ 4.0 4.1 Robert A. Kelley and John R. Walters. "APLGOL-2 a structured programming language system for APL" at APL74.
- ↑ Ronald L. Johnston. "APLGOL: Structured Programming Facilities for APL". Hewlett-Packard Journal, July 1977, pp. 11–13.
APL dialects [edit] | |
---|---|
Maintained | APL+Win ∙ APL2 ∙ APL64 ∙ APL\iv ∙ Aplette ∙ April ∙ Co-dfns ∙ Dyalog APL ∙ Dyalog APL Vision ∙ dzaima/APL ∙ GNU APL ∙ Kap ∙ NARS2000 ∙ Pometo ∙ TinyAPL |
Historical | A Programming Language ∙ A+ (A) ∙ APL# ∙ APL2C ∙ APL\360 ∙ APL/700 ∙ APL\1130 ∙ APL\3000 ∙ APL.68000 ∙ APL*PLUS ∙ APL.jl ∙ APL.SV ∙ APLGOL ∙ APLX ∙ Extended Dyalog APL ∙ Iverson notation ∙ IVSYS/7090 ∙ NARS ∙ ngn/apl ∙ openAPL ∙ Operators and Functions ∙ PAT ∙ Rowan ∙ SAX ∙ SHARP APL ∙ Rationalized APL ∙ VisualAPL (APLNext) ∙ VS APL ∙ York APL |
Derivatives | AHPL ∙ BQN ∙ CoSy ∙ ELI ∙ Glee ∙ I ∙ Ivy ∙ J ∙ Jelly ∙ K (Goal, Klong, Q) ∙ KamilaLisp ∙ Lang5 ∙ Lil ∙ Nial ∙ RAD ∙ Uiua |
Overviews | Comparison of APL dialects ∙ Timeline of array languages ∙ Timeline of influential array languages ∙ Family tree of array languages |