comp.lang.ada
 help / color / mirror / Atom feed
* Is it possible to translate ada program to C using GCC or other tools?
@ 2008-07-22 20:48 climber.cui
  2008-07-23  0:15 ` Jeffrey R. Carter
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: climber.cui @ 2008-07-22 20:48 UTC (permalink / raw)


Hi all,
  I would like to investigate on how ada's protected object  and
tasking features are implemented with C/pthread. Is it possible to use
gcc(or other tools) to do the translation?

  thanks.

tony



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

* Re: Is it possible to translate ada program to C using GCC or other tools?
  2008-07-22 20:48 Is it possible to translate ada program to C using GCC or other tools? climber.cui
@ 2008-07-23  0:15 ` Jeffrey R. Carter
  2008-07-23  0:59   ` climber.cui
  2008-07-23  0:45 ` Is it possible to translate ada program to C using GCC or other anon
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Jeffrey R. Carter @ 2008-07-23  0:15 UTC (permalink / raw)


climber.cui@gmail.com wrote:
> 
>   I would like to investigate on how ada's protected object  and
> tasking features are implemented with C/pthread. Is it possible to use
> gcc(or other tools) to do the translation?

What makes you think these features are implemented in C?

gcc will not translate Ada to C.

SofCheck has a compiler that uses ANSI C as its intermediate language, but I 
suspect what you're interested in is part of their runtime code, not the code 
produced by the compiler.

-- 
Jeff Carter
"It's symbolic of his struggle against reality."
Monty Python's Life of Brian
78



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

* Re: Is it possible to translate ada program to C using GCC or other
  2008-07-22 20:48 Is it possible to translate ada program to C using GCC or other tools? climber.cui
  2008-07-23  0:15 ` Jeffrey R. Carter
@ 2008-07-23  0:45 ` anon
  2008-07-23  1:05   ` climber.cui
  2008-07-23  1:44 ` Is it possible to translate ada program to C using GCC or other tools? Robert A Duff
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: anon @ 2008-07-23  0:45 UTC (permalink / raw)


No!

In GNAT the compiler generates assembly code. With one exception that is
"GNATBIND" program. Using the "-C" option, GNATBIND with produce its 
binder program in C. But that does very little for what most people want. 

A thesis, back in 1991 by Jeffrey Skinner, was in titled "Ada2C: An 
ADA-To-C Program Translator" but it seams that today, most "Ada2C" 
programs have more to do with homework assignments than actual working 
programs.


In <334c1c0a-0c49-49d3-b03b-867c2288159c@25g2000hsx.googlegroups.com>, climber.cui@gmail.com writes:
>Hi all,
>  I would like to investigate on how ada's protected object  and
>tasking features are implemented with C/pthread. Is it possible to use
>gcc(or other tools) to do the translation?
>
>  thanks.
>
>tony




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

* Re: Is it possible to translate ada program to C using GCC or other tools?
  2008-07-23  0:15 ` Jeffrey R. Carter
@ 2008-07-23  0:59   ` climber.cui
  0 siblings, 0 replies; 12+ messages in thread
From: climber.cui @ 2008-07-23  0:59 UTC (permalink / raw)


On Jul 22, 8:15 pm, "Jeffrey R. Carter"
<spam.jrcarter....@spam.acm.org> wrote:
> climber....@gmail.com wrote:
>
> >   I would like to investigate on how ada's protected object  and
> > tasking features are implemented with C/pthread. Is it possible to use
> > gcc(or other tools) to do the translation?
>
> What makes you think these features are implemented in C?
>
> gcc will not translate Ada to C.
>
> SofCheck has a compiler that uses ANSI C as its intermediate language, but I
> suspect what you're interested in is part of their runtime code, not the code
> produced by the compiler.
>
> --
> Jeff Carter
> "It's symbolic of his struggle against reality."
> Monty Python's Life of Brian
> 78

yes, you are right. It is the Gnat runtime code that implements the
concurrent features. But I first want to see what runtime calls is
made for certain ADA constructs. When i try to read gcc source code, i
got lost at the beginning.



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

* Re: Is it possible to translate ada program to C using GCC or other
  2008-07-23  0:45 ` Is it possible to translate ada program to C using GCC or other anon
@ 2008-07-23  1:05   ` climber.cui
  2008-07-23  7:01     ` anon
  2008-07-23 10:12     ` Pascal Obry
  0 siblings, 2 replies; 12+ messages in thread
From: climber.cui @ 2008-07-23  1:05 UTC (permalink / raw)


