Method and apparatus for translating source code from one high-level computer language to another
AssigneeTandem Computers Incorporated
InventorsKristy A. Andrews, Paul Del Vigna, Mark E. Molloy
Life of this patent
Estimating the term…
Abstract
A method, system, apparatus, and program for translating one computer language to another using doubly-rooted tree data structures. A doubly-rooted tree is the combination of two sets of hierarchically related objects sharing a common set of leaves. An N-rooted tree is also described. When a doubly-rooted tree is constructed in the specified manner and then translated to a second doubly-rooted tree, source language code is transformed into target language code. In addition, the translation preserves preprocessor characteristics of the source language code including macros, conditionally compiled regions of code, source inclusion statements, and comments.
Claims6
A method for use in a computer system for creating a doubly-rooted tree data structure and storing information representing a source code program in the data structure comprising the computer implemented steps of:
- retrieving a set of objects from a memory, the methods representing portions of a source code program;
- identifying a first set of hierarchical relationships among the objects, yielding syntactic constructs;
- scanning the syntactic constructs into virtual source;
- storing the syntactic constructs in a first tree by top down means in depth-first traversal order in accordance with the first set of hierarchical relationships so that the first tree terminates at the virtual source;
- identifying a second set of hierarchical relationships among the objects;
- storing the objects in a second tree by bottom up means in depth-first traversal order in accordance with the second set of hierarchical relationships so that the second tree terminates at the virtual source.
A method for use in a computer system for creating a doubly-rooted tree data structure and storing information representing a source code program in the data structure comprising the computer implemented steps of:
- retrieving a set of objects from a memory, the methods representing portions of a source code program;
- identifying a first set of hierarchical relationships among the objects, including
- scanning the objects into tokens,
- recognizing a set of tokens which represent an invocation expression for text substitution,
- associating the expression with one or more nodes,
- performing text substitution as represented by the invocation expression, and
- repeating the virtual source production method steps until the objects are exhausted,
- scanning the objects into virtual source;
- storing the objects in a first tree by top down means in depth-first traversal order in accordance with the first set of hierarchical relationships so that the first tree terminates at the virtual source;
- identifying a second set of hierarchical relationships among the objects;
- storing the objects in a second tree by bottom up means in depth-first traversal order in accordance with the second set of hierarchical relationships so that the second tree terminates at the virtual source.
An article of manufacture comprising a medium for data storage wherein is located a computer program for causing a processor to create a doubly-rooted tree data structure and storing information representing a source code program in the data structure by implementing the computer implemented steps of:
- retrieving a set of objects from a memory, the methods representing portions of a source code program;
- identifying a first set of hierarchical relationships among the objects, yielding syntactic constructs;
- scanning the syntactic constructs into virtual source;
- storing the syntactic constructs in a first tree by top down means in depth-first traversal order in accordance with the first set of hierarchical relationships so that the first tree terminates at the virtual source;
- identifying a second set of hierarchical relationships among the objects;
- storing the objects in a second tree by bottom up means in depth-first traversal order in accordance with the second set of hierarchical relationships so that the second tree terminates at the virtual source.
A method for use in a computer system for creating a doubly-rooted tree data structure and storing information representing a source code program in the data structure comprising the computer implemented steps of:
- retrieving a set of objects from a memory, the methods representing portions of a source code program;
- identifying a first set of hierarchical relationships among the objects, including
- scanning the objects into tokens,
- recognizing a set of tokens which represent an invocation expression for text substitution,
- associating the expression with one or more nodes,
- performing text substitution as represented by the invocation expression, and
- repeating the virtual source production method steps until the objects are exhausted,
- scanning the objects into virtual source;
- storing the objects in a first tree by top down means in depth-first traversal order in accordance with the first set of hierarchical relationships so that the first tree terminates at the virtual source;
- identifying a second set of hierarchical relationships among the objects;
- storing the objects in a second tree by bottom up means in depth-first traversal order in accordance with the second set of hierarchical relationships so that the second tree terminates at the virtual source.
Dependencies are inferred from the claim text.