Source Code Variable Annotation for Data Flow Analysis
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional methods fail to provide detailed information for analyzing data flow in software source code, leading to errors and unmanageability due to numerous control and data flow paths, making it difficult to understand the provenance of data.
Innovation Solution
A method and system that generate an intermediate representation of source code, identify and categorize variables based on their definitions, uses, and correlations, creating a data description table and dictionary to assign annotations to statements, thereby providing detailed information about data flow and nature of data stored in variables.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Loss of information
If conventional methods are used to analyze data flow in source code, then the analysis process is simple, but the detailed information about data flow and provenance is insufficient
Solution Approach 1:
The patent segments the source code into basic blocks and represents them as nodes in a control flow graph. Each variable is tracked through its definition-use chains, dividing the complex data flow analysis into manageable discrete units. This segmentation enables detailed tracking of data provenance without overwhelming system complexity.
Solution Approach 2:
The patent introduces an intermediate representation (IR) as a mediator between the source code and the analysis results. The IR includes control flow graphs, data flow graphs, and annotation structures that bridge the gap between raw code and detailed data flow information, enabling comprehensive analysis while maintaining system manageability.
2Loss of information
If detailed analysis of data flow is performed to understand provenance, then information completeness is improved, but the system becomes unmanageable due to numerous control flow paths
Solution Approach 1:
The control flow is divided into basic blocks with single entry and exit points. Each block is analyzed independently for data definitions and uses, then combined through the control flow graph. This segmentation makes the analysis of numerous control flow paths manageable by breaking them into discrete, analyzable units.
Solution Approach 2:
The patent adds multiple dimensions to the analysis by creating separate control flow graphs and data flow graphs in addition to the traditional code structure. Annotations are added as a fourth dimension containing detailed provenance information. This multi-dimensional approach organizes complex data flow information in a structured, manageable way.
3Measurement precision
If annotations are assigned to track variable definitions and uses, then data flow analysis accuracy is improved, but the processing complexity increases
Solution Approach 1:
The patent performs preliminary parsing of the source code to generate the intermediate representation, control flow graph, and identify basic blocks before conducting the main data flow analysis. Variable definitions and uses are pre-identified and annotated during this preliminary phase, reducing the complexity of the subsequent detailed analysis by having the foundational structure ready in advance.
Data Source
AI summary
A method and system for assigning an annotation to a statement in a source code. The method comprises generating intermediate representation of the source code by parsing the source code. The method comprises identifying one or more instances of definition of a variable and one or more instances of use of the variable. The method comprises categorizing the variable into a group of variables based on the one or more instances of definition of the variable, the one or more instances of use of the variable, a description of the variable, and mathematical operators defining a correlation between the variable and one or more other variables. Further, a data description table and a data dictionary of the plurality of variables are created. The method assigns an annotation to the variable present in the statement of the source code based on the data description table and the data dictionary.


