Intermediate Language Pattern Matcher Generation via Unifiable Forms
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing pattern matchers for intermediate language code compilation are complex, require significant learning, and are inefficient in catching input patterns with slight variations, leading to high maintenance needs and frequent failures due to changes in the compiler or optimizations.
Innovation Solution
A method and system for automatically generating pattern matchers by identifying and reducing input elements to common and unique uses, creating unifiable forms, and generating EMTF-conformant pattern matchers that can handle variations and changes in the compiler environment.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If pattern matchers are written manually to match specific programming idioms, then matching precision for specific patterns is improved, but the number of pattern matchers required increases and maintenance complexity increases
Solution Approach 1:
The patent uses template-based pattern matcher generation where a single template can be instantiated multiple times with different substitutions. This allows one pattern matcher design to cover multiple specific patterns through parameter substitution, reducing the number of individual pattern matchers needed while maintaining matching precision for each specific pattern.
Solution Approach 2:
The patent creates universal pattern matchers that can match multiple programming idioms through a single template design. By using generic placeholders and substitution mechanisms, one pattern matcher template can serve multiple functions by matching different patterns through parameter instantiation, thereby reducing overall complexity.
2Adaptability or versatility
If pattern matchers are made flexible to accommodate variations in input patterns, then adaptability to different programming styles is improved, but matching precision for specific patterns decreases
Solution Approach 1:
The patent employs dynamic pattern matching where the matcher can adapt its behavior based on the input pattern. Through substitution mechanisms and parameterized templates, the pattern matcher dynamically adjusts to match variations in programming idioms while maintaining precision for each specific pattern through controlled substitution rules.
Solution Approach 2:
The patent uses parameterized pattern templates where placeholders can be substituted with different values based on the input pattern. This allows the same template to adapt to multiple pattern variations by changing parameters, while maintaining matching precision through systematic substitution that preserves the structural relationships of the patterns.
3Reliability
If pattern matchers are updated to handle compiler changes and optimizations, then reliability is improved, but maintenance time and complexity increase
Solution Approach 1:
The patent generates pattern matchers automatically from high-level pattern specifications before they are needed in the compiler. This preliminary generation creates robust, up-to-date pattern matchers that reflect current compiler optimizations and changes, eliminating the need for manual updates and reducing maintenance time while ensuring reliability.
Solution Approach 2:
The patent implements a self-updating mechanism where pattern matchers are regenerated automatically when compiler changes occur. The system maintains reliability by continuously updating patterns to match current compiler behavior without requiring manual intervention, thereby reducing maintenance time and effort.
4Ease of operation
If pattern matchers are designed to be simple and easy to write, then ease of operation is improved, but the ability to handle complex input patterns decreases
Solution Approach 1:
The patent segments complex pattern matching into modular template components. By breaking down complex patterns into reusable template elements with placeholders, users can easily create pattern matchers for complex input patterns through simple template instantiation and substitution, maintaining both ease of operation and capability to handle complexity.
Solution Approach 2:
The patent introduces template substitution as an intermediary mechanism between simple user specifications and complex pattern matching requirements. Users write simple patterns using high-level syntax, and the substitution mechanism automatically translates this into complex pattern matching logic, thereby maintaining ease of operation while handling complex patterns.
Data Source
AI summary
Embodiments of the present invention address deficiencies of the art in respect to pattern matcher generation and provide a method, system and computer program product for automatic pattern matching and generation of intermediate language patterns. In one embodiment of the invention, a pattern matcher generation method can be provided. The method can include identifying input elements from intermediate language code, reducing the identified input elements from the intermediate language code to inputs of common and unique use, creating a unifiable form for each of the input elements of common and unique use, and generating a pattern matcher for each of the input elements of common and unique use in the intermediate language code using a corresponding unifiable form in place of each of the input elements of common and unique use. In particular, the generated pattern matcher can be expression matching and transformation programming framework (EMTF) conformant.


