comp.lang.ada
 help / color / mirror / Atom feed
* Delphi & Ada; Ada to C++
  1998-02-18  0:00     ` Jean D. Ichbiah
@ 1998-02-19  0:00       ` Nick Roberts
  1998-02-19  0:00         ` David  Weller
  0 siblings, 1 reply; 14+ messages in thread
From: Nick Roberts @ 1998-02-19  0:00 UTC (permalink / raw)



Jean:

   procedure Just_Like_Ada_Really (A, B: {in} Integer; var Result: {out}
String) ;{is}
   begin
      ...
   end {Just_Like_Ada_Really};

I have been where you now tread!

On the subject of translation from one high level language to another
(significantly different one).  I think the consensus of opinion is that,
if you need the result to be readable (by humans), manual translation is
likely to be the only workable option.

Machine translation is certainly possible.  Since GNAT produces C code (and
C++ is pretty well a superset of C), this suggests a possibility (doubtless
not entirely wrinkle-free).  Also, automated translation, or partial
translation, could well be a good way to get a 'jump start' for a manual
translation (and it may even be practical for you to program this yourself,
since you need only be rough).

== Nick Roberts ================================================
== Croydon, UK                       ===========================
==                                              ================
== Proprietor, ThoughtWing Software                   ==========
== Independent Software Development Consultant            ======
== Nick.Roberts@dial.pipex.com                              ====
== Voicemail & Fax +44 181-405 1124                          ===
==                                                            ==
==           I live not in myself, but I become               ==
===          Portion of that around me; and to me             ==
====         High mountains are a feeling, but the hum        ==
=======      Of human cities torture.
===========                             -- Byron [Childe Harold]

Jean D. Ichbiah <ichbiah@twsolutions.com> wrote in article
<34eb5d36.20077308@news.tiac.net>...
> [...] I am doing most of my development using 
> Delphi.  (More precisely, I program in Ada and use the Delphi compiler
> to compile them.  :)





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Delphi & Ada; Ada to C++
  1998-02-19  0:00       ` Delphi & Ada; Ada to C++ Nick Roberts
@ 1998-02-19  0:00         ` David  Weller
  1998-02-19  0:00           ` Nick Roberts
  1998-02-21  0:00           ` Simon Wright
  0 siblings, 2 replies; 14+ messages in thread
From: David  Weller @ 1998-02-19  0:00 UTC (permalink / raw)



In article <01bd3cc5$a74ff160$LocalHost@xhv46.dial.pipex.com>,
Nick Roberts <Nick.Roberts@dial.pipex.com> wrote:
>Machine translation is certainly possible.  Since GNAT produces C code (and
>C++ is pretty well a superset of C), this suggests a possibility (doubtless


NO NO NO NO!!!

Repeat after me:  GNAT does NOT produce C code.  GNAT does NOT produce
C code.  GNAT does NOT produce C code.  GNAT does NOT produce C code.
GNAT does NOT produce C code.  GNAT does NOT produce C code.  GNAT
does NOT produce C code.  GNAT does NOT produce C code.  GNAT does NOT
produce C code.  GNAT does NOT produce C code.  GNAT does NOT produce
C code.  GNAT does NOT produce C code.  GNAT does NOT produce C code.

There.  Feel better now? :-)

-- 
	What is DIVX?  Find out at http://www.riva.com/dvd_divx.html
Tired of "junk" e-mail?  Write to your congressman and tell them you support
H.R. 1748, "The Netizens Protection Act of 1997".  Make those SPAM-roaches run!             http://www.cauce.org          TAKE BACK THE INTERNET!




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Delphi & Ada; Ada to C++
  1998-02-19  0:00         ` David  Weller
