Program Analysis and Code Generation in an APL/370 Compiler

594 We have implemented an APL/370 compiler which accepts a subset of APL that Includes most language features and a majority of APL primitive functions. It produces System/370 assembly code directly to be run independently of an interpreter. The compiler does not require variable declarations. Its front end, which is machine-independent, employs extensive typeshape analysis based on a type-shape calculus of the primitive functions and global dataflow analysis. Its back end does storage mapping, code generation for various primitive functions, and register management. For one-line functions, compiled code executes at 2-10 times the speed of the interpreter. On programs with many iterations, the execution time of the compiled code not only is dramatically better than that of inteipretation, but is actually fairly close to that of FORTRAN. This removes the performance penalty of APL in computationintensive applications.