Login| Sign Up| Help| Contact|

Patent Searching and Data


Title:
METHOD AND APPARATUS FOR HANDLING MULTIPLE LANGUAGE REPRESENTATIONS OF COMPUTER CODE
Document Type and Number:
WIPO Patent Application WO/2015/030722
Kind Code:
A1
Abstract:
A method of handling multi-language computer code includes receiving, at a computing system, computer code including at least one code block, the at least one code block including code written in a first high-level programming language and code written in a second high-level programming language, the first and second high-level programming languages being different from each other; translating, at the computing system, the first high-level language code into a first section of intermediate code, the intermediate code being code written in an intermediate programming language different from the first and second high-level languages; translating, at the computing system, the second high-level language code into a second section of intermediate code; and translating, at the computing system, the first and second sections of intermediate code into program code.

Inventors:
MUTTON HAROLD R (CA)
KUTT CHRISTOPHER LOUIS (CA)
BROCHU EVAN MICHAEL (CA)
Application Number:
PCT/US2013/056744
Publication Date:
March 05, 2015
Filing Date:
August 27, 2013
Export Citation:
Click for automatic bibliography generation   Help
Assignee:
GE INTELLIGENT PLATFORMS INC (US)
International Classes:
G06F9/45
Foreign References:
US5586328A1996-12-17
Attorney, Agent or Firm:
CONKLIN, Mark, A. et al. (Global Patent Operation2 Corporate Drive, Suite 64, Shelton CT, US)
Download PDF:
Claims:
What is claimed:

1. A method of handling multi-language computer code, the method comprising:

receiving, at a computing system, computer code including at least one code block, the at least one code block including code written in a first high-level programming language and code written in a second high-level programming language, the first and second high-level programming languages being different from each other;

translating, at the computing system, the first high-level language code into a first section of intermediate code, the intermediate code being code written in an intermediate programming language different from the first and second high-level languages;

translating, at the computing system, the second high-level language code into a second section of intermediate code; and

translating, at the computing system, the first and second sections of intermediate code into program code.

2. The method of claim 1, wherein the first and second high-level programming languages are each one of a structured text programming language, a functional data block programming language, a ladder logic programming language, an instruction list programming language, and a sequential function chart programming language.

3. The method of claim 1, wherein the intermediate language is an abstract syntax tree (AST).

4. The method of claim 1 , wherein the program code is one of assembly code and machine code.

5. A method of handling multi-language computer code switching, the method comprising:

receiving, at a computing system, computer code written in a first high-level programming language;

receiving, at a computing system, a request to switch a language of the received computer code to a target high-level programming language, the first and target high-level programming languages being different from each other;

translating, at the computing system, the first high-level language code into intermediate code, the intermediate code being code written in an intermediate programming language different from the first and target high-level programming languages; and

translating, at the computing system, the intermediate code into target code written in the target high-level programming language.

6. The method of claim 5, wherein the first and target high-level programming languages are each one of a structured text programming language, a functional data block programming language, a ladder logic programming language, an instruction list programming language, and a sequential function chart programming language.

7. The method of claim 5, wherein the intermediate programming language is an abstract syntax tree (AST).

8. The method of claim 5, further comprising:

displaying, at the computing system, the target code.

9. A computing system comprising:

a processor; and

a storage device storing instructions that, when executed by the processor, cause the processor to control operations for handling multi-language computer code, the operations including,

receiving, at a computing system, computer code including at least one code block, the at least one code block including code written in a first high- level programming language and code written in a second high-level programming language, the first and second high-level programming languages being different from each other;

translating, at the computing system, the first high-level language code into a first section of intermediate code, the intermediate code being code written in an intermediate programming language different from the first and second high-level languages;

translating, at the computing system, the second high-level language code into a second section of intermediate code; and

translating, at the computing system, the first and second sections of intermediate code into program code.

10. The system of claim 9, wherein the first and second high-level programming languages are each one of a structured text programming language, a functional data block programming language, a ladder logic programming language, an instruction list programming language, and a sequential function chart programming language.

11. The system of claim 9, wherein the intermediate language is an abstract syntax tree (AST).

12. The method of claim 9, wherein the program code is one of assembly code and machine code.

13. A computing system comprising:

a processor; and

a storage device storing instructions that, when executed by the processor, cause the processor to control operations for handling multi-language computer code switching, the operations including,

receiving, at a computing system, computer code written in a first high-level programming language;

