Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
APL (programming language)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Interpretation and compilation of APL == APL is traditionally an [[interpreted language]], having language characteristics such as [[Strong and weak typing|weak variable typing]] not well suited to [[compiler|compilation]].<ref>{{cite book |last1=Budd |first1=Timothy |title=An APL Compiler |publisher=Springer-Verlag |year=1988 |isbn=978-0-387-96643-4 |url=https://books.google.com/books?id=rTb2BwAAQBAJ&pg=PA1}}</ref> However, with arrays as its core data structure<ref>{{cite web |title=What is APL? |website=www.sigapl.org |publisher=SIGAPL |url=http://www.sigapl.org/about.php |access-date=January 20, 2015}}</ref> it provides opportunities for performance gains through [[Data parallelism|parallelism]],<ref>{{cite journal |last1=Ju |first1=Dz-Ching |last2=Ching |first2=Wai-Mee |title=Exploitation of APL data parallelism on a shared-memory MIMD machine |journal=Newsletter ACM SIGPLAN Notices |date=1991 |volume=26 |issue=7 |pages=61β72 |doi=10.1145/109625.109633 |s2cid=8584353}}</ref> [[parallel computing]],<ref>{{cite web |last1=Hsu |first1=Aaron W. |last2=Bowman |first2=William J. |title=Revisiting APL in the Modern Era |url=http://www.cs.princeton.edu/~dpw/obt/abstracts/obt12_submission_11.pdf |access-date=January 20, 2015 |archive-url=https://ghostarchive.org/archive/20221009/http://www.cs.princeton.edu/~dpw/obt/abstracts/obt12_submission_11.pdf |archive-date=2022-10-09 |url-status=live |website=www.cs.princeton.edu}}</ref><ref>{{cite journal |last1=Ching |first1=W.-M. |last2=Ju |first2=D. |title=Execution of automatically parallelized APL programs on RP3 |journal=IBM Journal of Research & Development |date=1991 |volume=35 |issue=5/6 |pages=767β777 |url=http://domino.research.ibm.com/tchjr/journalindex.nsf/c469af92ea9eceac85256bd50048567c/f892e104dfc4d0fd85256bfa0067fb42!OpenDocument |access-date=January 20, 2015 |doi=10.1147/rd.355.0767 |archive-date=March 3, 2016 |archive-url=https://web.archive.org/web/20160303231727/http://domino.research.ibm.com/tchjr/journalindex.nsf/c469af92ea9eceac85256bd50048567c/f892e104dfc4d0fd85256bfa0067fb42!OpenDocument |url-status=dead|url-access=subscription }}</ref> [[Massively parallel (computing)|massively parallel]] applications,<ref>{{cite journal |last1=Blelloch |first1=Guy E. |last2=Sabot |first2=Gary W. |title=Compiling Collection-Oriented Languages onto Massively Parallel Computers |journal=Journal of Parallel and Distributed Computing |volume=8 |issue=2 |citeseerx=10.1.1.51.5088 |pages=119β134 |quote=Collection oriented languages include APL, APL2 |year=1990 |doi=10.1016/0743-7315(90)90087-6}}</ref><ref>{{cite web |last1=Jendrsczok |first1=Johannes |last2=Hoffmann |first2=Rolf |last3=Ediger |first3=Patrick |last4=Keller |first4=JΓΆrg |title=Implementing APL-like data parallel functions on a GCA machine |pages=1β6 |url=https://www.fernuni-hagen.de/imperia/md/content/fakultaetfuermathematikundinformatik/pv/97-08/papergca_09_1_.pdf |website=www.fernuni-hagen.de |access-date=January 22, 2015 |quote=GCA β Global Cellular Automation. Inherently massively parallel. 'APL has been chosen because of the ability to express matrix and vector' structures. |archive-url=https://web.archive.org/web/20150122211834/https://www.fernuni-hagen.de/imperia/md/content/fakultaetfuermathematikundinformatik/pv/97-08/papergca_09_1_.pdf |archive-date=January 22, 2015 |url-status=dead}}</ref> and [[very-large-scale integration]] (VLSI),<ref>{{cite book |last1=Brenner |first1=Norman |chapter=VLSI circuit design using APL with fortran subroutines |title=Proceedings of the international conference on APL - APL '84 |date=1984 |volume=14 |issue=4 |pages=77β79 |doi=10.1145/800058.801079 |isbn=0-89791-137-7 |quote=APL for interactiveness and ease of coding |s2cid=30863491}}<br/>{{*}}{{cite book |last1=Brenner |first1=Norman |date=1984 |title=Proceedings of the international conference on APL β APL '84 |chapter=VLSI circuit design using APL with fortran subroutines |publisher=ACM SIGAPL |isbn=978-0897911375}}</ref><ref>{{cite book |doi=10.1109/PACRIM.1989.48437 |quote=VLSI module generators are described. APL and C, as examples of interpreted and compiled languages, can be interfaced to an advanced graphics display. |chapter=Towards a graphics/Procedural environment for constructing VLSI module generators |title=Conference Proceeding IEEE Pacific Rim Conference on Communications, Computers and Signal Processing |pages=606β611 |year=1989 |last1=Gamble |first1=D.J. |last2=Hobson |first2=R.F. |s2cid=7921438}}</ref> and from the outset APL has been regarded as a high-performance language<ref>{{cite journal |last1=Lee |first1=Robert S. |title=Two Implementations of APL |journal=PC Magazine |date=1983 |volume=2 |issue=5 |page=379 |url=https://books.google.com/books?id=qURs4j9vKn4C&q=%22IBM%20APL%27s%20fast%20execution%22&pg=PA379 |access-date=January 20, 2015}}</ref> β for example, it was noted for the speed with which it could perform complicated matrix operations "because it operates on arrays and performs operations like matrix inversion internally".<ref>{{cite web |website=MARTHA and LLAMA |title=The APL Computer Language |url=http://marthallama.org/apl/ |access-date=January 20, 2015 |archive-date=February 13, 2015 |archive-url=https://web.archive.org/web/20150213004709/http://marthallama.org/apl/ |url-status=dead}}</ref> Nevertheless, APL is rarely purely interpreted and compilation or partial compilation techniques that are, or have been, used include the following: === Idiom recognition === Most APL interpreters support [[Programming idiom|idiom]] recognition<ref>{{cite book |last1=Metzger |first1=Robert |last2=Wen |first2=Zhaofang |title=Automatic Algorithm Recognition and Replacement: A New Approach to Program Optimization |publisher=The MIT press |year=2000 |isbn=9780262133685 |url=https://books.google.com/books?id=u38h_fV3UqgC&pg=PA12 |access-date=May 6, 2018}}</ref> and evaluate common idioms as single operations.<ref>{{cite journal |last1=Snyder |first1=Lawrence |date=1982 |title=Recognition and Selection of Idioms for Code Optimization |journal=Acta Informatica |volume=17 |issue=3 |doi=10.1007/BF00264357 |s2cid=8369972}}</ref><ref>{{cite thesis |last1=Cheng |first1=Feng Sheng |date=1981 |title=Idiom matching: an optimization technique for an APL compiler |url=https://lib.dr.iastate.edu/cgi/viewcontent.cgi?article=7896&context=rtd |publisher=Iowa State University |access-date=May 6, 2018}}</ref> For example, by evaluating the idiom <code>BV/β³β΄A</code> as a single operation (where <code>BV</code> is a Boolean vector and <code>A</code> is an array), the creation of two intermediate arrays is avoided.<ref>{{cite web |url=http://help.dyalog.com/16.0/Content/Language/Defined%20Functions%20and%20Operators/Idiom%20Recognition/Idiom%20Recognition.htm |title=Idiom Recognition |publisher=dyalog.com |access-date=May 6, 2018}}</ref> === Optimised bytecode === Weak typing in APL means that a name may reference an array (of any datatype), a function or an operator. In general, the interpreter cannot know in advance which form it will be and must therefore perform analysis, syntax checking etc. at run-time.<ref>{{cite journal |last1=Strawn |first1=George O. |date=March 1977 |title=Does APL really need run-time parsing? |journal=Software: Practice and Experience |volume=7 |issue=2 |pages=193β200 |doi=10.1002/spe.4380070207 |s2cid=1463012}}</ref> However, in certain circumstances, it is possible to deduce in advance what type a name is expected to reference and then generate [[bytecode]] which can be executed with reduced run-time overhead. This bytecode can also be optimised using compilation techniques such as [[constant folding]] or [[common subexpression elimination]].<ref name="DyalogCompiler">{{cite web|title=Compiler User Guide|url=http://docs.dyalog.com/16.0/Compiler%20User%20Guide.pdf |archive-url=https://ghostarchive.org/archive/20221009/http://docs.dyalog.com/16.0/Compiler%20User%20Guide.pdf |archive-date=2022-10-09 |url-status=live |website=www.dyalog.com|publisher=Dyalog Ltd.|access-date=May 7, 2018}}</ref> The interpreter will execute the bytecode when present and when any assumptions which have been made are met. Dyalog APL includes support for optimised bytecode.<ref name="DyalogCompiler"/> === Compilation === [[Compiler|Compilation]] of APL has been the subject of research and experiment since the language first became available; the first compiler is considered to be the Burroughs APL-700<ref name="DriscollOrth"> {{cite journal |last1=Driscoll |first1=Graham C. Jr. |last2=Orth |first2=Donald L. |s2cid=2299699 |date=November 1986 |title=Compiling APL: The Yorktown APL Translator |journal=IBM Journal of Research and Development |volume=30 |issue=6 |pages=583β593 |doi=10.1147/rd.306.0583}}</ref> which was released around 1971.<ref>{{cite web |url=http://www.sigapl.org/APLChronology.php |title=Chronology of APL |website=www.sigapl.org| publisher=ACM |access-date=May 7, 2018}}</ref> In order to be able to compile APL, language limitations have to be imposed.<ref name="DriscollOrth"/><ref> {{cite journal |last1=Wai-Mee |first1=Ching |s2cid=17306407 |date=November 1986 |title=Program Analysis and Code Generation in an APL/370 Compiler|journal=IBM Journal of Research and Development |volume=30 |issue=6 |pages=594β602 |doi=10.1147/rd.306.0594}}</ref> APEX is a research APL compiler which was written by [[Robert Bernecky]] and is available under the [[GNU General Public License]].<ref>{{cite web |title= The APEX Project |url= http://www.snakeisland.com/apexup.htm}}</ref> The [[STSC]] APL Compiler is a hybrid of a bytecode optimiser and a compiler β it enables compilation of functions to [[machine code]] provided that its sub-functions and globals are [[Declaration (computer programming)|declared]], but the interpreter is still used as a [[runtime library]] and to execute functions which do not meet the compilation requirements.<ref>{{cite web |title= APL Compiler (message from Jim Weigang to the comp.lang.apl Newsgroup) |url= http://www.chilton.com/~jimw/aplcomp.html |date= Apr 5, 1994}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)