Declarative Program Engine for Static Analysis
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Static program analysis in large-scale programs expressed in declarative programming languages becomes impractical due to the need for extensive source code and increased complexity, making it difficult to detect security vulnerabilities effectively.
Innovation Solution
A staged compilation process that translates declarative programs into relational algebra machines (RAM) using a modified semi-naïve algorithm, followed by conversion into imperative programming language code, generating specialized extractor and query API code, and compiling these into a program analysis module for static analysis.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If static program analysis is performed on large-scale programs using declarative programming languages, then security vulnerabilities can be detected, but the complexity of the analysis increases and extensive source code is required making it impractical
Solution Approach 1:
The patent segments the complex static analysis process into multiple distinct modules including a parser module that converts declarative program code into an abstract syntax tree, an analysis module that processes the AST, and a code generation module that produces executable analysis code. This modular segmentation reduces overall system complexity by breaking down the monolithic analysis process into manageable, independently configurable components that can be executed in stages
Solution Approach 2:
The patent introduces an abstract syntax tree (AST) as an intermediary representation between the declarative program code and the analysis logic. The AST serves as a standardized intermediate format that decouples the input program representation from the analysis algorithms, allowing complex analyses to be performed on a simplified, structured representation rather than directly on the original complex source code
2Ease of manufacture
If declarative programs are used for static program analysis, then the analysis can be expressed concisely, but performance deteriorates when programs become very large
Solution Approach 1:
The patent performs preliminary actions by pre-compiling declarative analysis programs into executable code before actual analysis execution. The system includes a code generation module that translates high-level declarative specifications into optimized imperative code, and a caching mechanism that stores pre-compiled analysis modules. This preliminary compilation transforms concise but slow declarative programs into high-performance executable code, maintaining ease of expression while dramatically improving runtime performance for large-scale programs
Solution Approach 2:
The patent changes the execution parameter of the analysis system by implementing a hybrid execution model that can switch between interpreting declarative programs directly and executing pre-compiled imperative code. The system dynamically selects the appropriate execution mode based on program size and analysis type, allowing it to maintain the simplicity of declarative expression for small programs while achieving imperative-level performance for large-scale analyses through parameter-driven execution strategy selection
Data Source
AI summary
A method and system for staged compilation of a declarative program that includes receiving the declarative program, parsing and semantically checking the declarative program, translating the declarative program into a relational algebra machine (RAM) using a modified semi-naïve algorithm, performing a translation of the RAM into code of an imperative programming language to obtain a translated RAM, generating specialized extractor code in the imperative programming language, generating query application programming interface (API) code in the imperative programming language, and compiling the translated RAM, the specialized extractor code, and the query API code to obtain a program analysis module.


