Universal Abstract Syntax Tree for Cross-Language Code Classification

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional machine learning models are limited to classifying code in a single programming language, making it difficult to generalize learning across different programming languages.

Innovation Solution

A system that generates universal abstract syntax trees for code fragments in various programming languages, using a graph embedding model to create language-independent vectors that can be classified by an abstract syntax tree classifier, enabling classification across multiple programming languages.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If conventional machine learning models are used for code classification, then classification accuracy for a single programming language can be achieved, but the model cannot generalize to other programming languages

Engineering Contradiction:
Improvelanguage independenceVSAvoidclassification accuracy
Core Design Contradiction:
Adaptability or versatilityVSMeasurement precision

Solution Approach 1:

The patent creates a universal abstract syntax tree structure that can represent multiple programming languages (Java, Python, C#, JavaScript) within a single unified framework. This universal AST enables a single machine learning model to process and classify code from different languages without requiring language-specific models, thereby achieving both versatility and maintained classification accuracy through language-agnostic representation

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

2Measurement precision

If language-specific machine learning models are trained for each programming language, then classification accuracy for that language improves, but the system complexity increases

Engineering Contradiction:
Improveclassification accuracyVSAvoidsystem complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

Instead of maintaining separate machine learning models for each programming language, the patent employs a single universal model that processes universal abstract syntax trees. This unified approach eliminates the need for multiple language-specific models and their associated training data requirements, significantly reducing system complexity while maintaining classification accuracy across different languages

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

Solution Approach 2:

The patent introduces an intermediary translation layer that converts various programming languages into a universal abstract syntax tree representation before feeding them to the machine learning model. This intermediary universal AST acts as a bridge between diverse source languages and the single classifier, simplifying the overall system architecture by decoupling language-specific parsing from the classification logic

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS11995439B2Language agnostic code classification
Publication Date: 2024.05.28 ORACLE INT CORP
  • US11995439B2 patent drawing
  • US11995439B2 patent drawing
  • US11995439B2 patent drawing

AI summary

A system may include a computer processor and a repository configured to store a first code fragment including language features represented in a first programming language, and a second code fragment including language features represented in a second programming language. The system may further include a universal code fragment classifier, executing on the computer processor and configured to generate a first universal abstract syntax tree for the first code fragment and a second universal abstract syntax tree for the second code fragment, generate, using a graph embedding model, first vectors for the first universal abstract syntax tree and second vectors for the second universal abstract syntax tree, and classify, by executing an abstract syntax tree classifier on the first vectors and the second vectors, the first code fragment as a first code category and the second code fragment as a second code category.