@ 1998-02-19  0:00           ` Nick Roberts
  1998-02-19  0:00             ` Jon S Anthony
  1998-02-21  0:00           ` Simon Wright
  1 sibling, 1 reply; 14+ messages in thread
From: Nick Roberts @ 1998-02-19  0:00 UTC (permalink / raw)



Sorry! I got the impression that was how GNAT worked (translate Ada to C,
and then compile to executable).  Looking at the documentation for GNAT
3.10 (R1.30), I see no mention of intermediate C.  Is this how GNAT worked
once upon a time, or did I simply get totally the wrong end of the stick? 
What is GNAT's relationship to GCC?


== Nick Roberts ================================================
== Croydon, UK                       ===========================
==                                              ================
== Proprietor, ThoughtWing Software                   ==========
== Independent Software Development Consultant            ======
== Nick.Roberts@dial.pipex.com                              ====
== Voicemail & Fax +44 181-405 1124                          ===
==                                                            ==
==           I live not in myself, but I become               ==
===          Portion of that around me; and to me             ==
====         High mountains are a feeling, but the hum        ==
=======      Of human cities torture.
===========                             -- Byron [Childe Harold]


David  Weller <dweller@universe.digex.net> wrote in article
<6chg3h$4qf@universe.digex.net>...
> In article <01bd3cc5$a74ff160$LocalHost@xhv46.dial.pipex.com>,
> Nick Roberts <Nick.Roberts@dial.pipex.com> wrote:
> >Machine translation is certainly possible.  Since GNAT produces C code
(and
> >C++ is pretty well a superset of C), this suggests a possibility
(doubtless
> 
> 
> NO NO NO NO!!!
> 
> Repeat after me:  GNAT does NOT produce C code.  GNAT does NOT produce
> C code.  GNAT does NOT produce C code.  GNAT does NOT produce C code.
> GNAT does NOT produce C code.  GNAT does NOT produce C code.  GNAT
> does NOT produce C code.  GNAT does NOT produce C code.  GNAT does NOT
> produce C code.  GNAT does NOT produce C code.  GNAT does NOT produce
> C code.  GNAT does NOT produce C code.  GNAT does NOT produce C code.
> 
> There.  Feel better now? :-)
> 
> -- 
> 	What is DIVX?  Find out at http://www.riva.com/dvd_divx.html
> Tired of "junk" e-mail?  Write to your congressman and tell them you
support
> H.R. 1748, "The Netizens Protection Act of 1997".  Make those
SPAM-roaches run!             http://www.cauce.org          TAKE BACK THE
INTERNET!
> 




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Delphi & Ada; Ada to C++
  1998-02-19  0:00           ` Nick Roberts
@ 1998-02-19  0:00             ` Jon S Anthony
  1998-02-20  0:00               ` Nick Roberts
  0 siblings, 1 reply; 14+ messages in thread
From: Jon S Anthony @ 1998-02-19  0:00 UTC (permalink / raw)




"Nick Roberts" <Nick.Roberts@dial.pipex.com> writes:

> Sorry! I got the impression that was how GNAT worked (translate Ada to C,
> and then compile to executable).  Looking at the documentation for GNAT
> 3.10 (R1.30), I see no mention of intermediate C.  Is this how GNAT worked
> once upon a time, or did I simply get totally the wrong end of the stick? 

You got it totally wrong.

> What is GNAT's relationship to GCC?

GNAT uses the gcc backend (just like g77, g++, and the good ol' c
compiler among others...) by producing an intermediate tree that it
eats.  The output is machine code for the given platform.

/Jon

