# US 6,286,133 B1 · Method and apparatus for strategic compilation of source programs into two or more target languages

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 6,286,133 B1
- Document ID: US6286133B1
- Status: Granted
- Kind: B1
- Application number: 09/037,581
- Filed: 1998-03-10
- Granted: 2001-09-04
- Earliest claimed: 1997-07-31
- Assignees: International Business Machines Corporation
- Inventors: Trevor Paul Hopkins
- Web page: https://patentgrep.com/patent/US6286133B1

## CPC

- G06F 8/47: {Retargetable compilers}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method and apparatus which, as part of a compiler, supporting the generation of code in two (or more) target languages. The selection of the target language, and the program structure in that target language, is made depending on the capabilities of each target language, in a separate processing pass. Runtime efficiency is also improved by allowing selection of the most appropriate target language and program structure for a particular source code function.

## Claims

### Claim 1

A method for compiling a source program written in a source language into a compiled program comprising a plurality of different target languages, the method comprising:
generating a parse tree from a source program, the parse tree comprising a plurality of nodes each representative of an operation in the source program;
determining, for each successive node of the parse tree, a target language selected from a plurality of different target languages into which the node can be compiled based on the operation represented by the node;
generating, based on the target language determination, a list of start points each corresponding to a different node of the parse tree and each indicating the target language into which the node is to be compiled; and
generating successive sections of the compiled program each based on each node of the parse tree between successive start points in the list and each being generated in the target language specified by the first of the successive start points.

### Claim 2

An apparatus for compiling a source program written in a source language into a compiled program comprising a plurality of different target languages, the apparatus comprising:
means for generating a parse tree from a source program, the parse tree comprising a plurality of nodes each representative of an operation in the source program;
means for determining, for each successive node of the parse tree, a target language selected from a plurality of different target languages into which the node can be compiled based on the operation represented by the node;
means for generating, based on the target language determination, a list of start points each corresponding to a different node of the parse tree and each indicating the target language into which the node is to be compiled; and
means for generating successive sections of the compiled program each based on each node of the parse tree between successive start points in the list and each being generated in the target language specified by the first of the successive start points.

### Claim 3

A computer program device readable by a machine, tangibly embodying a program of instructions executable by a machine to perform method steps for compiling a source program written in a source language into a compiled program comprising a plurality of different languages, the method comprising steps of:
generating a parse tree from a source program, the parse tree comprising a plurality of nodes each representative of an operation in the source program;
determining, for each successive node of the parse tree, a target language selected from a plurality of different target languages into which the node can be compiled based on the operation represented by the node;
generating, based on the target language determination, a list of start points each corresponding to a different node of the parse tree and each indicating the target language into which the node is to be compiled; and
generating successive sections of the compiled program each based on each node of the parse tree between successive start points in the list and each being generated in the target language specified by the first of the successive start points.
