Subroutine Graphs for Formal Language Processing
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing formal language processing methods face challenges in efficiently managing intermediate representations of code, particularly in compilers, due to substantial memory usage and redundancy when expanding subgraphs during graph construction, leading to large generated files that are not manageable by modern compilers.
Innovation Solution
The method involves decomposing entire graphs into subroutine graphs, using stack-based processing to represent positions as node stacks, and employing pre-order traversal, path tracing, and labeling to navigate and analyze graphs without expanding them, thereby reducing memory usage and generating compact, efficient code.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If subgraphs are expanded during graph construction in formal language processing, then complete graph representations can be obtained, but memory usage increases substantially and generated files become large and unmanageable
Solution Approach 1:
The patent divides the entire graph into multiple subroutine graphs, where each subroutine graph represents a portion of the overall computation. Instead of expanding and storing the complete graph, the system processes and stores individual subroutine graphs separately, then combines them during execution. This segmentation reduces memory usage while maintaining the ability to represent complete graph structures when needed.
Solution Approach 2:
The patent implements a nested structure where subroutine graphs contain embedded position information and references to other subroutine graphs. Each subroutine graph is self-contained with metadata about its position in the overall graph structure, allowing the system to reconstruct the complete graph representation through nested references without physically expanding all subgraphs simultaneously in memory.
2Measurement precision
If entire graphs are expanded for processing, then complete analysis can be performed, but runtime performance decreases due to large data structures
Solution Approach 1:
The patent performs preliminary classification of subroutines and pre-computation of position information during the graph construction phase. By organizing subroutine graphs with pre-calculated position metadata and establishing reference relationships in advance, the system eliminates the need for expensive graph expansion operations during runtime, thereby improving performance while maintaining analysis completeness.
Solution Approach 2:
The patent extracts and stores only the essential position information and structural metadata from complete graph expansions. Instead of maintaining full graph expansions in memory, the system extracts critical position data and stores compact representations that can be used for analysis without requiring the complete graph structure to be physically present, thus improving runtime performance.
3Measurement precision
If graph positions are tracked using traditional methods, then accurate position information can be obtained, but memory consumption increases
Solution Approach 1:
The patent implements local quality by storing position information in a distributed manner across individual subroutine graphs rather than maintaining a single global position structure. Each subroutine graph contains local position metadata that is sufficient for analyzing that specific subroutine, eliminating the need to load and maintain complete global graph position information in memory, thus reducing memory consumption while preserving position tracking accuracy.
Data Source
AI summary
A method to process subroutine-structured graph-based intermediate representations during formal language processing implemented by a computing device. The method includes classifying a set of subroutines identified in an intermediate representation of code according to mutually recursive relationships between subroutines in the set of subroutines, recording the mutually recursive relationships, labeling to track the mutually recursive relationships, constructing a set of graph representations, collecting partial positions that distinguish points of action in generated code, labeling nodes of the graph of the intermediate representation, generating a subsequent intermediate representation by serialization of the graph of the intermediate representation through pre-order depth-first traversal, and creating the generated code from the intermediate representation.