-- 
Jon Anthony
Synquiry Technologies, Ltd., Belmont, MA 02178, 617.484.3383
"Nightmares - Ha!  The way my life's been going lately,
 Who'd notice?"  -- Londo Mollari




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Delphi & Ada; Ada to C++
  1998-02-19  0:00             ` Jon S Anthony
@ 1998-02-20  0:00               ` Nick Roberts
  1998-02-21  0:00                 ` Richard Kenner
  0 siblings, 1 reply; 14+ messages in thread
From: Nick Roberts @ 1998-02-20  0:00 UTC (permalink / raw)



Many thanks.  I think I read somewhere that "GNAT uses the FSF's[?]
renowned gcc technology", or something like that, and I had simply assumed
the rest.  Funny how the old brain fills in the cracks (wrongly in this
case :-) innit?

Now to throw the cat among the pigeons: how difficult would it be to
retro-compile the tree into C (or even C++)?

While we're on the subject: is or was gcc a product of the FSF?  Was it
(originally) written by Richard Stallman?  I'm beginning to distrust my
memory now!


== Nick Roberts ================================================
== Croydon, UK                       ===========================


Jon S Anthony <jsa@synquiry.com> wrote in article
<ufvhubywi3.fsf@synquiry.com>...
[...]
> GNAT uses the gcc backend (just like g77, g++, and the good ol' c
> compiler among others...) by producing an intermediate tree that it
> eats.  The output is machine code for the given platform.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Delphi & Ada; Ada to C++
  1998-02-19  0:00         ` David  Weller
  1998-02-19  0:00           ` Nick Roberts
@ 1998-02-21  0:00           ` Simon Wright
  1998-02-21  0:00             ` Richard Kenner
  1 sibling, 1 reply; 14+ messages in thread
From: Simon Wright @ 1998-02-21  0:00 UTC (permalink / raw)



dweller@universe.digex.net (David  Weller) writes:

> In article <01bd3cc5$a74ff160$LocalHost@xhv46.dial.pipex.com>,
> Nick Roberts <Nick.Roberts@dial.pipex.com> wrote:
> >Machine translation is certainly possible.  Since GNAT produces C code (and
> >C++ is pretty well a superset of C), this suggests a possibility (doubtless
> 
> 
> NO NO NO NO!!!

And even if it did, it's unlikely that you would be able to make a lot
of sense of it. Names would be mangled, strange and wonderful
constructs would appear, ... (just think about exceptions, generics,
...) you would not want to maintain the result!




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Delphi & Ada; Ada to C++
  1998-02-20  0:00               ` Nick Roberts
@ 1998-02-21  0:00                 ` Richard Kenner
  1998-02-21  0:00                   ` Robert Dewar
  0 siblings, 1 reply; 14+ messages in thread
From: Richard Kenner @ 1998-02-21  0:00 UTC (permalink / raw)



In article <01bd3e24$280e1c00$a8fc82c1@xhv46.dial.pipex.com> "Nick Roberts" <Nick.Roberts@dial.pipex.com> writes:
>Now to throw the cat among the pigeons: how difficult would it be to
>retro-compile the tree into C (or even C++)?

Extremely difficult.  First of all, the interface isn't totally a
tree, but is mostly procedural, using trees just for expressions and
objects.  So you'd have to catch all of the procedure calls as well.
But many of the trees (for example those involving variant records)
have no C equivalent anyway.

>While we're on the subject: is or was gcc a product of the FSF? 

Yes.

>Was it (originally) written by Richard Stallman?  

Yes, and he maintained it until sometime in the early 90's at which point
I took over maintenance of GCC.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Delphi & Ada; Ada to C++
  1998-02-21  0:00           ` Simon Wright
@ 1998-02-21  0:00             ` Richard Kenner
  1998-03-05  0:00               ` Robert I. Eachus
  0 siblings, 1 reply; 14+ messages in thread
From: Richard Kenner @ 1998-02-21  0:00 UTC (permalink / raw)



In article <x7v1zwxtkvz.fsf@pogner.demon.co.uk> Simon Wright <simon@pogner.demon.co.uk> writes:
>And even if it did, it's unlikely that you would be able to make a lot
>of sense of it. Names would be mangled, strange and wonderful
>constructs would appear, ... (just think about exceptions, generics,
>...) you would not want to maintain the result!

Actually, generics can be translated in a relatively straightforward
manner since it's just macro substitution.  Exceptions are trickier,
but still can be done reasonable well.  The real hard cases are
variant records and unconstrained arrays.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Delphi & Ada; Ada to C++
  1998-02-21  0:00                 ` Richard Kenner
