Statically Typed Code Generation from Dynamic Arrays

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Dynamically typed programming languages cannot be directly represented in statically typed programming languages, leading to difficulties in error detection and code translation between these two environments.

Innovation Solution

A method and system for generating statically typed program code from dynamically typed program code by classifying dynamically typed arrays into homogeneous, heterogeneous, or other categories, using classification rules and type inference techniques, and converting them into intermediate representations that can be translated into statically typed code.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of operation

If dynamically typed arrays are used in programming, then flexibility and ease of operation are improved, but error detection capability deteriorates

Engineering Contradiction:
ImproveflexibilityVSAvoiderror detection capability
Core Design Contradiction:
Ease of operationVSReliability

Solution Approach 1:

The patent introduces an intermediate representation layer between dynamically typed source code and statically typed target code. This intermediary enables the translation process to preserve the flexibility of dynamic typing while achieving the error detection capabilities of static typing in the generated code.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If code translation from dynamically typed to statically typed languages is performed, then error detection and code quality are improved, but device complexity increases

Engineering Contradiction:
Improveerror detectionVSAvoidtranslation system complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The translation system is divided into distinct functional modules: a classifier that categorizes dynamically typed arrays into homogeneous or heterogeneous types, and a code generator that produces statically typed code based on these classifications. This segmentation manages complexity by breaking down the translation task into manageable, specialized components.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system changes the typing parameter from dynamic to static through automated classification. By analyzing the source code and determining whether arrays are homogeneous or heterogeneous, the system automatically selects appropriate static type representations, transforming the code's typing characteristics without manual intervention.

Inventive Principle:
Principle #35Parameter changes

3Manufacturing precision

If dynamically typed arrays are converted to statically typed representations, then manufacturing precision and measurement precision are improved, but adaptability deteriorates

Engineering Contradiction:
Improvecode translation precisionVSAvoidarray type flexibility
Core Design Contradiction:
Manufacturing precisionVSAdaptability or versatility

Solution Approach 1:

The classifier applies different classification rules to different arrays based on their specific characteristics. Homogeneous arrays are classified as such and converted to corresponding static types, while heterogeneous arrays receive different treatment. This local quality approach ensures each array is translated with the appropriate precision while maintaining the overall program's functionality.

Inventive Principle:
Principle #3Local quality

Data Source

PatentUS10216501B2Generating code in statically typed programming languages for dynamically typed array-based language
Publication Date: 2019.02.26 MATHWORKS INC
  • US10216501B2 patent drawing
  • US10216501B2 patent drawing
  • US10216501B2 patent drawing

AI summary

Described are methods, systems and computer-readable media storing instructions that when executed on one or more processors execute a process for generating second program code in a statically typed programming language from first program code in a dynamically typed programming language. The first program code contains or, when executed, generates or operates on a dynamically typed array. The second program code may be generated by classifying the dynamically typed array into one of multiple categories, such as homogeneous, heterogeneous, or another, based on the array contents, array usage, and/or user input, and generating the second program code in the statically typed programming language based on the classification(s).