On Jul 22, 8:45 pm, a...@anon.org (anon) wrote:
> No!
>
> In GNAT the compiler generates assembly code. With one exception that is
> "GNATBIND" program. Using the "-C" option, GNATBIND with produce its
> binder program in C. But that does very little for what most people want.
>
> A thesis, back in 1991 by Jeffrey Skinner, was in titled "Ada2C: An
> ADA-To-C Program Translator" but it seams that today, most "Ada2C"
> programs have more to do with homework assignments than actual working
> programs.
>
Any chance to get ADA to be translated to something readable, like ADA
code plus run-time calls to its runtime system and pthread library?
By the way, how to use GNAT to compile ada program into assembly code?
I use gcc with -S option, but did not get anything but an assembly
program with no body.

tony




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

* Re: Is it possible to translate ada program to C using GCC or other tools?
  2008-07-22 20:48 Is it possible to translate ada program to C using GCC or other tools? climber.cui
  2008-07-23  0:15 ` Jeffrey R. Carter
  2008-07-23  0:45 ` Is it possible to translate ada program to C using GCC or other anon
@ 2008-07-23  1:44 ` Robert A Duff
  2008-07-23  2:23 ` Steve
  2008-07-23  7:54 ` Georg Bauhaus
  4 siblings, 0 replies; 12+ messages in thread
From: Robert A Duff @ 2008-07-23  1:44 UTC (permalink / raw)


climber.cui@gmail.com writes:

> Hi all,
>   I would like to investigate on how ada's protected object  and
> tasking features are implemented with C/pthread. Is it possible to use
> gcc(or other tools) to do the translation?

You might be interested in the -gnatD or -gnatG switches.
See the docs for details.

Or just look at the sources for the runtime libs.

- Bob



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

* Re: Is it possible to translate ada program to C using GCC or other tools?
  2008-07-22 20:48 Is it possible to translate ada program to C using GCC or other tools? climber.cui
                   ` (2 preceding siblings ...)
  2008-07-23  1:44 ` Is it possible to translate ada program to C using GCC or other tools? Robert A Duff
@ 2008-07-23  2:23 ` Steve
  2008-07-23  6:46   ` Peter Schildmann
  2008-07-23  7:54 ` Georg Bauhaus
  4 siblings, 1 reply; 12+ messages in thread
From: Steve @ 2008-07-23  2:23 UTC (permalink / raw)


<climber.cui@gmail.com> wrote in message 
news:334c1c0a-0c49-49d3-b03b-867c2288159c@25g2000hsx.googlegroups.com...
> Hi all,
>  I would like to investigate on how ada's protected object  and
> tasking features are implemented with C/pthread. Is it possible to use
> gcc(or other tools) to do the translation?
>

Hi,

pthread isn't C.  pthread is machine code.  The source code may have been 
in C (or any other programming language for that matter) but you don't 
execute C.  Back in the olden days they used to document OS interface calls 
in a programming language independent manner, that made it a little clearer.

At any rate, while the following information is somewhat outdated, you may 
find it useful:

http://www.iuma.ulpgc.es/users/jmiranda/

Regards,
Steve

>  thanks.
>
> tony 





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

* Re: Is it possible to translate ada program to C using GCC or other tools?
  2008-07-23  2:23 ` Steve
@ 2008-07-23  6:46   ` Peter Schildmann
  2008-07-24  1:32     ` Steve
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Schildmann @ 2008-07-23  6:46 UTC (permalink / raw)


Steve schrieb:
> At any rate, while the following information is somewhat outdated, you may 
> find it useful:
> 
> http://www.iuma.ulpgc.es/users/jmiranda/

There is an improved version:

https://www2.adacore.com/gap-static/GNAT_Book/html/index.htm



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

* Re: Is it possible to translate ada program to C using GCC or other
  2008-07-23  1:05   ` climber.cui
@ 2008-07-23  7:01     ` anon
  2008-07-23 10:12     ` Pascal Obry
  1 sibling, 0 replies; 12+ messages in thread
From: anon @ 2008-07-23  7:01 UTC (permalink / raw)


First to clarify, the compiling process. Normally to compile a program

        step 1. gnat compile <filename>.adb

        step 2. gnat bind <filename>.ali   or  gnatbind <filename>.ali
             this program creates two files:
                   1. b~<filename>.adb  
                   2. b~<filename>.ads

        step 3. gnat link <filename>.ali or gnatlink <filename>.ali
             this program compiles the package
                   b~<filename>.adb  
             and then finishes the linking process.
             Note: After linking the b~<filename>.* files are deleted.


