# US 11,650,802 B2 · Idiomatic source code generation

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

- Number: US 11,650,802 B2
- Document ID: US11650802B2
- Status: Granted
- Kind: B2
- Application number: 17/130,249
- Filed: 2020-12-22
- Published: 2022-06-23
- Granted: 2023-05-16
- Earliest claimed: 2020-12-22
- Assignees: Diffblue Ltd
- Applicants: Diffblue Ltd
- Inventors: Peter Schrammel
- Web page: https://patentgrep.com/patent/US11650802B2

## CPC

- G06F 8/51: Source to source
- G06F 8/30: Creation or generation of source code
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A computer-implemented method comprising obtaining a first part or representation of a code section as a code part, said code part comprising a first code characteristic, analyzing the code part to identify context information related to the code section, obtaining a first idiomatic modifier based on the first code characteristic and the context information, wherein the first idiomatic modifier in use transforms a first code statement of the code part such that the transformed first code statement corresponds to an idiomatic representation of the first code statement, and generating a modified code part by applying the first idiomatic modifier to the code part.

## Claims

### Claim 1

A computer-implemented method comprising:
obtaining a first part or representation of a code section as a code part, said code part comprising a first code characteristic and a second code characteristic;
analyzing the code part to identify context information related to the code section;
obtaining a first idiomatic modifier based on the first code characteristic and the context information, wherein the first idiomatic modifier in use transforms a first code statement of the code part such that the transformed first code statement corresponds to an idiomatic representation of the first code statement;
obtaining a second idiomatic modifier based on the second characteristic and the context information, wherein the second idiomatic modifier in use transforms a second code statement of the code part such that the transformed second code statement corresponds to an idiomatic representation of the second code statement;
generating a modified code part by applying the first and second idiomatic modifiers to the code part, wherein the modified code part corresponds to an idiomatic representation of the code part; and
compiling the modified code part.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, wherein the first idiomatic modifier transforms the first code statement by modifying a portion of the first code statement to create a modified portion of the first code statement.

### Claim 3 (depends on 2)

The computer-implemented method of claim 2, wherein the transformed first code statement comprises the modified portion of the first code statement.

### Claim 4 (depends on 1)

The computer-implemented method of claim 1, wherein the first idiomatic modifier in use transforms a second code statement of the code part such that the transformed first code statement corresponds to an idiomatic representation of the first code statement and the second code statement.

### Claim 5 (depends on 1)

The computer-implemented method of claim 1, wherein the second code statement is the first code statement.

### Claim 6 (depends on 1)

The computer-implemented method of claim 1, wherein the first code characteristic corresponds to a non-functional issue associated with one or more code statements included in the code part.

### Claim 7 (depends on 1)

The computer-implemented method of claim 1, wherein the context information relates to one or more non-functional features of the code part.

### Claim 8 (depends on 7)

The computer-implemented method of claim 7, wherein the one or more non-functional features of the code part include one or more chosen from the group including: class names, field names, method names, variable names, construction and formatting of literals, construction and formatting of container types, framework and version-specific assertions, framework and version-specific class annotations, framework and version-specific method annotations, omission of casts where possible, omission of type parameters where possible, inlining of statements and call chaining where appropriate, factoring out of common code where appropriate, imports, static imports where appropriate, placement of comments, visual code structuring where appropriate, or code formatting such indentations and line breaking.

### Claim 9

A system comprising:
one or more processors; and
one or more non-transitory computer-readable media that collectively store instructions that, when executed by the one or more processors, cause the system to perform operations, the operations comprising:
obtaining a first part or representation of a code section as a code part, said code part comprising a first code characteristic and a second code characteristic;
analyzing the code part to identify context information related to the code section;
obtaining a first idiomatic modifier based on the first code characteristic and the context information, wherein the first idiomatic modifier in use transforms a first code statement of the code part such that the transformed first code statement corresponds to an idiomatic representation of the first code statement;
obtaining a second idiomatic modifier based on the second characteristic and the context information, wherein the second idiomatic modifier in use transforms a second code statement of the code part such that the transformed second code statement corresponds to an idiomatic representation of the second code statement;
generating a modified code part by applying the first and second idiomatic modifiers to the code part, wherein the modified code part corresponds to an idiomatic representation of the code part; and
compiling the modified code part.

### Claim 10 (depends on 9)

The system of claim 9, wherein the first idiomatic modifier transforms the first code statement by modifying a portion of the first code statement to create the transformed first code statement.

### Claim 11 (depends on 9)

The system of claim 9, wherein the transformed first code statement is different to the first code statement.

### Claim 12 (depends on 9)

The system of claim 9, wherein the first idiomatic modifier in use transforms a second code statement of the code part such that the transformed first code statement corresponds to an idiomatic representation of the first code statement and the second code statement.

### Claim 13 (depends on 9)

The system of claim 9, wherein the second code statement is the first code statement.

### Claim 14 (depends on 9)

The system of claim 9, wherein the first characteristic corresponds to a non-functional issue associated with one or more code statements included in the code part.

### Claim 15 (depends on 1)

A non-transitory computer readable medium comprising one or more instructions which when executed by one or more processors cause a device to carry out operations as set forth in the method of claim 1.

### Claim 16 (depends on 1)

The computer-implemented method of claim 1, wherein the idiomatic representation of the code part has characteristics indicative of code written by a human software developer.

### Claim 17 (depends on 16)

The computer-implemented method of claim 16, wherein the code part is source code.
