This disclosure describes code conversion techniques for replacement of Goto statements in program code in a source language with equivalent constructs in a target language. Different types of equivalent code constructs are utilized to replace Goto statements in the source language, depending on the use of the Goto statement in the original code that is to be converted. Another option is to introduce a method-like syntax in the language. Backward jumps and forward jumps are handled by the addition of new do-while loops that start from or end at a label associated with the Goto statement. In some cases, code blocks are divided into closure methods such that every loop that includes a nested label is converted into a recursive method. On Error Goto statements are converted by utilizing try-catch blocks.
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.
BA, Paneendra; McReynolds, Paul; Garg, Abhay; De, Arijit; and Ginet, Alex, "Replacement of Goto Statements During Code Migration", Technical Disclosure Commons, (November 12, 2020)