@ 1998-02-21  0:00                   ` Robert Dewar
  0 siblings, 0 replies; 14+ messages in thread
From: Robert Dewar @ 1998-02-21  0:00 UTC (permalink / raw)



In article <01bd3e24$280e1c00$a8fc82c1@xhv46.dial.pipex.com> "Nick Roberts" <Ni
k.Roberts@dial.pipex.com> writes:
>Now to throw the cat among the pigeons: how difficult would it be to
>retro-compile the tree into C (or even C++)?


(tree here = GNAT tree)

It would conceivably be possible to compile it into VERY low level C, where
you had a few variables corresponding to registers, say called r0, r1, r2
and you generated C that for example, in unoptimized mode, might
compile

   A := B + C;

where A,B,C are all local variables, into something like

   r0 = *(fp+100);
   r1 = *(fp+104);
   r2 = r0 + r1;
   *(fp+108) = r2;

This is *really* using C as a low level assembler :-)

The way you could do this is to write a config file for gcc that treated
C in this way as a kind of pseudo-machine. We once thought about this as
a way to make a version of GNAT that could be ported in native mode, rather
than requiring cross-compilers, but it was never more than a passing
interesting idea.

You could try to reverse compile the tree at a much higher level into
C, but this would be a huge task, comparable to that of writing a
compiler, and in some ways much more difficult (it would be like trying
to do a complete house renovation, rather than building a new house --
as those who have gone through it know, the renovation can often be the
harder task).

Furthermore, some of the constructs would still generate rubbish, since
C just does not have the required semantic richness.
(e.g. what do you do with overflow checking, and what do you do with
 nested procedures ....)





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Delphi & Ada; Ada to C++
@ 1998-02-23  0:00 Marin David Condic, 561.796.8997, M/S 731-96
  1998-02-24  0:00 ` Robert Dewar
  1998-02-24  0:00 ` Dale Stanbrough
  0 siblings, 2 replies; 14+ messages in thread
From: Marin David Condic, 561.796.8997, M/S 731-96 @ 1998-02-23  0:00 UTC (permalink / raw)



David Weller <dweller@UNIVERSE.DIGEX.NET> writes:
>NO NO NO NO!!!
>
>Repeat after me:  GNAT does NOT produce C code.  GNAT does NOT produce
>C code.  GNAT does NOT produce C code.  GNAT does NOT produce C code.
>GNAT does NOT produce C code.  GNAT does NOT produce C code.  GNAT
>does NOT produce C code.  GNAT does NOT produce C code.  GNAT does NOT
>produce C code.  GNAT does NOT produce C code.  GNAT does NOT produce
>C code.  GNAT does NOT produce C code.  GNAT does NOT produce C code.
>
>There.  Feel better now? :-)
>
    Where did this particular piece of Urban Lore get started? I seem
    to recall many years ago that somebody had an Ada83 compiler that
    generated C as "high level assembler" - Irvine seems to suggest
    itself, but I wouldn't swear to it.

    It seems lots of folks "know" this piece of lore and it must have
    had some basis in fact or legend which has served to keep it
    going.

    MDC

Marin David Condic, Senior Computer Engineer     Voice:     561.796.8997
Pratt & Whitney GESP, M/S 731-95, P.O.B. 109600  Fax:       561.796.4669
West Palm Beach, FL, 33410-9600                  Internet:  CONDICMA@PWFL.COM
=============================================================================
    "Because that's where they keep the money."
        --  Willie Sutton when asked why he robbed banks.
=============================================================================




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Delphi & Ada; Ada to C++
  1998-02-23  0:00 Delphi & Ada; Ada to C++ Marin David Condic, 561.796.8997, M/S 731-96
@ 1998-02-24  0:00 ` Robert Dewar
  1998-02-25  0:00   ` Jean-Pierre Rosen
  1998-02-24  0:00 ` Dale Stanbrough
  1 sibling, 1 reply; 14+ messages in thread
From: Robert Dewar @ 1998-02-24  0:00 UTC (permalink / raw)



Marin said

<<    Where did this particular piece of Urban Lore get started? I seem
    to recall many years ago that somebody had an Ada83 compiler that
    generated C as "high level assembler" - Irvine seems to suggest
    itself, but I wouldn't swear to it.

    It seems lots of folks "know" this piece of lore and it must have
    had some basis in fact or legend which has served to keep it
    going.

    MDC
>>

The lore in question is the completely wrong assumptionj that GNAT generates
C. In fact I think this comes from three things:

1. The fact that GCC stands for GNU C compiler, and people know GNAT somehow
	uses GCC. These days, GCC is much more than a C compiler, but the
	confusion persists.

2. The fact that the T in GNAT used to stand for translator, that was our
	mistake. We have retained the name, but now take the position that
	GNAT is not an acronym and stands for nothing.

3. The fact that GNAT has in the past always generated its main program
	from the binder in C, and you see this C code if you do a list
	from GDB before doing anything else. The current version of GNAT
	can also generate the main program in Ada, and we will make this
	the default at some point.

Still, the legend is indeed completely wrong. In no sense does GNAT
translate your Ada code into C code.

