comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Pascal to Ada translator/ aflex,ayacc GNAT ports
Date: 1996/11/30
Date: 1996-11-30T00:00:00+00:00	[thread overview]
Message-ID: <dewar.849367775@merv> (raw)
In-Reply-To: 01bbde93$a09ea190$0d208b82@wd


Wiljan says

"I think that when one has:
    type rec=record a,b:integer end;
    var x:rec;
    ....
    with x do a:=3;
is best translated to
    x.a:=3;
With a rename it whould look like:
    x1:rec renames x;
    x1.a:=3;
Note that when translating to an Ada renaming one must add extra names
which also does not attribute to clear code."


Yes that is certainly reasonable. Of course a translator that is this clever
in terms of making aesthetic judgments about best translations is an
unlikely beast. Sure, this one case could be handled, but to be this 
accurate in producing "best translations" throughout -- that's hard.

Note that in this case, the renames translation is indeed clunky, but
then the original Pascal is also clunky, I certainly never saw any
Pascal where someone would use a with for a single statement.

Obviously the appropriate Pascal in this case is:

   x.a := 3;

Just how much effort do you expect an automatic translator to spend in
taking junk badly written Pascal and turning it into nice Ada?





  reply	other threads:[~1996-11-30  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       ` wiljan
1996-11-29  0:00         ` Robert Dewar
1996-11-30  0:00           ` wiljan
1996-11-30  0:00             ` Robert Dewar [this message]
1996-12-01  0:00               ` wiljan
1996-12-01  0:00                 ` Robert Dewar
1996-12-01  0:00                 ` Michael Feldman
1996-12-02  0:00           ` Laurent Gasser
1996-12-02  0:00             ` Jacques Rouillard
1996-12-02  0:00             ` Larry Kilgallen
1996-11-29  0:00       ` Larry Kilgallen
replies disabled

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