AST-Based Source Code Modification for Precise Adaptation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing computer programs lack the ability to adapt to different circumstances without modifying the underlying code, limiting their flexibility and efficiency in various environments.

Innovation Solution

A data processing apparatus and method that utilizes an abstract syntax tree (AST) to identify specific locations in source code for precise modifications, allowing for changes without altering the underlying code, using modification instructions that can specify locations based on functional actions rather than textual matches.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If the underlying source code is changed to adapt to different circumstances, then the program can work under different conditions, but the code integrity and stability deteriorate

Engineering Contradiction:
Improveadaptability to different circumstancesVSAvoidcode integrity
Core Design Contradiction:
Adaptability or versatilityVSStability of the object's composition

Solution Approach 1:

The patent segments the code modification process by introducing a separate transformation layer that operates on top of the original source code. The source code remains unchanged while transformation rules are applied to generate context-specific versions, thereby maintaining code integrity while achieving adaptability.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces an intermediary transformation system that acts as a mediator between the original source code and the target execution environment. This intermediary layer applies modifications without altering the underlying code, resolving the contradiction between adaptability and code stability.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Ease of manufacture

If text-based matching is used to locate code for modification, then the modification process is simple, but the precision and reliability of modification deteriorate due to code refactoring

Engineering Contradiction:
Improveease of modificationVSAvoidmodification location precision
Core Design Contradiction:
Ease of manufactureVSMeasurement precision

Solution Approach 1:

The patent replaces the mechanical text-based matching system with an abstract syntax tree (AST) based system. The AST provides a structured representation of the code that enables precise location identification through syntax-based matching rather than simple text search, thereby improving modification precision while maintaining ease of use.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Solution Approach 2:

The patent transitions from one-dimensional text matching to a multi-dimensional AST-based matching system. The AST introduces structural dimensions (hierarchy, syntax relationships) that enable more accurate location identification, resolving the precision problem while preserving ease of modification.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

3Adaptability or versatility

If the source code is modified for different purposes such as testing or platform adaptation, then versatility is improved, but the complexity of managing multiple code versions increases

Engineering Contradiction:
Improveversatility for different purposesVSAvoidcomplexity of managing code versions
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent creates transformed copies of the source code through application of transformation rules rather than manually managing multiple code versions. The original code serves as a single source of truth, and various versions are generated on-demand through systematic transformation, reducing management complexity while maintaining versatility.

Inventive Principle:
Principle #26Copying

Solution Approach 2:

The patent creates a universal transformation system that can generate different code versions for different purposes (testing, platform adaptation, etc.) from a single source code base. This multi-functional approach eliminates the need to maintain separate code versions for different purposes, reducing complexity while enhancing versatility.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Data Source

PatentUS20260050425A1Modifying program code
Publication Date: 2026.02.19 ARM LTD
  • US20260050425A1 patent drawing
  • US20260050425A1 patent drawing
  • US20260050425A1 patent drawing

AI summary

A data processing apparatus is provided. Source input circuitry receives source code. Modification input circuitry receives a modification instruction that indicates a location in the source code and a modification to be made to the source code at the location. Processing circuitry applies the modification to the location in the source code in order to produce output code. An abstract syntax tree is generated from the source code and the abstract syntax tree is used to identify the location.