ABSTRACT

Embodiments of the methods and apparatus for automatic cross-language program code translation are provided.

One or more characters of a source programming language code are tokenized to generate a list of tokens. After that, the list of tickets is parsed to generate a grammatical data structure comprising one or more data nodes. The grammatical data structure may be an abstract syntax tree. The one or more data nodes of the grammatical structure are processed to generate a document object model comprising one or more portable data nodes. Subsequently, the one or more portable data nodes in the document object model are analyzed to generate more characters of a target programming language code.

Methods and apparatus for automatic translation of a computer program language code
Automatic translation of a computer program language code

Automatic translation of a computer program language code

An Inventor: Dr. Tal Lavian

FIELD OF THE INVENTION

The invention relates to the computer-aided translation of programming languages, and more specifically, the invention relates to the real-time automatic translation of computer programming language code.

BACKGROUND OF THE INVENTION

Various users across the globe communicate or perform various activities on computer and device networks.

Moreover, the users interact with each other through the networks, such as the Internet. Typically, the users use devices like personal computers to interact over the Internet. The users can interact from various Internet websites or social networking sites, such as Facebook, Myspace, Hi5, Orkut, etc. Recently, the development in mobile devices such as cell phones, smartphones and PDAs, computers, laptops, and the like has enabled them to perform various activities on networks such as the Internet. Moreover, mobile devices can be used for real-time interaction with other users on the network. The interaction or communication can be in chatting, playing interactive online games, browsing, shopping, music, video, banking, business, and the like.

The rapid pace of innovation in technology has generated various types of devices and platforms. Moreover, the number of devices is increasing rapidly. For example, there are various operating systems available for the devices such as Windows, Linux, Macintosh, and Symbian, etc. Moreover, a large number of J2ME platforms are available for mobile devices such as cell phones. Furthermore, mobile devices have a wide range of capabilities in screen size, screen type, screen resolution, processor, memory, etc. The applications for these devices have to be developed based on their platforms. Therefore, each application has to be ported to other platforms. For example, in computer games, the programming languages typically used are JAVA, C#, C++, Action Script, and the like. Therefore, an application developed in Action Script programming language may have to be ported to other programming languages when not supported by a device platform. Further, new applications are being continuously developed for different device platforms.

Typically, the programming code of an application is translated manually from one programming language to another. However, manual translation requires specific and in-depth knowledge of the programming languages of the different operating systems. Moreover, manual translation is a very time-consuming process. Furthermore, the programming languages are constantly developed or get modified. Furthermore, the applications have to be developed on specific development platforms compatible with the programming language used for development and a device’s operating system. As a result, a completed revision of the application code may be required to make the interaction possible. Some mechanisms, such as emulation of applications, are available to support multiple devices. However, the existing mechanisms generate application program codes that are large or require heavy processing time. The problem is compounded by the continuously increasing number of device platforms and technology.

A mechanism is, therefore, desirable to automate the task of cross translating one programming language into another.

SUMMARY

The invention provides a method for automatic translation of a computer program language code.

The method comprises tokenizing one or more characters of a source programming language code to generate a list of tokens. The list of tokens is parsed to create an abstract syntax tree, which comprises one or more data nodes. After that, the abstract syntax tree’s one or more data nodes are processed to generate a document object model. The document object model comprises one or more portable data nodes. Subsequently, the one or more portable data nodes in the document object model are analyzed to generate more characters of a target programming language code.

The invention further provides a computer-implemented method for automatically translating a computer program language code for real-time applications. The computer-implemented method comprises tokenizing one or more characters of a source programming language code to generate a list of tokens based on a set of expression rules. The list of tokens is parsed to create an abstract syntax tree based on a set of grammar rules, wherein the abstract syntax tree comprises one or more data nodes. Thereafter, the one or more data nodes of the abstract syntax tree are processed to generate a document object model. The document object model comprises one or more portable nodes. Subsequently, the one or more portable nodes of the document object model are analyzed to generate more characters of a target programming language code.

The present invention further provides an apparatus for automatic translation of a computer program language code. The apparatus comprises a tokenizer configured to tokenize one or more characters of a source programming language code to generate a list of tokens. Further, the device comprises a parser configured to parse the list of tokens to generate an abstract syntax tree, wherein the abstract syntax tree comprises one or more data nodes; a generator configured to process the one or more data nodes of the abstract syntax tree to generate a document object model, wherein the document object model comprises one or more portable data nodes; and an analyzer configured to process the one or more portable data nodes in the document object model to generate one or more characters of a target programming language code.

The present invention further provides a computer-readable medium having computer-executable instructions for performing a method for language translation of a computer program code, said method comprising the steps of: tokenizing one or more characters of a source programming language code to generate a list of tokens based on a set of expression rules; parsing the list of tokens to generate an abstract syntax tree based on a set of a grammar rule, wherein the abstract syntax tree comprises one or more data nodes; processing the one or more data nodes of the abstract syntax tree to generate a document object model, wherein the document object model comprises one or more portable nodes; and analyzing the one or more portable nodes of the document object model to generate one or more characters of a target programming language code.

The present invention further provides a computer-implemented system for automatic translation of a computer program language code, comprising: means for tokenizing one or more characters of a source programming language code to generate a list of tokens; means for parsing the list of tokens to generate an abstract syntax tree, wherein the abstract syntax tree comprises one or more data nodes; means for processing the one or more data nodes of the abstract syntax tree to generate a document object model, wherein the document object model comprises one or more portable data nodes; and means for analyzing the one or more portable data nodes in the document object model to generate one or more characters of a target programming language code.