Today, as the computer programming languages, for example High Level Language (HLL), continue to grow rapidly, programmers often need to translate a computer program written in one HLL to another HLL. This translation may be necessary because of: lack of skilled programmers in the another HLL; when a user is not accustomed with concepts of the HLL in which the computer program is available; business decisions to switch underlying platforms; the desire of the programmers or the users to convert the computer program to another language; or in a scenario, where the computer may not be able to execute and support the available computer program, due to specific hardware or software requirements. Thus, in such scenarios the computer program in one HLL can be translated to another HLL.
The translation can be done manually by the programmers, but the manual translation is a laborious, time consuming, and an expensive process which is also prone to errors. To address this problem, automatic translators have been developed to translate programs written in one HLL (source program) to another HLL (target program).
Generally, for translating the source program to the target program using automatic translators, the source program is first given as an input to a parser. The parser checks for errors in the source program and further builds a data structure of the source program. Examples of errors include, but are not limited to, parsing errors, syntax errors, and compilation errors.
The parser during the parsing process throws a parsing exception and halts the parsing process, if any parser errors are identified while parsing a statement in the source program. The parsed source program is then given as input to the automatic machine translator (hereinafter referred as translator). The translator translates the parsed source program to the target program. The translator can throw a translation exception and interrupt the translation process if any translation errors are identified during translation. Hence in the above translation method, the parsing process and the translation process is interrupted and halted when a parser error or a translation error occurs.
Moreover, as the translation is a machine translation it is also prone to errors. To identify such errors, the target program can be analyzed manually or automatically after the translation process. The errors in the target program can be easily identified while analyzing, however it is difficult for the user to identify the actual origin/source of the errors. Hence, if the error has occurred due to the error present in the source program then in such a scenario, the user have to identify the errors in the source program by manually analyzing the source program and the target program simultaneously. Thus, manually analyzing the source code and the target code is a time consuming and tedious job for the user.
Hence there exists a need to efficiently manage the transformation of computer programs.