comp.lang.ada
 help / color / mirror / Atom feed
From: kilgallen@eisner.decus.org (Larry Kilgallen)
Subject: Re: Pascal to Ada translator/ aflex,ayacc GNAT ports
Date: 1996/11/29
Date: 1996-11-29T00:00:00+00:00	[thread overview]
Message-ID: <1996Nov29.132928.1@eisner> (raw)
In-Reply-To: dewar.849267826@merv


In article <dewar.849267826@merv>, dewar@merv.cs.nyu.edu (Robert Dewar) writes:
> In discussing Pascal to Ada translation:
> 
> .. maps to ...
> 
> declare
>   w_0 : aRecordType renames complex.expression[ witharrayindex ];
> begin
>   w_0.field1 := value;
> end;
> 
> Yes, this is the obvious appropraite translation in this case, however, I
> would say that the general goal of making the translated code look as much
> like the original Pascal as possible is quite wrong, and illustrates what
> is wrong with these translators. If you want Pascal-in-Ada what's the point,
> you might as well write in Pascal. The only point in translating from Pascal
> to Ada is to take advantage of the greater expressive power (e.g. generics)
> available in Ada.

Although people should always have warnings about using Language A 
as a vehicle for writing in the style of Language B, making an
informed decision in light of that warning should be sufficient.

It could be, for instance, that this is an excellent time to switch to
Ada (political climate, etc.) but a lousy time to rewrite large chunks
of code.  A mechanical translator is not going to write "good Ada",
so the priorities should be:

	1) Having it write code no less correct than the Pascal

	2) Having it write code which humans can change to be "good Ada"

I think the second purpose is well served by something which follows
the style of the Pascal, presuming those who will make subsequent
changes are accustomed to maintaining the Pascal version and thus
will feel "at home".

To keep people from following on and using Ada to write Pascal, the
translator could insert elements such as:

	-- The following emulation of a Pascal WITH statement
	-- was produced by a mechanical translator as a temporary
	-- expedient until a more robust approach can be implemented
	-- by  our skilled programming staff.

with the exact text to be generated controlled by the project manager
in accordance with local sensibilities.

Larry Kilgallen




  reply	other threads:[~1996-11-29  0:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-11-27  0:00 Pascal to Ada translator/ aflex,ayacc GNAT ports Martin C. Carlisle
1996-11-27  0:00 ` Michael Feldman
1996-11-28  0:00   ` steved
1996-11-29  0:00     ` Robert Dewar
1996-11-29  0:00       ` Larry Kilgallen [this message]
1996-11-29  0:00       ` wiljan
1996-11-29  0:00         ` Robert Dewar
1996-11-30  0:00           ` wiljan
1996-11-30  0:00             ` Robert Dewar
1996-12-01  0:00               ` wiljan
1996-12-01  0:00                 ` Michael Feldman
1996-12-01  0:00                 ` Robert Dewar
1996-12-02  0:00           ` Laurent Gasser
1996-12-02  0:00             ` Larry Kilgallen
1996-12-02  0:00             ` Jacques Rouillard
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox