Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!husc6!spdcc!ima!compilers-sender From: deh0654@sjfc.UUCP (Dennis E. Hamilton) Newsgroups: comp.compilers Subject: Translating Algol to C or Cobol Summary: ALGOL is not translatable to C in maintainable form Keywords: ALGOL, C, translation Message-ID: <539@sjfc.UUCP> Date: 17 May 89 00:03:24 GMT References: <3893@ima.ima.isc.com> Sender: compilers-sender@ima.ima.isc.com Reply-To: deh0654@sjfc.UUCP (Dennis E. Hamilton) Organization: Saint John Fisher College, Rochester, NY Lines: 35 Approved: compilers@ima.UUCP In article <3893@ima.ima.isc.com> Gordon Jenkins writes: >I'm looking for any information available on sources for tools to >aid in the conversion of ALGOL sources to C (or heaven forbid, COBOL). As the moderator commented, this would be quite a challenge. Although many ALGOL notions might be simulated in C, there is a fundamental problem. The authors of C Language eliminated the need for "closures" in any form, and even ridicule the idea (commenting on why there are not local procedures because what would it mean to put a procedure on the stack, as I recall). Unfortunately, the nesting of procedures in ALGOL is a very real requirement, as is the passing of closures as parameters (call by "name"). The absence of any reasonable way to realize equivalents of thunks (specialized closures) is a serious technical limitation. In practice, the actual programs might be translatable by virtue of not exercising full ALGOL capabilities, but that is a tough bet to make. The translation to COBOL is even more limited, of course, since COBOL has no concept of local data at all, and the only form of dynamic data binding COBOL supports is the limited case of parameter passing. You might as well translate to FORTRAN. COBOL doesn't support pointers, so it provides little comfort as a way to fake ALGOL notions in the disguise of other constructs that are available. In no case would I expect a translation of ALGOL to COBOL to be intelligible to a human programmer, and the odds are that C translations would not be maintainable by human beings either. (Ask someone who has had to troubleshoot C++ by debugging the generated C code what that was like. ALGOL translations should be at least as hairy, though for different reasons. [PS: C++ really suffers from the inability to introduce closures, too.]) -- Dennis E. Hamilton {uucp: ... !rochester!cci632!sjfc!deh0654} -- Send compilers articles to compilers@ima.isc.com or, perhaps, Levine@YALE.EDU Plausible paths are { decvax | harvard | yale | bbn}!ima Please send responses to the originator of the message -- I cannot forward mail accidentally sent back to compilers. Meta-mail to ima!compilers-request