Vol.15, No.4 ©2004 Journal of Software 软 件 学 报 1000-9825/2004/15(04)0475
代码翻译中 PERFORM 和 GOTO 语句复合结构的变换
∗
武成岗
1+
, 张兆庆
1
, 乔如良
1
, 冯晓兵
1
, 高 琳
1
, 石学林
1
, 蒋弘山
2
, 崔慧敏
2
1
(中国科学院 计算技术研究所,京 100080)
2
(清华大学 计算机科学与技术系,京 100084)
Converting the Compound Control Structure of PERFORM and GOTO
Statements in Code Translation
WU Cheng-Gang
1+
, ZHANG Zhao-Qing
1
, QIAO Ru-Liang
1
, FENG Xiao-Bing
1
, GAO Lin
1
, SHI Xue-Lin
1
,
JIANG Hong-Shan
2
, CUI Hui-Min
2
1
(Institute of Computing Technology, The Chinese Academy of Sciences, Beijing 100080, China)
2
(Department of Computer Science and Technology, Tsinghua University, Beijing 100084, China)
+ Corresponding author: Phn: +86-10-62562702, Fax: +86-10-62564342, E-mail: wucg@ict.ac.cn, http://www.ict.ac.cn
Received 2003-08-26; Accepted 2003-11-11
Wu CG, Zhang ZQ, Qiao RL, Feng XB, Gao L, Shi XL, Jiang HS, Cui HM. Converting the compound control
structure of PERFORM and GOTO statements in code translation. Journal of Software, 2004,15(4):475~486.
http://www.jos.org.cn/1000-9825/15/475.htm
Abstract: COBOL, a traditional language, has been presented for more than 50 years. There are at least 100
billion lines of legacy codes written in COBOL up to now. An effective way to maintain these legacy codes is to
translate them into modern languages, such as Java. While translating, it is a key-step to eliminate ‘GOTO’ and
‘PERFORM’ and their compound control structures in COBOL programs. A method which uses ‘switch’ and ‘while’
statements is proposed in this paper instead of ‘GOTO’ and ‘PERFORM’ and their compound control structures. It
preserves the readability because the target Java program has the similar control structures. The code size of the
target program expands only 2 times in average. This method is applied in the ‘C2J translation system’. It is proved
sound and effective since 4 million lines of real COBOL program have been translated and its target program has
passed the test.
Key words: legacy code; COBOL; JAVA; translation; PERFORM; GOTO; control-flow
摘 要: 传统语 COBOL 从诞生至今有近 50 年史,现存约有 1 000 行代是用 COBOL 编写的.维护
这些产代的个有效方法是将其翻成现代语,如 Java.其中将 COBOL 语中 GOTO 和 PERFORM 语
∗ Supported by the National Natural Science Foundation of China under Grant No.60103006 (国家自然科学基金)
作者简介: 武成岗(1969-),男, 河南郑州人, 博士, 主要研究领域为高级编译技术, 二进翻译; 张兆庆(1938-),女,研究, 博士
生导师,主要研究领域为高级编译技术;乔如良(1937-),男,教授,主要研究领域为高级编译技术;冯晓兵(1969-),男,研究,主要研
究领域为高级编译技术;高琳(1977-),女,博士生,主要研究领域为高级编译技术;石学林(1977-),男,博士生,主要研究领域为高级编
译技术; 蒋弘山(1974-), 男, 博士生, 主要研究领域为高级编译技术生物信息; 崔慧敏(1979-), 女, 硕士, 主要研究领域为高级编译
技术.