APL2C: Difference between revisions
(Created page with "{{Infobox array language | logo = File:APL2C.gif | array model = nested | index origin = 0 or 1 | function styles = defined | numeric types = floats | unicode support = no | released = 2001 | developer = Tilman Otto | latest release version = 5.0.3 / 2002 | implementation languages = wikipedia:C_(programming_language...") |
m (→Control structures: Link to Del) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 18: | Line 18: | ||
'''APL2C''' is a [[Nested array model|nested]] APL implementation consisting of a complete interpreter, and a compatible compiler with some restrictions. It supports much of the functionality specified by the Extended APL standard [[ISO/IEC 13751:2001]], including some features such as the [[Commute]] and [[Rank (operator)|Rank]] operators that were not widely supported at the time of its initial release.<ref>F.H.D. van Batenburg. [http://archive.vector.org.uk/art10000930 Conformity of APL Implementations to the ISO APL Standard]. [[Vector journal]] Volume 21, No.3. 2005-05.</ref> Development of APL2C began in 1991, and it was used in commercial applications before its public release. The compiler and its use in medical image analysis were presented at the [[APL00|2000 APL conference]].<ref>Tilman P. Otto. [https://doi.org/10.1145/570475.570498 APL Based medical image analysis] at [[APL00]].</ref><ref>Tilman P. Otto. [https://doi.org/10.1145/570475.570499 An APL Compiler] at [[APL00]].</ref> The implementation was later offered as a trial version, with a tutorial on using it presented at the 2001 APL conference. | '''APL2C''' is a [[Nested array model|nested]] APL implementation consisting of a complete interpreter, and a compatible compiler with some restrictions. It supports much of the functionality specified by the Extended APL standard [[ISO/IEC 13751:2001]], including some features such as the [[Commute]] and [[Rank (operator)|Rank]] operators that were not widely supported at the time of its initial release.<ref>F.H.D. van Batenburg. [http://archive.vector.org.uk/art10000930 Conformity of APL Implementations to the ISO APL Standard]. [[Vector journal]] Volume 21, No.3. 2005-05.</ref> Development of APL2C began in 1991, and it was used in commercial applications before its public release. The compiler and its use in medical image analysis were presented at the [[APL00|2000 APL conference]].<ref>Tilman P. Otto. [https://doi.org/10.1145/570475.570498 APL Based medical image analysis] at [[APL00]].</ref><ref>Tilman P. Otto. [https://doi.org/10.1145/570475.570499 An APL Compiler] at [[APL00]].</ref> The implementation was later offered as a trial version, with a tutorial on using it presented at the 2001 APL conference. | ||
APL2C's compiler generates [[wikipedia:C_(programming_language)|C]] code that calls functions for primitives and other operations such as loading variables, removing interpreter dispatch overhead. Compiling allows a program to be distributed as an executable file, and allows the APL code to inter-operate with C. | APL2C's compiler generates [[wikipedia:C_(programming_language)|C]] code that calls functions for primitives and other operations such as loading variables, removing interpreter dispatch overhead. Compiling allows a program to be distributed as an executable file, and allows the APL code to inter-operate with C. In order to compile, the generated code must be linked against a platform-specific [[wikipedia:shared library|shared library]] containing primitive implementations, as source code for the primitives is not distributed. Some dynamic functionality is also restricted: compiled programs can't dynamically create APL functions with <syntaxhighlight lang=apl inline>⎕FX</syntaxhighlight>, and can't pass arrays (rather than functions) as [[operand]]s to user-defined operators. | ||
== Control structures == | |||
[[Control structure]]s in APL2C are written using the [[Del]] character <syntaxhighlight lang=apl inline>∇</syntaxhighlight>, which is not used for [[defined function|function definition]] because this is initiated with editor interaction rather than source code. All control structures consist of an opening <syntaxhighlight lang=apl inline>∇</syntaxhighlight> followed by an expression, and closed with <syntaxhighlight lang=apl inline>∇</syntaxhighlight> alone. For example, the following structure doubles <syntaxhighlight lang=apl inline>X</syntaxhighlight> if it's less than 3. | |||
<syntaxhighlight lang=apl> | |||
∇X<3 | |||
X←2×X | |||
∇ | |||
</syntaxhighlight> | |||
The interpretation of the control expression's result follows a proposal of F.H.D. van Batenburg.<ref>F. H. D. van Batenburg. [https://dl.acm.org/doi/10.1145/114054.114092 L-one-two-three (L1:..L2:..L3:) considered harmful] at [[APL91]].</ref> If the result is a non-negative number, the enclosed code is repeated that many times. A negative number indicates to repeat a number of times equal to the absolute value, but return to the controlling expression afterwards, allowing "while" to be implemented. A vector indicates counts for multiple sections, which are each preceded with a label-less <syntaxhighlight lang=apl inline>:</syntaxhighlight>, allowing "if-else" and "select" forms. | |||
== References == | == References == | ||
<references/> | <references/> | ||
{{APL dialects}}[[Category:APL dialects]][[Category:Nested array languages]][[Category:Ahead-of-time compilers]] | {{APL dialects}}[[Category:APL dialects]][[Category:Nested array languages]][[Category:Ahead-of-time compilers]] |
Latest revision as of 14:59, 10 March 2024
APL2C is a nested APL implementation consisting of a complete interpreter, and a compatible compiler with some restrictions. It supports much of the functionality specified by the Extended APL standard ISO/IEC 13751:2001, including some features such as the Commute and Rank operators that were not widely supported at the time of its initial release.[1] Development of APL2C began in 1991, and it was used in commercial applications before its public release. The compiler and its use in medical image analysis were presented at the 2000 APL conference.[2][3] The implementation was later offered as a trial version, with a tutorial on using it presented at the 2001 APL conference.
APL2C's compiler generates C code that calls functions for primitives and other operations such as loading variables, removing interpreter dispatch overhead. Compiling allows a program to be distributed as an executable file, and allows the APL code to inter-operate with C. In order to compile, the generated code must be linked against a platform-specific shared library containing primitive implementations, as source code for the primitives is not distributed. Some dynamic functionality is also restricted: compiled programs can't dynamically create APL functions with ⎕FX
, and can't pass arrays (rather than functions) as operands to user-defined operators.
Control structures
Control structures in APL2C are written using the Del character ∇
, which is not used for function definition because this is initiated with editor interaction rather than source code. All control structures consist of an opening ∇
followed by an expression, and closed with ∇
alone. For example, the following structure doubles X
if it's less than 3.
∇X<3 X←2×X ∇
The interpretation of the control expression's result follows a proposal of F.H.D. van Batenburg.[4] If the result is a non-negative number, the enclosed code is repeated that many times. A negative number indicates to repeat a number of times equal to the absolute value, but return to the controlling expression afterwards, allowing "while" to be implemented. A vector indicates counts for multiple sections, which are each preceded with a label-less :
, allowing "if-else" and "select" forms.
References
- ↑ F.H.D. van Batenburg. Conformity of APL Implementations to the ISO APL Standard. Vector journal Volume 21, No.3. 2005-05.
- ↑ Tilman P. Otto. APL Based medical image analysis at APL00.
- ↑ Tilman P. Otto. An APL Compiler at APL00.
- ↑ F. H. D. van Batenburg. L-one-two-three (L1:..L2:..L3:) considered harmful at APL91.
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 ∙ 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 |