Robert Dewar
Ada COre Technologies





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Delphi & Ada; Ada to C++
  1998-02-23  0:00 Delphi & Ada; Ada to C++ Marin David Condic, 561.796.8997, M/S 731-96
  1998-02-24  0:00 ` Robert Dewar
@ 1998-02-24  0:00 ` Dale Stanbrough
  1 sibling, 0 replies; 14+ messages in thread
From: Dale Stanbrough @ 1998-02-24  0:00 UTC (permalink / raw)



Marin David Condic writes:
"    Where did this particular piece of Urban Lore get started? I seem
     to recall many years ago that somebody had an Ada83 compiler that
     generated C as "high level assembler" - Irvine seems to suggest
     itself, but I wouldn't swear to it.

     It seems lots of folks "know" this piece of lore and it must have
     had some basis in fact or legend which has served to keep it
     going."


I've seen many students make this mistake, and it seems to stem from...

	gcc is a compiler that compiles C programs.
	i use gcc to compile Ada programs
	ergo the compile translates Ada to C, and then compiles it.


Another reason for this confusion was the original name of Gnat - the
GNu Ada Translator (an acronym which Robert Dewar has since disowned)
- people are used to using the word Translator and compiler to mean
very different things.


Dale




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Delphi & Ada; Ada to C++
  1998-02-24  0:00 ` Robert Dewar
@ 1998-02-25  0:00   ` Jean-Pierre Rosen
  0 siblings, 0 replies; 14+ messages in thread
From: Jean-Pierre Rosen @ 1998-02-25  0:00 UTC (permalink / raw)



Robert Dewar a �crit dans le message ...
>2. The fact that the T in GNAT used to stand for translator, that was our
> mistake. We have retained the name, but now take the position that
> GNAT is not an acronym and stands for nothing.
>

It could stand for "GNu Ada Toolset"...
--
----------------------------------------------------------------------------
                  J-P. Rosen (Rosen.Adalog@wanadoo.fr)
      Visit Adalog's web site at http://perso.wanadoo.fr/adalog






^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Delphi & Ada; Ada to C++
  1998-02-21  0:00             ` Richard Kenner
@ 1998-03-05  0:00               ` Robert I. Eachus
  0 siblings, 0 replies; 14+ messages in thread
From: Robert I. Eachus @ 1998-03-05  0:00 UTC (permalink / raw)



In article <6cms2p$7pv$1@news.nyu.edu> kenner@lab.ultra.nyu.edu (Richard Kenner) writes:

 > Actually, generics can be translated in a relatively straightforward
 > manner since it's just macro substitution.  Exceptions are trickier,
 > but still can be done reasonable well.  The real hard cases are
 > variant records and unconstrained arrays.

   Most Ada generics are translatable as macro substitution, but the
devil is in the details. There are many instances where thunks or some
other mechanism is required to deal with freezing at the point (during
execution) of instantiation.  In most cases, all that changes at
run-time are ranges or array bounds, but it is also possible for the
binding of names to subprograms to change...

--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~1998-03-05  0:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-23  0:00 Delphi & Ada; Ada to C++ Marin David Condic, 561.796.8997, M/S 731-96
1998-02-24  0:00 ` Robert Dewar
1998-02-25  0:00   ` Jean-Pierre Rosen
1998-02-24  0:00 ` Dale Stanbrough
  -- strict thread matches above, loose matches on Subject: below --
1998-02-13  0:00 Ada to C++ Translators David Kusuda
1998-02-14  0:00 ` Larry Kilgallen
1998-02-16  0:00   ` David  Weller
1998-02-18  0:00     ` Jean D. Ichbiah
1998-02-19  0:00       ` Delphi & Ada; Ada to C++ Nick Roberts
1998-02-19  0:00         ` David  Weller
1998-02-19  0:00           ` Nick Roberts
1998-02-19  0:00             ` Jon S Anthony
1998-02-20  0:00               ` Nick Roberts
1998-02-21  0:00                 ` Richard Kenner
1998-02-21  0:00                   ` Robert Dewar
1998-02-21  0:00           ` Simon Wright
1998-02-21  0:00             ` Richard Kenner
1998-03-05  0:00               ` Robert I. Eachus

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