# US 8,752,035 B2 · Transforming dynamic source code based on semantic analysis

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

- Number: US 8,752,035 B2
- Document ID: US8752035B2
- Status: Granted
- Kind: B2
- Application number: 13/149,676
- Filed: 2011-05-31
- Published: 2012-12-06
- Granted: 2014-06-10
- Earliest claimed: 2011-05-31
- Assignees: Microsoft Corporation
- Applicants: Michael C. Fanning; Frederico A. Mameri; Zachary A. Nation
- Inventors: Michael C. Fanning; Frederico A. Mameri; Zachary A. Nation
- Web page: https://patentgrep.com/patent/US8752035B2

## CPC

- G06F 8/75: Structural analysis for program understanding
- G06F 8/49: {Partial evaluation}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Transforming dynamic code. The method includes obtaining one or more first data structures defining constructs in a body of dynamic language source code. From the one or more first data structures, identifier information is extracted for one or more of the defined constructs. Knowledge about the constructs is augmented. Using the identifier information and augmented knowledge, metadata is generated about the body of the dynamic language source code. The generated metadata is represented as a symbol table. Using the symbol table, the body of dynamic language source code is transformed.

## Claims

### Claim 1

In a computing environment, a method of transforming dynamic code, the method comprising:
parsing one or more first data structures to generate one or more syntax trees defining constructs in a body of dynamic language source code;
from the one or more syntax trees, extracting identifier information for one or more of the defined constructs;
augmenting knowledge about the constructs by at least one of explicit inspection of the body of the dynamic language source code or implied inferences related to the dynamic language source code, wherein augmenting comprises modeling the results of executing the dynamic language source code including symbolic execution, abstraction interpretation, and control and data flow analysis;
producing a correlation between identifiers and augmented knowledge;
using the identifier information and augmented knowledge, generating metadata about the body of dynamic language source code, the generated metadata being represented as a symbol table;
traversing the one or more syntax trees to construct a hierarchical symbol table that expresses scoping of all discovered symbols of the dynamic language source code; and
using the hierarchical symbol table, transforming the body of dynamic language source code comprising performing code refactoring including code partitioning to identify and rescope the discovered symbols of the dynamic language source code.

### Claim 2 (depends on 1)

The method of claim 1, wherein transforming the body of dynamic language source code comprises performing obfuscation operations on the dynamic language source code.

### Claim 3 (depends on 1)

The method of claim 1, wherein transforming the body of dynamic language source code comprises performing minification operations on the dynamic language source code.

### Claim 4 (depends on 1)

The method of claim 1, wherein transforming the body of dynamic language source code comprises performing optimization on the dynamic language source code.

### Claim 5 (depends on 1)

The method of claim 1, wherein performing code refactoring further comprises lambda lifting.

### Claim 6 (depends on 1)

The method of claim 1, wherein transforming the body of dynamic language source code comprises performing dead code removal, including determining that a function will not be called and removing code for the function.

### Claim 7

A computer program product comprising one or more computer readable storage media comprising computer executable instructions that when executed by one or more processors cause one or more processors to perform the following:
parsing one or more first data structures to generate one or more syntax trees defining constructs in a body of dynamic language source code;
from the one or more syntax trees, extracting identifier information for one or more of the defined constructs;
augmenting knowledge about the constructs by at least one of explicit inspection of the body of the dynamic language source code or implied inferences related to the dynamic language source code, wherein augmenting comprises modeling the results of executing the dynamic language source code including symbolic execution, abstraction interpretation, and control and data flow analysis;
producing a correlation between identifiers and augmented knowledge;
using the identifier information and augmented knowledge, generating metadata about the body of dynamic language source code, the generated metadata being represented as a symbol table;
traversing the one or more syntax trees to construct a hierarchical symbol table that expresses scoping of all discovered symbols of the dynamic language source code; and
using the hierarchical symbol table, transforming the body of dynamic language source code comprising performing code refactoring including code partitioning to identify and rescope the discovered symbols of the dynamic language source code.

### Claim 8 (depends on 7)

The computer program product of claim 7, wherein transforming the body of dynamic language source code comprises performing obfuscation operations on the dynamic language source code.

### Claim 9 (depends on 7)

The computer program product of claim 7, wherein transforming the body of dynamic language source code comprises performing minification operations on the dynamic language source code.

### Claim 10 (depends on 7)

The computer program product of claim 7, wherein transforming the body of dynamic language source code comprises performing optimization on the dynamic language source code.

### Claim 11 (depends on 7)

The computer program product of claim 7, wherein performing code refactoring further comprises lambda lifting.

### Claim 12 (depends on 7)

The computer program product of claim 7, wherein transforming the body of dynamic language source code comprises performing dead code removal, including determining that a function will not be called and removing code for the function.

### Claim 13

In a computing environment, a system for transforming dynamic code, the system comprising:
one or more processors;
one or more computer readable media coupled to the one or more processors, wherein the one or more computer readable media comprise computer executable instruction that when executed by one or more of the one or more processors cause one or more of the one or more processors to perform the following:
parsing one or more first data structures to generate one or more syntax trees defining constructs in a body of dynamic language source code;
from the one or more syntax trees, extracting identifier information for one or more of the defined constructs;
augmenting knowledge about the constructs by at least one of explicit inspection of the body of the dynamic language source code or implied inferences related to the dynamic language source code, wherein augmenting comprises modeling the results of executing the dynamic language source code including symbolic execution, abstraction interpretation, and control and data flow analysis;
producing a correlation between identifiers and augmented knowledge;
using the identifier information and augmented knowledge, generating metadata about the body of dynamic language source code, the generated metadata being represented as a symbol table;
traversing the one or more syntax trees to construct a hierarchical symbol table that expresses scoping of all discovered symbols of the dynamic language source code; and
using the hierarchical symbol table, transforming the body of dynamic language source code comprising performing code refactoring including code partitioning to identify and rescope the discovered symbols of the dynamic language source code.

### Claim 14 (depends on 13)

The system of claim 13, wherein transforming the body of dynamic language source code comprises performing obfuscation operations on the dynamic language source code.

### Claim 15 (depends on 13)

The system of claim 13, wherein transforming the body of dynamic language source code comprises performing minification operations on the dynamic language source code.

### Claim 16 (depends on 13)

The system of claim 13, wherein transforming the body of dynamic language source code comprises performing optimization on the dynamic language source code.