but in step two and three you can use

        step 2. gnat bind -C <filename>.ali   or gnatbind -C <filename>.ali
             this creates one file:
                   1. b_<filename>.c
             this file is equivalence to the package file:
                   b~<filename>.adb  

        step 3. gnat link -C <filename>.ali or gnatlink -C <filename>.ali
             this program compiles the C binder file 
                   b_<filename>.c  
             and then finishes the linking process.
             Note: After linking the b_<filename>.* files are deleted.


As for the thesis, I am not sure, you might be able to find it. There is 
a "Jeffrey Skinner" that is into web designing.  Maybe he is the same 
guy, so I would suggest, that you email and ask him.  The only problem I 
see will be that the Ada translator and source code will be based on Ada 
83 specs.


   www.jeffreyskinner.com
                  Jeffrey Skinner. email: jeff [at] jeffreyskinner
                                           aka
                                           jeff@jeffreyskinner 


In <822c5e24-bd20-458d-8346-ba22994aa850@d45g2000hsc.googlegroups.com>, climber.cui@gmail.com writes:
>On Jul 22, 8:45 pm, a...@anon.org (anon) wrote:
>> No!
>>
>> In GNAT the compiler generates assembly code. With one exception that is
>> "GNATBIND" program. Using the "-C" option, GNATBIND with produce its
>> binder program in C. But that does very little for what most people want.
>>
>> A thesis, back in 1991 by Jeffrey Skinner, was in titled "Ada2C: An
>> ADA-To-C Program Translator" but it seams that today, most "Ada2C"
>> programs have more to do with homework assignments than actual working
>> programs.
>>
>Any chance to get ADA to be translated to something readable, like ADA
>code plus run-time calls to its runtime system and pthread library?
>By the way, how to use GNAT to compile ada program into assembly code?
>I use gcc with -S option, but did not get anything but an assembly
>program with no body.
>
>tony
>




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

* Re: Is it possible to translate ada program to C using GCC or other tools?
  2008-07-22 20:48 Is it possible to translate ada program to C using GCC or other tools? climber.cui
                   ` (3 preceding siblings ...)
  2008-07-23  2:23 ` Steve
@ 2008-07-23  7:54 ` Georg Bauhaus
  4 siblings, 0 replies; 12+ messages in thread
From: Georg Bauhaus @ 2008-07-23  7:54 UTC (permalink / raw)


climber.cui@gmail.com wrote:
> Hi all,
>   I would like to investigate on how ada's protected object  and
> tasking features are implemented with C/pthread. Is it possible to use
> gcc(or other tools) to do the translation?

You'd need an Ada compiler that will translate Ada to C and
use C and pthreads for protected objects. I think Sofcheck
has such a compiler.




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

* Re: Is it possible to translate ada program to C using GCC or other
  2008-07-23  1:05   ` climber.cui
  2008-07-23  7:01     ` anon
@ 2008-07-23 10:12     ` Pascal Obry
  1 sibling, 0 replies; 12+ messages in thread
From: Pascal Obry @ 2008-07-23 10:12 UTC (permalink / raw)
  To: climber.cui

climber.cui@gmail.com a �crit :
> Any chance to get ADA to be translated to something readable, like ADA
> code plus run-time calls to its runtime system and pthread library?

You probably want to look at -gnatDG option.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



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

* Re: Is it possible to translate ada program to C using GCC or other tools?
  2008-07-23  6:46   ` Peter Schildmann
@ 2008-07-24  1:32     ` Steve
  0 siblings, 0 replies; 12+ messages in thread
From: Steve @ 2008-07-24  1:32 UTC (permalink / raw)


"Peter Schildmann" <news@schildmann.info> wrote in message 
news:6eo2etF8053cU1@mid.individual.net...
> Steve schrieb:
>> At any rate, while the following information is somewhat outdated, you 
>> may
>> find it useful:
>>
>> http://www.iuma.ulpgc.es/users/jmiranda/
>
> There is an improved version:
>
> https://www2.adacore.com/gap-static/GNAT_Book/html/index.htm

Thanks,

Steve





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

end of thread, other threads:[~2008-07-24  1:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-22 20:48 Is it possible to translate ada program to C using GCC or other tools? climber.cui
2008-07-23  0:15 ` Jeffrey R. Carter
2008-07-23  0:59   ` climber.cui
2008-07-23  0:45 ` Is it possible to translate ada program to C using GCC or other anon
2008-07-23  1:05   ` climber.cui
2008-07-23  7:01     ` anon
2008-07-23 10:12     ` Pascal Obry
2008-07-23  1:44 ` Is it possible to translate ada program to C using GCC or other tools? Robert A Duff
2008-07-23  2:23 ` Steve
2008-07-23  6:46   ` Peter Schildmann
2008-07-24  1:32     ` Steve
2008-07-23  7:54 ` Georg Bauhaus

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