APL-to-Fortran translators
First Claim
1. A machine-implemented method of translating to a target computer language an application programmed in a source computer language wherein said source language is characterized by(A) having arrays as primitive objects thereof,(B) primitive functions which are applicable to arrays,(C) primitive functions in which internal representations are inferred from use, and(D) primitive functions which are applied differently in different cases depending upon differences in the rank, type, and shape information applicable to the arrays, the method comprising the steps of:
- (a) providing, for a subject primitive function of said source language which is applied differently in different cases, an archetype which includes(i) plural portions of code, which represent code in said target language, said portions being associated with corresponding cases in which the subject primitive function may be used, and(ii) conditions for determining which of said plural portions of archetype code are to be used for a given occurrence of the subject primitive function in a given application program in said source language with at least some of the conditions being dependent on array shapes,(b) storing said archetype in a machine memory, and(c) translating said subject primitive function from said source to said target language using said stored archetype, by selecting at least one of said portions of code therefrom in accordance with said conditions applicable to said given application program, when said given application program in said source language is input to a computer as the object of translation, to produce a translated application program in said target language.
0 Assignments
0 Petitions
Accused Products
Abstract
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.
-
Citations
36 Claims
-
1. A machine-implemented method of translating to a target computer language an application programmed in a source computer language wherein said source language is characterized by
(A) having arrays as primitive objects thereof, (B) primitive functions which are applicable to arrays, (C) primitive functions in which internal representations are inferred from use, and (D) primitive functions which are applied differently in different cases depending upon differences in the rank, type, and shape information applicable to the arrays, the method comprising the steps of: -
(a) providing, for a subject primitive function of said source language which is applied differently in different cases, an archetype which includes (i) plural portions of code, which represent code in said target language, said portions being associated with corresponding cases in which the subject primitive function may be used, and (ii) conditions for determining which of said plural portions of archetype code are to be used for a given occurrence of the subject primitive function in a given application program in said source language with at least some of the conditions being dependent on array shapes, (b) storing said archetype in a machine memory, and (c) translating said subject primitive function from said source to said target language using said stored archetype, by selecting at least one of said portions of code therefrom in accordance with said conditions applicable to said given application program, when said given application program in said source language is input to a computer as the object of translation, to produce a translated application program in said target language. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 36)
-
-
25. A system for translating to a target computer language an application programmed in a source computer language wherein said source language is characterized by:
-
(A) having arrays as primitive objects thereof; (B) primitive functions which are applicable to arrays; (C) primitive functions in which internal representations are inferred from use; and (D) primitive functions which are applied differently in different cases depending upon differences in the rank, type, and shape information applicable to the arrays, the system comprising;
means for providing, for a subject primitive function of said source language which is applied differently in different cases, an archetype which includes;(a) plural portions of code, which represent code in said target language, said portions being associated with corresponding cases in which the subject primitive function may be used; and (b) conditions for determining which of said plural portions of archetype code are to be used for a given occurrence of the subject primitive function in a given application program in said source to said source lanuage with at least some of the conditions being dependent on array shapes; means for storing said archetypes in a machine memory; and means for translating said subject primitive function from said source to said target language using said stored archetype, by selecting at least one of said portions of code therefrom in accordance with said conditions applicable to said given application program, when said given application program in said source language is input to a computer as the object of translation, to produce a translated application program in said target language. - View Dependent Claims (26, 27, 28, 29, 30, 31, 32, 33, 34, 35)
-
Specification