摘要 |
The present invention relates to apparatus and method for translating computer programs in an application from an array source language-having attributes of APL-to a scalar target language. In particular, source language primitive functions-which can be used in different cases-are represented by archetypes having code that is selectable based on applicable case(s). In determining which case (or cases) applies, each program is re-structured into a sequence of simple source language expressions and a static analysis is performed. The static analysis, which includes a shape analysis of arrays in a program, provides information useful in determining cases for archetypes and for determining whether code generated for a particular simple expression may be beneficially merged with code generated for another simple expression. In one embodiment, the source language is translated to target language code which is, in turn, compiled by a target language compiler, thereby providing a two-step source language compiler.
|