IP Library Granted Patent US 9,886,249
Granted Patent B2
US 9,886,249 · App. 14/941,710 · Granted Feb 6, 2018

Universal transcompiling framework

Inventors: Marco Pesarese (Nussloch, DE); Stephan Dominik Matthee (Mosbach, DE)
Assignee: SAP SE
G06F8/41G06F11/3604
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,886,249
App. No.
14/941,710
Granted
Feb 6, 2018
Kind
B2
Abstract

Described herein is a transcompiling framework. In accordance with one aspect, the framework generates a source abstract syntax representation corresponding to source code written in a source language. The framework may determine validity of constraints of a common denominator language by parsing the source abstract syntax representation, wherein the common denominator language is a set of intersects provided by the source language and reachable by a target language. In response to determining the constraints are valid, the source abstract syntax representation may be transformed to a target syntax representation associated with the target language. The target syntax representation is then printed as transcompiled source code in the target language.

Claims (41)

1. A method of transcompilation, comprising:

receiving source code written in a source language;

in response to determining that the source code is platform independent, generating a source abstract syntax tree corresponding to the the source code;

determining a common denominator language with a language feature set that is reduced to include only common language patterns that are supported by multiple platforms, wherein the common denominator language comprises a set of intersects that are provided by the source language and are reachable by multiple target languages;

determining that constraints associated with the common denominator language are satisfied by parsing the source abstract syntax tree;

in response to determining that the constraints are satisfied, transforming the source abstract syntax tree to a target syntax tree associated with at least one of the multiple target languages;

printing the target syntax tree as transcompiled source code in the at least one of the multiple target languages; and

packaging the transcompiled source code as a target source artifact.

2. A system, comprising:

a non-transitory memory device for storing a computer-readable program code; and

a processor in communication with the memory device, the processor being operative with the computer-readable program code to:

generate a source abstract syntax representation corresponding to source code written in a source language,

determine a common denominator language with a language feature set that is reduced to include only common language patterns that are supported by multiple platforms, wherein the common denominator language comprises a set of intersects that are provided by the source language and are reachable by multiple target languages,

parse the source abstract syntax representation to determine that constraints of the common denominator language are satisfied,

in response to determining the constraints are satisfied, transform the source abstract syntax representation to a target syntax representation associated with at least one of the multiple target languages,

print the target syntax representation as transcompiled source code in the at least one of the multiple target languages, and

package the transcompiled source code as a target source artifact.

3. The system of claim 2 wherein the common denominator language is based on Java or JavaScript.

4. The system of claim 2 wherein the source language is Java and the at least one of the multiple target languages is C#, Objective C, ABAP, JavaScript or C++.

5. The system of claim 2 wherein the set of intersects comprises classes, variables, conditions, objects, loops, primitive data types, behavior, or a combination thereof.

6. The system of claim 2 wherein the processor is operative with the computer-readable program code to parse the source code and determine validity of constraints associated with the source language.

7. The system of claim 2 wherein the processor is operative with the computer-readable program code to determine whether the source code is platform independent or dependent by parsing the source code for annotations that indicate that the source code is platform independent or dependent.

8. The system of claim 7 wherein the processor is operative with the computer-readable program code to generate the source abstract syntax representation in response to a determination that the source code is platform independent.

9. The system of claim 2 wherein the processor is operative with the computer-readable program code to determine validity of constraints of the common denominator language by checking against predefined restrictions on language expressions.

10. The system of claim 9 wherein the predefined restrictions allow single inheritance, interface, static and instance method, simple generics, primitive type, for-loop, while-loop, if-condition, basic expression with assign, comparison, boolean and mathematical operator, increment/decrement unary operator, method call, exception, basic constant, or a combination thereof.

11. The system of claim 9 wherein the predefined restrictions disallow Java language core library class, inner class, constructor, method overloading, method return type that cannot be extended during inheritance, multithreading, constant in interface, language element using native interface or class, or a combination thereof.

12. The system of claim 2 wherein the processor is operative with the computer-readable program code to generate one or more error messages in response to determining the constraints are not satisfied.

13. The system of claim 2 wherein the processor is operative with the computer-readable program code to transform the source abstract syntax representation to multiple target syntax representations associated with the multiple target languages.

14. The system of claim 2 wherein the processor is operative with the computer-readable program code to transform the source abstract syntax representation to the target syntax representation by mapping valid parts of the source abstract syntax representation that satisfy the constraints into the target syntax representation.

15. The system of claim 2 wherein the processor is operative with the computer-readable program code to transform the source abstract syntax representation to the target syntax representation based on one or more predefined rules in a configuration file.

16. The system of claim 2 wherein the processor is operative with the computer-readable program code to print the target syntax representation by matching a node of the target syntax representation to a target string in accordance with one or more predefined rules.

17. The system of claim 2 wherein the processor is operative with the computer-readable program code to package the transcompiled source code with at least one native library as a layered target source artifact.

18. A non-transitory computer-readable medium having stored thereon program code, wherein the program code is executable by a computer to:

generate a source abstract syntax representation corresponding to source code written in a source language;

determine a common denominator language with a language feature set that is reduced to include only common language patterns that are supported by multiple platforms, wherein the common denominator language comprises a set of intersects that are provided by the source language and are reachable by multiple target languages;

determine that constraints of the common denominator language are satisfied by parsing the source abstract syntax representation;

in response to determining the constraints are satisfied, transform the source abstract syntax representation to a target syntax representation associated with at least one of the multiple target languages;

print the target syntax representation as transcompiled source code in the at least one of the multiple target languages; and

package the transcompiled source code as a target source artifact.

19. The non-transitory computer-readable medium of claim 18 wherein the common denominator language is based on Java or JavaScript.

20. The non-transitory computer-readable medium of claim 18 wherein the program code is executable by the computer to determine validity of constraints of the common denominator language by checking against predefined restrictions on language expressions.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 16, 2015
From: PESARESE, MARCO; MATTHEE, STEPHAN DOMINIK
To: SAP SE
Reel/Frame 037112/0284 →
Continuity (1)
Related Publication 20170139690A1 · May 18, 2017