isomorphic languages

Richard A. O'Keefe ok at quintus.uucp
Mon Oct 31 13:36:38 AEST 1988


In article <75328 at sun.uucp> khb at sun.UUCP (Keith Bierman - Sun Tactical Engineering) writes:
>In article <75326 at sun.uucp> dgh%dgh at Sun.COM (David Hough) writes:
>>Thesis:  Language designers (including X3Jn committees) needn't
>>incorporate every bad syntax of the past if revised versions are
>>syntactically isomorphic.

>Also if the original program was readable (well indented, and
>commented, etc.) the converted (or doubly converted) should still be.

In _one_ respect, such a conversion is easier for Fortran, because
Fortran 77 only permits comments _between_ statements.  Bierman asks
for the translation to be invertible if the F8x version doesn't use
anything not in F77, a backwards translator wouldn't have to get
within-statement comments exactly right.

This problem is familiar to people who've tried to translate between
Lisp (or Prolog) dialects.  For a C illustration of the problem, suppose
that the replacement for
	for (<init>; <test>; <step>) <stmt>
were
	for <init> doing <step> while <test> do <stmt> repeat
and consider input like
	for (p = &(this->link[i]);	/* Note that in this loop over */
	     *p != NULL;		/* the ith bucket, p is a POINTER */
	     p => &(p->next)		/* to a pointer to an entry, NOT */
	    ) {				/* a pointer to an entry. */
	    ....
	}
The reordering of the constituents in the revised language is going to
do terrible things to the text of the comment...

This is not a problem with programs which conform to the F77 standard,
as it provides no way of writing such comments.  But some _processors_
which conform to the F77 standard provide in-line comments as an
extension.  (Perhaps the majority of such processors?)  Don't expect
it to be easy to preserve good indentation and commenting.
[If anyone knows how to do it, please tell me at once!]



More information about the Comp.lang.c mailing list