Binary Intermediate Representation for Source Code Parsing
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing intermediate representation techniques for software engineering fail to meet the requirements of expressivity, efficiency, and interoperability, leading to slower parsing times and increased structural difference analysis in evolving software systems.
Innovation Solution
A computer-implemented method using binary intermediate representations to speed up parsing and loading processes while preserving hierarchical abstract syntax trees, involving the generation of a binary representation based on a syntax tree, semi-structured data, or JSON format, and utilizing protocols like protocol buffers or flattened buffers to flatten these representations into compact, navigable binary arrays.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If source code is parsed into structural representations for software engineering activities, then analysis accuracy is improved, but parsing time increases as software systems evolve and source code structures grow in size
Solution Approach 1:
The patent applies preliminary action by pre-parsing source code into intermediate representations (such as abstract syntax trees) and storing them for later use. This allows software engineering tools to perform analysis on pre-processed data without repeating the parsing step, thereby maintaining analysis accuracy while significantly reducing the time required for subsequent operations.
Solution Approach 2:
The patent uses copying by creating intermediate representation copies of the source code in structured formats (XML, JSON, binary). These copies preserve the hierarchical structure and semantic information of the original code while enabling efficient access and manipulation without needing to re-parse the original source code, thus resolving the contradiction between accurate analysis and parsing time.
2Productivity
If intermediate representations are stored persistently to avoid re-parsing, then productivity is improved, but memory loading time increases without optimized formats
Solution Approach 1:
The patent applies parameter changes by transforming intermediate representations into optimized binary formats with specific structural parameters (flat arrays, compact encoding schemes). This changes the physical representation parameters of the data while preserving its logical structure, enabling faster memory loading and more efficient manipulation by software engineering tools.
Solution Approach 2:
The patent substitutes the mechanical parsing process with direct binary data loading and manipulation. Instead of using text-based parsers that require complex syntax analysis, the system loads pre-compiled binary intermediate representations that can be directly accessed and manipulated through simple memory operations, dramatically improving both productivity and loading speed.
3Adaptability or versatility
If hierarchical abstract syntax trees are preserved for accurate code representation, then expressivity is improved, but data structure complexity and storage size increase
Solution Approach 1:
The patent applies segmentation by dividing the hierarchical abstract syntax tree into flat, segmented arrays where parent-child relationships are represented through index references rather than nested object structures. This segmentation maintains the expressive hierarchical relationships while representing them in a simpler, more storage-efficient flat array format that reduces structural complexity.
Solution Approach 2:
The patent transforms the multi-dimensional hierarchical tree structure into a one-dimensional flat array representation. By adding dimensional indices (parent pointers, child offsets) to the flat array, it preserves the hierarchical relationships in a different dimensional space, thereby maintaining expressivity while reducing structural complexity and improving storage efficiency.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
A computer-implemented method includes the steps of receiving source code, the source code having an associated grammar; generating a binary intermediate representation of the source code; and performing subsequent processing on the binary intermediate representation.