receiving, at a computing system, a request to switch a language of the received computer code to a target high-level programming language, the first and target high-level programming languages being different from each other; translating, at the computing system, the first high-level language code into intermediate code, the intermediate code being code written in an intermediate programming language different from the first and target high- level programming languages; and

translating, at the computing system, the intermediate code into target code written in the target high-level programming language.

14. The system of claim 13, wherein the first and target high-level programming languages are each one of a structured text programming language, a functional data block programming language, a ladder logic programming language, an instruction list programming language, and a sequential function chart programming language.

15. The system of claim 13, wherein the intermediate programming language is an abstract syntax tree (AST).

16. The system of claim 13, further comprising:

displaying, at the computing system, the target code.

Description:
METHOD AND APPARATUS FOR HANDLING MULTIPLE LANGUAGE REPRESENTATIONS OF COMPUTER CODE

BACKGROUND

1. Field

[0001] The subject matter disclosed herein relates generally to the field of compiling and decompiling computer code.

2. Description of Related Art

[0002] Computers, e.g., digital computers, include processors which operate in accordance with instructions represented by programming code. The programming code executed by computers is represented by machine code which generally includes instructions formed by various patterns of bits (i.e. O's and Ts). Assembly code is a higher level version of machine code in terms of abstraction. Assembly code generally includes instructions which have a one-to-one relationship with the instructions defined for the machine code.

[0003] Modern computers are used to perform highly complex operations. Writing programs to implement the highly complex calculations, functions and applications used on modern computers may be very difficult for a computer programmer to do using only machine or assembly or code. High-level programming languages are easier for a computer programmer to understand and use. Accordingly, computer programmers often use code written in a high-level programming language, referred to as source code, to define computer programs. However, in general, processors cannot read the high-level source code directly. Accordingly, compilers are used to translate source code, which is written in a high-level programming language that a computer programmer can easily understand and use, into a lower-level language, like assembly code. Assemblers may then be used to translate the assembly code into machine code which can be used directly by the processors of computers.

SUMMARY

[0004] According to at least one example embodiment, a method of handling multi-language computer code includes receiving, at a computing system, computer code including at least one code block, the at least one code block including code written in a first high-level programming language and code written in a second high- level programming language, the first and second high-level programming languages being different from each other; translating, at the computing system, the first high- level language code into a first section of intermediate code, the intermediate code being code written in an intermediate programming language different from the first and second high-level languages; translating, at the computing system, the second high-level language code into a second section of intermediate code; and translating, at the computing system, the first and second sections of intermediate code into program code.

[0005] The first and second high-level programming languages may each be one of a structured text programming language, a functional block diagram programming language, a ladder logic programming language, an instruction list programming language, and a sequential function chart programming language .

[0006] The intermediate language may be an abstract syntax tree (AST).

[0007] The program code may be one of assembly code and machine code.

[0008] According to at least one example embodiment, a method of handling multi-language computer code switching includes receiving, at a computing system, computer code written in a first high-level programming language; receiving, at a computing system, a request to switch a language of the received computer code to a target high-level programming language, the first and target high-level programming languages being different from each other; translating, at the computing system, the first high-level language code into intermediate code, the intermediate code being code written in an intermediate programming language different from the first and target high-level programming languages; and translating, at the computing system, the intermediate code into target code written in the target high-level programming language.

[0009] The first and target high-level programming languages may each be one of a structured text programming language, a functional data block programming language and a ladder logic programming language.

[0010] The intermediate programming language may be an abstract syntax tree (AST).

[001 1] The method may further include displaying, at the computing system, the target code.

[0012] According to at least one example embodiment, a computing system includes a processor; and a storage device storing instructions that, when executed by the processor, cause the processor to control operations for handling multi-language computer code, the operations including, receiving, at a computing system, computer code including at least one code block, the at least one code block including code written in a first high-level programming language and code written in a second high- level programming language, the first and second high-level programming languages being different from each other; translating, at the computing system, the first high- level language code into a first section of intermediate code, the intermediate code being code written in an intermediate programming language different from the first and second high-level languages; translating, at the computing system, the second high-level language code into a second section of intermediate code; and translating, at the computing system, the first and second sections of intermediate code into program code.

[0013] According to at least one example embodiment, a computing system includes a processor; and a storage device storing instructions that, when executed by the processor, cause the processor to control operations for handling multi-language computer code switching, the operations including, receiving, at a computing system, computer code written in a first high-level programming language; receiving, at a computing system, a request to switch a language of the received computer code to a target high-level programming language, the first and target high-level programming languages being different from each other; translating, at the computing system, the first high-level language code into intermediate code, the intermediate code being code written in an intermediate programming language different from the first and target high-level programming languages; and translating, at the computing system, the intermediate code into target code written in the target high-level programming language.

BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The various features and advantages of the non-limiting embodiments herein may become more apparent upon review of the detailed description in conjunction with the accompanying drawings. The accompanying drawings are merely provided for illustrative purposes and should not be interpreted to limit the scope of the claims. The accompanying drawings are not to be considered as drawn to scale unless explicitly noted. For purposes of clarity, various dimensions of the drawings may have been exaggerated.

[0015] FIG. 1 is a block diagram illustrating a multiple language system according to at least one example embodiment.

[0016] FIG. 2 is a block diagram illustrating an example of a computing system which implements the multiple language system of FIG. 1.

[0017] FIG. 3 is a flow chart illustrating a method of handling multiple language code blocks according to at least one example embodiment.

[0018] FIG. 4 illustrates a screen shot of a code editor application in which source code including two different high-level programming languages has been entered.

[0019] FIG. 5 illustrates a first abstract syntax tree (AST) representation of a structured text (ST) code expression and a ladder diagram (LD) code expression using GEIL Tree language as an example of an AST.

[0020] FIG. 6 is a diagram illustrating a tree structure corresponding to the first GEIL Tree language expression of FIG. 5.

[0021] FIG. 7 illustrates a second AST representation of a ST code expression and a LD code expression using GEIL Tree language as an example of AST.

[0022] FIG. 8 is a diagram illustrating a tree structure corresponding to the second GEIL Tree language expression of FIG. 7.

[0023] FIG. 9 is a flow chart illustrating a method of handling multiple language switching according to at least one example embodiment

DETAILED DESCRIPTION

[0024] It should be understood that when an element or layer is referred to as being "on," "connected to," "coupled to," or "covering" another element or layer, it may be directly on, connected to, coupled to, or covering the other element or layer or intervening elements or layers may be present. In contrast, when an element is referred to as being "directly on," "directly connected to," or "directly coupled to" another element or layer, there are no intervening elements or layers present. Like numbers refer to like elements throughout the specification. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.

[0025] It should be understood that, although the terms first, second, third, etc. may be used herein to describe various elements, components, regions, layers and/or sections, these elements, components, regions, layers, and/or sections should not be limited by these terms. These terms are only used to distinguish one element, component, region, layer, or section from another element, component, region, layer, or section. Thus, a first element, component, region, layer, or section discussed below could be termed a second element, component, region, layer, or section without departing from the teachings of example embodiments.

[0026] Spatially relative terms (e.g., "beneath," "below," "lower," "above," "upper," and the like) may be used herein for ease of description to describe one element or feature's relationship to another element(s) or feature(s) as illustrated in the figures. It should be understood that the spatially relative terms are intended to encompass different orientations of the device in use or operation in addition to the orientation depicted in the figures. For example, if the device in the figures is turned over, elements described as "below" or "beneath" other elements or features would then be oriented "above" the other elements or features. Thus, the term "below" may encompass both an orientation of above and below. The device may be otherwise oriented (rotated 90 degrees or at other orientations) and the spatially relative descriptors used herein interpreted accordingly.

[0027] The terminology used herein is for the purpose of describing various embodiments only and is not intended to be limiting of example embodiments. As used herein, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "includes," "including," "comprises," and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.

[0028] Example embodiments are described herein with reference to cross- sectional illustrations that are schematic illustrations of idealized embodiments (and intermediate structures) of example embodiments. As such, variations from the shapes of the illustrations as a result, for example, of manufacturing techniques and/or tolerances, are to be expected. Thus, example embodiments should not be construed as limited to the shapes of regions illustrated herein but are to include deviations in shapes that result, for example, from manufacturing.

[0029] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which example embodiments belong. It will be further understood that terms, including those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein. [0030] Ordinarily, logic, for example as represented within source code, has been limited to a single language within a single function block. However, with the limitation of one language per function block, the best or most desirable language for a given function within the source code may not be employed in all circumstances. In some cases, certain languages may be better suited to specific tasks. For example, a user may feel that Structured Text (ST) language is well-suited for complex math expressions or moving constructs, while using Function Block Diagram (FBD) language is a good choice when working with feedback loops.

[0031] Herein, elements referred to as 'languages' are understood to be programming languages used to define instructions which can be used to control the operations of programmable logic controllers (PLCs) and/or other digital computers.

[0032] In addition, a particular language used may not be the best fit for the developer's experience. A developer may have a high level of expertise and comfort in one particular language, but he or she may be required to use a different language.

[0033] Further, for a particular program being designed by a developer for an end user, it may be that only one language is understood by end users so developers are limited to using that single language when the task before them may be much more suitably handled using one or more different languages. In terms of programming languages, the limitations of the end users become the limitations of the developer. For example, if a company only has end users who are familiar with Ladder Diagrams (LD), it may not be practical for developers to code in ST which may be the vastly superior method for a given function. This limitation may lead to extremely inefficient code. For example, it may be possible that for a particular program 300 lines of LD could be written with only six lines of ST. Further, in general, it may be a challenge for users if they inherit code that they did not write but must support and it is not presented in a language they are comfortable with. As used herein, the term Ladder Diagram (LD) is synonymous with the term Ladder Logic.

[0034] In order to address the problems discussed above, according to at least one example embodiment, a user may employ multi-language blocks within source code. With multi-language blocks, users are able to write code in more than one language within a single block. For example, as will be discussed in greater detail below, users can enter their code in one or more languages within a block in a code editor of a multi-language system, and the multiple language system will compile the code including the multiple languages.

[0035] Further, according to at least one example embodiment, a user may employ a multi-language switching feature. The multi-language switching features allows users to view and work with multiple coding languages simultaneously by switching between the initial code and a view of that same code displayed in an alternate programming language.

[0036] FIG. 1 is a block diagram illustrating a multiple language system 100. The multiple language system 100 includes a first compiler front end (CFE) 1 12, a second CFE 114, a third CFE 116, a compiler back end (CBE) 130, a first decompiler 152, a second decompiler 154 and a third decompiler 156.

[0037] The multiple language system may receive source code including one or more codes blocks which have code written in one or more of first through third high- level programming languages, languages A-C. As used herein, the terms 'high-level programming language' and 'high-level language' refer to programming languages higher in level, for example in terms of abstraction, than machine code and assembly code. [0038] In accordance with known compiling methods, the first CFE 112 is structured to translate a first high-level programming language, language A, into an intermediate language (IL) 120; the second CFE 114 is structured to translate a second high-level programming language, language B, into the IL 120; and the third CFE 1 16 is structured to translate a third high-level programming language, language C, into the IL 120. Languages A-C may be, for example FBD, LD, and ST, respectively.

[0039] According to at least one example embodiment, the IL 120 is higher in level, in terms of abstraction, than machine code. According to at least one example embodiment, the IL 120 is higher in level, in terms of abstraction, than assembly code.

[0040] The CBE 130 is structured to translate the IL 120 into program code 140. The IL 120 may be, for example, an abstract syntax tree (AST). Program code 140 may be any known type of assembly code or machine code. For example, according to at least one example embodiment, the CBE 130 includes an assembler function. The CBE including the assembler function first translates the IL 120 into assembly code, and then uses the assembler function to translate the assembly code into machine code. Program code 140 may loaded into a digital computer device, for example a PLC, in order to control the operations of the device.

[0041] In accordance with known decompiling methods, the first decompiler 152 is structured to translate the IL 120 into language A; the second decompiler 154 is structured to translate the IL 120 into language B; the third decompiler 156 is structured to translate the IL 120 into language C.

[0042] Though only three languages and three CFEs are illustrated in multiple language system 100, the multiple language system 100 may include any number of CFEs each of which respectively translate any number of high-level programming languages into the IL 120. Though only three decompilers are illustrated in multiple language system 100, the multiple language system 100 may include any number of decompilers each of which translate the IL 120 respectively into any number of high- level programming languages. Examples of additional high level languages which could be compiled and/or decompiled by the multiple language system include the instruction list programming language, and the sequential function chart programming language.

[0043] FIG. 2 is a block diagram illustrating an example of a computing system which implements the multiple language system 100. Referring to FIG. 2, the computing system 200 may include, for example, a data bus 259, a display unit 252, an input unit 254, a storage unit 256, and a processor unit 258.

[0044] The display unit 252, input unit 254, storage unit 256, and processor unit 258 may send data to and/or receive data from one another using the data bus 259.

[0045] The display unit 252 displays information in a graphical manner, for example, for viewing by a user. The display unit 252 may include any device capable of displaying information including, for example, one or more of a monitor, a television, a liquid crystal display (LCD) display device, a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, and the like.

[0046] The input unit 254 receives data as input, for example, from a user. The input unit 245 may include any device capable of receiving input data including, for example, one or more of a mouse, a touchpad, a touchscreen, a keyboard, a microphone, a camera, and the like. [0047] The memory unit 256 may be any device capable of storing data including one or more of volatile memory, nonvolatile memory, magnetic storage, flash storage, and the like.

[0048] The processing unit 258 may be any device capable of processing data including, for example, a microprocessor configured to carry out specific operations based on input data, or capable of executing instructions included in computer readable code including, for example code stored in the memory unit 256.

[0049] According to at least one example embodiment, the multiple language system 100 is implemented by the computing system 200. For example, operations described herein as being performed by the multiple language system 100 may be performed by the computing system 200. For example, the memory unit 256 may store executable instructions corresponding to each of the operations described herein as being performed by the multiple language system 100. Further, the processing unit 258 may be configured perform each of the operations described herein as being performed by the multiple language system 100, for example, by executing executable instructions stored in the memory unit 256.

[0050] Methods of handling multiple language representations of computer code will now be discussed in greater detail below with reference to FIGS. 3-9. First, a method of handling multiple language code blocks will be discussed. Next, a method of handling multiple language code switching will be discussed.

Method of Handling Multiple Language Code Blocks

[0051] FIG. 3 is a flow chart illustrating a method of handling multiple language code blocks according to at least one example embodiment. [0052] Referring to FIG. 3, in step S310, the multiple language system 100 receives computer code including a computer code block formed of at least a first high-level programming language and a second high-level programming language. The multiple language system 100 may receive the computer code, for example, in the form of source code entered into a code editor application being run on the computing system 200.

[0053] For example, FIG. 4 illustrates a screen shot of an editor 400 in which source code including two different high-level programming languages has been entered. The screen shot may represent, for example, images viewable by a user on the display unit 252 of the computing system. The editor 400 is a code editor application which is run by the computing system 200. In the example illustrated in FIG. 4, the source code entered into the editor 400 includes a code block 405. The code block 405 includes both a first sub-block 410 written in ST and a second sub- block 420 written in LD. The code block 405 may be accessed by the multiple language system 100 via the editor 400. According to at least one example embodiment, examples of entering the source code block 405 into the editor 400 include a user controlling the editor 400 to retrieve a previously stored source code file including the source code including code block 405, for example, by using the input unit 254 to access the storage unit 256. For example, a user may use a mouse and/or a keyboard to open a file including the code block 405. Additionally, examples of entering the source code block 405 into the editor 400 include a user using the input unit 254 to input the code block 405. For example, a user may use a mouse and/or a keyboard to input each expression of the code block 405 into the editor 400 line by line. [0054] In step S320, the multiple language system 100 translates the first high- level programming language code received in step S310 into a first section of code written in the IL 120 illustrated in FIG. 1. For example, the CFE, from among the first through third CFEs 1 12-1 16, which corresponds to the first high-level programming language is selected by the multiple language system 100 to translate the first high- level programming language code received in step S310 into the first section of code written in the IL 120. One example of a language which may be used as the IL 120 is an AST. One example of an AST which can be used as the IL 120 is the GEIL tree language which will be discussed in greater detail below with reference to FIGS. 5-8. Examples of the manner in which the multiple language system 100 translates high- level programming language code into the IL 120 will be discussed in greater detail below with reference to FIGS. 5-8. In the example discussed below with reference to FIGS. 5-8, the high level languages are ST and LD.

[0055] For example, FIG. 5 illustrates a first GEIL Tree language representation 510 corresponding to an ST code expression 520 and an LD code expression 530. According to at least one example embodiment, in order to translate the ST code expression 520 into the first GEIL Tree language representation 510, the third CFE 116 may parse the ST code expression 520, in accordance with known methods, to separate the ST code into constituent parts including, for example, operators '+' and ':=', variables 'a' and 'b', and the constant T. The third CFE 1 16 may then rearrange the constituent parts of the ST code expression 520 into the structure of the GEIL Tree language to generate the first GEIL Tree language representation 510.

[0056] Likewise, according to at least one example embodiment, in order to translate the LD code expression 530 into the first GEIL Tree language representation 510, the second CFE 1 14 may parse the LD code expression 530, in accordance with known methods, to separate the LD code into constituent parts including, for example, operators '+' and ' :=', variables 'a' and 'b', and the constant T. The second CFE 1 14 may then rearrange the constituent parts of the LD code expression 530 into the structure of the GEIL Tree language to generate the first GEIL Tree language representation 510.

[0057] FIG. 6 is a diagram illustrating a tree structure 600 corresponding to the first GEIL Tree language expression 510 of FIG. 5.

[0058] As another example, FIG. 7 illustrates a second GEIL Tree language representation 710 corresponding to an ST code expression 720 and an LD code expression 730. According to at least one example embodiment, in order to translate the ST code expression 720 into the second GEIL Tree language representation 710, the third CFE 1 16 may parse the ST code expression 720, in accordance with known methods, to separate the ST code into constituent parts including, for example, operators ':=' and 'AND', and variables 'a' and 'b'. The third CFE 1 16 may then rearrange the constituent parts of the ST code expression 520 into the structure of the GEIL Tree language to generate the second GEIL Tree language representation 710.

[0059] Likewise, according to at least one example embodiment, in order to translate the LD code expression 730 into the second GEIL Tree language representation 710, the second CFE 1 14 may parse the LD code expression 730, in accordance with known methods, to separate the LD code into constituent parts including, for example, operators ':=' and 'AND', and variables 'a' and 'b'. The second CFE 114 may then rearrange the constituent parts of the LD code expression 730 into the structure of the GEIL Tree language to generate the second GEIL Tree language representation 710. FIG. 8 is a diagram illustrating a tree structure 600 corresponding to the second GEIL Tree language expression 710 of FIG. 7. [0060] In step S330, the multiple language system 100 translates the second high- level programming language code received in step S310 into a second section of code written in the IL 120 illustrated in FIG. 1. For example, in the same manner described above with reference to FIGS. 5-8, the CFE which corresponds to the second high- level programming language, from among the first through third CFEs 1 12-116, is selected by the multiple language system 100 to translate the second high-level programming language code received in step S310 into the second section of code written in the IL 120.

[0061] In step S340, the multiple language system 100 translates the first and second sections of code written in the IL 120 (generated respectively in steps S320 and S330) into program code.

[0062] For example, according to at least one example embodiment, in step S340 the CBE 130 generates combined code by combining the first and second sections of the code written in the IL 120 from steps S320 and S330, and the CBE 130 translates the combined code into program code. As is discussed above, the program code generated by the CBE 130 may be any known type of assembly code or machine code. Further, according to at least one example embodiment, the CBE 130 may first translate the combined code into assembly code, and then use an assembler function included in the CBE 130 to translate the assembly code into machine code which is usable by a device for which the code block 405 was written, for example a PLC or other digital computer device,.

Method of Handling Multiple language Switching

[0063] FIG. 9 is a flow chart illustrating a method of handling multiple language switching according to at least one example embodiment. [0064] Referring to FIG. 9, in step S910, the multiple language system 100 receives computer code including a block of code written in a first high-level programming language. The multiple language system 100 may receive the computer code, for example, in the form of source code entered into a code editor application being run on the computing system 200.

[0065] In step S920, the multiple language system 100 receives a request to switch the first high-level programming language code to a target high-level language.

[0066] For example, a user of the code editor 400 illustrated in FIG 4 may determine that they wish to change a block of code written in LD into ST. Accordingly, the user may enter a command to switch the language of block of code being displayed by the editor 400 from its initial language (LD in the current example) into a target language (ST in the current example). For example, the user may enter the command by typing the command into a keyboard included in the computing system 200 or clicking an interactive button included in a graphical user interface (GUI) of the editor 400 using a mouse or a touchpad included in the computing system 200. The command may indicate which portion of a listing of source code being displayed by the editor 400 the user has selected for language switching. For example, the user could use a keyboard and/or mouse to highlight or select, within the editor 400, a portion of the source code written in LD which the user wishes to switch to ST. The command may also indicate the target language, which is the high-level programming language to which the user wishes the selected block of code be switched.

[0067] Consequently, according to at least one example embodiment, in step S920, the multiple language system 100 may receive the request to switch the language of selected code via user input provided through the editor 400 being run by the computing system 200. Further, as is discussed above, the request may indicate both the code which a user has selected for language switching, and the target language selected by the user, to which the selected code is to be switched.

[0068] Though the method illustrated in FIG. 9 is explained with reference to an example in which source code initially represented in LD is being switched to ST, according to example embodiments, the initial high-level programming language of the code selected for language switching in step S920 may be any high-level programming language, and the target language selected in step S920 may be any high-level programming language. For example, LD code may be switched to FBD code or ST code; FBD code may be switched to LD code or ST code; and ST code may be switched to FBD code or LD code.

[0069] In step S930, the multiple language system 100 translates the code selected for language switching into an intermediate language code. For example, the multiple language system 100 may translate the LD language code selected by the user for language switching in step S920 into the IL 120 illustrated in FIG. 1. As is discussed above with reference to FIGS 5-8, one example of the IL 120 is GEIL Tree code. Thus, according to at least one example embodiment, in step S930 the multiple language system 100 translates the LD language code selected for language switching by the user in step S920 into GEIL Tree code.

[0070] For example, according to at least one example embodiment, in the same manner discussed above with reference to FIGS. 5-8, in order to translate the LD code specified by the user in step S920 into GEIL Tree code, the second CFE 114 of the multiple language system 100, which is the CFE that corresponds to the LD language from among the first through third CFEs 112-1 16 of the multiple language system, may parse the specified LD code, in accordance with known methods, to separate the LD code into constituent parts including, for example, one or more of operators, variables, and the constants. The second CFE 1 14 may then rearrange the constituent parts of the LD code expression into the structure of the GEIL Tree language.

[0071] In step S940, the multiple language system 100 translates intermediate language code into the target high level programming language. For example, in step S940 the multiple language system 100 may translate the code selected by the user for language switching in step S920 into the target high-level programming language selected by the user in step S920. For example, the multiple language system 100 may select the decompiler, from among the first through third decompilers 152-156, which corresponds to the target high-level programming language selected by the user in step S920.

[0072] For example, because in step S920, the user selected, as the target high- level language, ST, according to at least one example embodiment, the multiple language system 100 uses the decompiler associated with the ST language, the third decompiler 156, and, in accordance with known decompiling methods, the third decompiler 156 translates the intermediate code into ST. For example, in step S940, the decompiler 156 may translate the GEIL Tree representation of the code selected for language switching by the user in step S920 into ST code.

[0073] After the intermediate language code is translated into the target language, the newly translated code may then be provided to the editor 400 to be displayed to the user. Thus, the user may view an ST language representation of code which was originally written in LD.

[0074] According to at least one technical feature of the present disclosure, a user may write code using multiple language blocks. Being allowed to program in the language that is best suited to the task in any block of code allows for ease of use for the developer. It will take less time to develop code and should lead to fewer errors in the code as well. By having access to the languages in which they are most experienced, code developers can build code with more speed and accuracy.

[0075] The editing and maintenance of multi-language code will also eliminate errors as users can more easily understand what they are reading and using the best language for each task will lead to more streamlined code with fewer lines to scroll through. For example, if a code developer is forced to use Structured Text to code a feedback loop, the number of lines in the editor would far exceed the space required by the better-suited FBD when coding the same loop.

[0076] The feature of multi-language blocks may also enhance collaborative efforts because developers who are experienced in different languages can come together to work on a single function using the languages that they prefer. Being limited to one language may exclude developers with valuable input if they are not fluent in the particular language being used.

[0077] According to at least one technical feature of the present disclosure, a user may automatically switch the language in which source code is being displayed. The multiple language switch feature allows users to view code in different language without requiring the user to manually translate the code themselves.

[0078] Being able to view code in different languages will give valuable exposure to other languages so users can consider improved methods. This exposure may lead to important development and investment choices (i.e. train users in ST rather than remaining proficient only in LD when the advantages of other languages are viewed). Being able to write logic in the best-suited language for the task and for a code developers experience may lead to fewer errors in the code, faster development and, more robust applications because you can use the language most desirable to a developer for a particular application. Further, end users can view code in the language they best understand which will lead to fewer errors and shorter downtimes for devices running the code.

[0079] While a number of example embodiments have been disclosed herein, it should be understood that other variations may be possible. Such variations are not to be regarded as a departure from the spirit and scope of the present disclosure, and all such modifications as would be obvious to one skilled in the art are intended to be included within the scope of the following claims.