# US 2013/0159982 A1 · Language Translation Using Preprocessor Macros

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

- Number: US 2013/0159982 A1
- Document ID: US20130159982A1
- Status: Published application
- Kind: A1
- Application number: 13/328,049
- Filed: 2011-12-16
- Published: 2013-06-20
- Earliest claimed: 2011-12-16
- Assignees: Facebook, Inc.
- Inventors: Apostolos Lerios
- Web page: https://patentgrep.com/patent/US20130159982A1

## CPC

- G06T 1/20: Processor architectures; Processor configuration, e.g. pipelining
- G06F 8/315: {Object-oriented languages}
- G06F 8/423: {Preprocessors}
- G06F 8/433: {Dependency analysis; Data or control flow analysis}
- G06T: IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method is provided for providing consistent logical code across specific programming languages. The method incorporates preprocessor macros in a source computer program code to generate a program control flow. The preprocessor macros can be used to describe program control flow in the source programming language for execution in the source computer program code. The preprocessor macros can also be used to generate control flow objects representing the control flow, which converts the source computer program code into a general language representation. The general language representation when executed is used to output computer programming code in specific programming languages representing the same logical code as that of the source computer program code.

## Claims

### Claim 1

A computer-implemented method comprising:
receiving computer programming code incorporating a plurality of macros, wherein the plurality of macros represent program control flow, and wherein the computer programming code is written in a source language including statements consistent with the source language;
preprocessing the received computer programming code, wherein the preprocessing comprises selectively replacing the plurality of macros with a plurality of associated control flow classes representing the control flow associated with the macros, such that:
the control flow classes direct a compiled program using the computer programming code to generate a general language representation of the control flow using the classes,
the classes include overloaded operators that create classes using the statements consistent with the source language, and
the general language representation is configured to output specific language code; and
compiling the preprocessed computer programming code to create a computer program executable; and
storing the computer program executable in a non-transitory storage medium.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, wherein the source language is C++.

### Claim 3 (depends on 1)

The computer-implemented method of claim 1, wherein the specific language code comprises at least one of: a compiled language, a scripting language, one or more library functions, and any combination thereof.

### Claim 4 (depends on 1)

The computer-implemented method of claim 1, wherein when the preprocessing does not selectively replace the plurality of macros with the plurality of associated control flow, and the preprocessing replaces the plurality of macros with control flows enabling execution of the statements consistent with the source language.

### Claim 5 (depends on 1)

The computer-implemented method of claim 1, wherein the overloaded operators include at least one overloaded operator that generates an operator-specific subclass associated with operator.

### Claim 6 (depends on 1)

The computer-implemented method of claim 1, wherein the specific language code is outputted by traversing the general language representation as a tree.

### Claim 7 (depends on 1)

The computer-implemented method of claim 1, wherein the computer programming code includes image filtering algorithms.

### Claim 8 (depends on 7)

The computer-implemented method of claim 7, wherein the specific language code includes a compiled language and one or more library functions for the compiled language, and wherein the computer program executable enables execution of the image filtering algorithm on a general purpose processor and on a specialized graphical processor.

### Claim 9

A computer-implemented method comprising:
receiving computer language code implementing a computing logic in a source language, wherein the computer language code includes macros associated with control flow;
receiving an input to control a desired output format of the computer language code;
preprocessing the computer language code, wherein the preprocessing comprises selectively performing either of the following steps based on the received input:
converting the macros to program control flow statements associated with the source language such that the computer language code provides instructions to execute the computing logic; or
converting the macros to a plurality of control flow objects associated with a general language representation, wherein the control flow objects convert the computing logic in a source language to the general language representation using operator overloading, and wherein the general language representation outputs the computing logic in a format configured for execution with a specific programming language; and
compiling the preprocessed computer language code.

### Claim 10

A computer program product containing computer program code stored on a non-transitory computer-readable medium, wherein the computer program code is produced according to the computer-implemented method of any one of the preceding claims.
