Translating Algol to C or Cobol

deh0654@sjfc.UUCP (Dennis E. Hamilton)
16 May 89 23:03:24 GMT

          From comp.compilers

Related articles
Translating Algol to C or Cobol deh0654@sjfc.UUCP (1989-05-16)
Re: Translating Algol to C or Cobol kgg@lfcs.ed.ac.uk (1989-06-15)
Re: Translating Algol to C or Cobol juliar@hpcll17.HP.COM (1989-06-06)
| List of all articles for this month |
Date: Tue, 16 May 89 20:03:24 EDT
Summary: ALGOL is not translatable to C in maintainable form
Keywords: ALGOL, C, translation
Date: 16 May 89 23:03:24 GMT
References: <3893@ima.ima.isc.com>
From: deh0654@sjfc.UUCP (Dennis E. Hamilton)
Organization: Saint John Fisher College, Rochester, NY

In article <3893@ima.ima.isc.com> Gordon Jenkins <gordon@pyr.gatech.edu> 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}
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.