Compiling a Subset of APL Into a Typed Intermediate Language

Martin Elsman, Martin Dybdal
2014 Proceedings of ACM SIGPLAN International Workshop on Libraries, Languages, and Compilers for Array Programming - ARRAY'14  
We present a compiler and a typed intermediate language for a subset of APL. The intermediate language treats all numeric data as multi-dimensional arrays and the type system makes explicit the ranks of arrays. Primitive operators are polymorphic in rank and in the type of the underlying data operated on. The frontend of the APL compiler deals with much of the gory details of the APL language, including infix resolution, resolution of identity items for reduce operations, resolution of default
more » ... lement values for empty arrays, scalar extensions, and resolution of certain kinds of overloading. We demonstrate the usefulness of the intermediate language by showing that it can be compiled efficiently, using known techniques, such as delayed arrays, into a C-like language. We also demonstrate that the language is sufficiently expressive that some primitive operators, such as APL's inner product operator, which works on arrays of arbitrary dimensions, can be compiled using more primitive operators.
doi:10.1145/2627373.2627390 dblp:conf/pldi/ElsmanD14 fatcat:qxm453orgfcxfek6ukyt4fgdgq