comp.lang.ada
 help / color / mirror / Atom feed
* About a C/C++ to ADA translator
@ 1998-01-05  0:00 Marcos Jimenez Bermejo
  1998-01-05  0:00 ` David  Weller
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Marcos Jimenez Bermejo @ 1998-01-05  0:00 UTC (permalink / raw)





There is a C/C++ to ADA (ADA95) translator?
Where can i find  example sources  about ADA programming? (FTP, WWW...)
I have many problems creating ARRAYS  2D in ADA. Could you give me an
real example?

Thanx.
 You can forward them to Marcos Jimenez at the following
address:  mjimenez@a01-unix.gsyc.inf.uc3m.es





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

* Re: About a C/C++ to ADA translator
  1998-01-05  0:00 About a C/C++ to ADA translator Marcos Jimenez Bermejo
  1998-01-05  0:00 ` David  Weller
@ 1998-01-05  0:00 ` Robert Dewar
  1998-01-05  0:00   ` Two dimensional arrays: help Michael F Brenner
  1998-01-05  0:00   ` About a C/C++ to ADA translator Marcos Jimenez Bermejo
  1998-01-07  0:00 ` Benoit Jauvin-Girard
  1998-01-09  0:00 ` Brian G. Holmes
  3 siblings, 2 replies; 14+ messages in thread
From: Robert Dewar @ 1998-01-05  0:00 UTC (permalink / raw)



Marcos asks

<<Where can i find  example sources  about ADA programming? (FTP, WWW...)
I have many problems creating ARRAYS  2D in ADA. Could you give me an
real example?
>>

Undoubtedly your problem is because you do not understand the language
(whose name by the way is Ada, not ADA). Trying to learn from examples
is always a bad idea, compared to really understanding the rules. I
would go to www.adahome.com, and followup the resources there, including
some online tutorials which you should try out.





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

* Re: About a C/C++ to ADA translator
  1998-01-05  0:00 ` Robert Dewar
  1998-01-05  0:00   ` Two dimensional arrays: help Michael F Brenner
@ 1998-01-05  0:00   ` Marcos Jimenez Bermejo
  1998-01-05  0:00     ` nabbasi
  1998-01-05  0:00     ` Kenneth W. Sodemann
  1 sibling, 2 replies; 14+ messages in thread
From: Marcos Jimenez Bermejo @ 1998-01-05  0:00 UTC (permalink / raw)



Robert Dewar wrote:

> Marcos asks
>
> <<Where can i find  example sources  about ADA programming? (FTP, WWW...)
> I have many problems creating ARRAYS  2D in ADA. Could you give me an
> real example?
> >>
>
> Undoubtedly your problem is because you do not understand the language
> (whose name by the way is Ada, not ADA). Trying to learn from examples
> is always a bad idea, compared to really understanding the rules. I
> would go to www.adahome.com, and followup the resources there, including
> some online tutorials which you should try out.

  O.K  I know his really name is Ada, but you don't have aswered my
questions.





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

* Two dimensional arrays: help
  1998-01-05  0:00 ` Robert Dewar
@ 1998-01-05  0:00   ` Michael F Brenner
  1998-01-05  0:00     ` Robert Dewar
  1998-01-05  0:00   ` About a C/C++ to ADA translator Marcos Jimenez Bermejo
  1 sibling, 1 reply; 14+ messages in thread
From: Michael F Brenner @ 1998-01-05  0:00 UTC (permalink / raw)



In any computer language or other artistic endeavor, one of the easiest
ways to learn the rules is by examples. In many cases the rules are
so culturally specific that outsiders actually benefit more from
working examples than from the rules at all. In addition, when the rules
change (noteable examples are the loss of efficiency introduced into
unsigned numbers between the rationale and the manual, and the 
inconsistency accepted as normal in the ways that stream_io works
on different current versions of gnat), it is impossible to know
the rules except by having access to working examples.

The Ada community would benefit by a set of working examples
for each feature of the language. The Ada restrictions on two 
dimensional arrays are such that one can program them successfully
from an example, but it would be MUCH less efficient to attempt
to learn them from the rules in the rationale and the manual. 
This is in part a fault of the rules, in part a fault of the
intended design of the language to introduce artificial
restrictions in the name of readability, and in part a fault
of the expression of the rules. In particular the expression
of the rules would be Greatly enhanced by putting the set of
working examples directly hypertext linked into the next 
version of the manual in a way that they can be compiled and
run. 

The lack of examples, particularly of two dimensional arrays of
packed bits, where efficiency is not only paramount, it is the
only criteria for choice of language used, is the cause of 
so many Ada compilers getting that part of the language working
last. If examples of packed bit strings were emphasized more
in the validation suites, so that almost no test could pass until
packed bits strings worked, then the compilers would be validated
with less cost and have a lot less future maintenance.

The old way of remembering that FORTRAN matrices go one way and
math book matrices go the other way does not work with Ada, 
which introduces a whole new vocabulary for its two dimensional
arrays. The correct way to describe matrices is geometrically,
with horizontal x coordinates and vertical y coordinates, like
on a printer or screen. It is not a trivial task to use the
manual to derive the rules for using two dimensional arrays in
Ada (assuming you are familiar with two dimensional arrays in
say, FORTRAN, Pascal, or some other language). An example of
actual use, that is, a working example, however, is instantly
easy to see how to define, initialize, and use the two dimensional
array.

Therefore, I have sent an e-mail to you with an example that
defines, initializes, makes use of a two dimensional array to
implement the transition matrix of a finite state machine that you
can compile, link, run, and use as a model of how to program
two dimensional arrays.

After you get your first program up and running, then I recommend
that you follow Robert's suggestion to read the on-line
manuals, rationale, etc., available on the Net.

Mike Brenner




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

* Re: About a C/C++ to ADA translator
  1998-01-05  0:00 About a C/C++ to ADA translator Marcos Jimenez Bermejo
@ 1998-01-05  0:00 ` David  Weller
  1998-01-05  0:00   ` Robert Dewar
  1998-01-05  0:00 ` Robert Dewar
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 14+ messages in thread
From: David  Weller @ 1998-01-05  0:00 UTC (permalink / raw)



In article <34B0C8A6.B19098B6@a01-unix.gsyc.inf.uc3m.es>,
Marcos Jimenez Bermejo  <mjimenez@a01-unix.gsyc.inf.uc3m.es> wrote:
>
>
>There is a C/C++ to ADA (ADA95) translator?

No, not really.  There appears to be very little interest in this
matter.  Ada "purists" will simply tell you to rewrite the code to
take advantage of Ada features, and "integrators" will simply suggest
you link the code in with any new Ada code you're writing.  The latter
approach is generally the more cost-effective one :-)

>Where can i find  example sources  about ADA programming? (FTP, WWW...)
>I have many problems creating ARRAYS  2D in ADA. Could you give me an
>real example?
>

There are excellent examples at www.adahome.com/Ammo/cpp2ada.html

I personally suggest buying Simon Johnston's "Ada95 for C and C++
programmers" and "Ada As A Second Language" by Norm Cohen.  Those two
books are the most important!

(I hope this was more helpful than Robert's rather acerbic reply)


-- 
   ******   NEW!!  DoD Ada Hotline Number:  1-800-PARIAH    ******
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: About a C/C++ to ADA translator
  1998-01-05  0:00 ` David  Weller
@ 1998-01-05  0:00   ` Robert Dewar
  0 siblings, 0 replies; 14+ messages in thread
From: Robert Dewar @ 1998-01-05  0:00 UTC (permalink / raw)



Dave said

<<(I hope this was more helpful than Robert's rather acerbic reply)
>>

The important point in my reply was to discourage trying to learn
programming by example. Yes, examples are useful for understanding
good style, but they are generally a poor way of learning languages
where precision is required. Your (Dave) recommendation to read
books is a good one, and consistent with my suggestion.

I find that programmers who can only learn by example tend to have a very
spotty knowledge of the language, and in particular are least likely to
be able to distinguish between the language as defined and the language 
as implemented.

For my own personal tastes I dislike all examples in programming reference
manuals, they are either wrong, in which case they are misleading, or
redundant, and redundancy is not a good idea in any definition. An example
can only tell you one thing that works, it cannot tell you the class of
things that work. That's a fundamental weakness. At the same time I realize
that a surprising (to me) number of people do find examples helpful.

So if you don't know how 2D arrays (or any other feature of Ada) works,
then the starting point should be to go read the RM or a textbook, as
appropriate to your level of understanding, to find out the rules for
how to use 2D arrays. This is a straightforward syntactic matter, and
anyone should be able to read BNF fluently who considers themselves a
programmer (even if they cannot manage to wade through chapter 3 of the
RM :-)

Now of course, you sometimes read something and misread, and cannot understand
an example of your own that you think is right which gets an error message.
(We put in a huge effort to generate good error messages from GNAT, so once
again, I take the opportunity to encourage people to submit reports on error
messages they find confusing, preferably with suggestions on improvements,
don't be afraid to be ambitious in your suggestions, it is surprising sometimes
what can be achieved -- e.g. the job that GNAT does in figuring out the
semicolon/is mess is quite suprising sometimes).

If you are stuck on a specific error message, and cannot figure it out, then
that is indeed a good time to post a message to CLA, with exact code and
what you saw. If you post a sharp well defined example of this kind, which
involves main language features, as opposed to murky things like non-standard
rep clauses :-) then you will likely get a pretty immediate response from CLA.






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

* Re: Two dimensional arrays: help
  1998-01-05  0:00   ` Two dimensional arrays: help Michael F Brenner
@ 1998-01-05  0:00     ` Robert Dewar
  1998-01-06  0:00       ` Chris Morgan
  0 siblings, 1 reply; 14+ messages in thread
From: Robert Dewar @ 1998-01-05  0:00 UTC (permalink / raw)



Mike said

<<In any computer language or other artistic endeavor, one of the easiest
ways to learn the rules is by examples. In many cases the rules are
so culturally specific that outsiders actually benefit more from
working examples than from the rules at all. In addition, when the rules
change (noteable examples are the loss of efficiency introduced into
unsigned numbers between the rationale and the manual, and the
inconsistency accepted as normal in the ways that stream_io works
on different current versions of gnat), it is impossible to know
the rules except by having access to working examples.
>>

While I agree that programming has aspects of artistry certainly, I strongly
disagree that the analogy means that you should learn programming
*languages* by example.

The trouble is you don't learn rules precisely from examples, you learn
a subset of things that work without really understanding the rules. A
good programmer should aspire to 100% understanding of the subset of the
language they are using, and have an understanding at an appropritae
level of abstraction. I admit immediately that most programmers fail this
requirement!

As for your two off-hand examples, I have no idea what you are talking
about. I know of no "loss of efficiency introduced into unsigned
numbers between the rationale and the manual", you should elaborate.
Certainly the rules in the manual are quite clear, and I see no basis
at all for the claim that it is impossible to know the rules about
unsigned numbers without examples. Remember that the examples in the RM
have absolutely NO normative information at all. If the rules on unsigned
numbers (of course you really mean modular types) are incomplete in the
manual, then examples cannot make up for the incompleteness, indeed any
example that conveyed information not derivable from the RM is plain wrong.
Please justify this suprising allegation with specifics.

Ditto for "inconsistencies" in the way stream_io works in different versions
of GNAT. Again, as far as I know, the stream_io in all versions of GNAT is
consistent with the rules in the RM. If you see inconsistencies, then one of
two things is possible:

(a) you have found a bug, please report it

(b) you have some model of how stream_io might work that is not derivable
from the rules, the stream_io as implemented consistent with these rules
differs from your model. I guess that this is probably the case here, and
it just goes to emphasize what a bad idea it is to try to learn how things
work by guessing from examples rather than reading the rules.

Again, it would be instructive to know exactly what you are referring to,
I suspect it would make a very nice case study showing why learning from
examples is an unreliable way to learn.

Please elucidate both examples.





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

* Re: About a C/C++ to ADA translator
  1998-01-05  0:00   ` About a C/C++ to ADA translator Marcos Jimenez Bermejo
  1998-01-05  0:00     ` nabbasi
@ 1998-01-05  0:00     ` Kenneth W. Sodemann
  1 sibling, 0 replies; 14+ messages in thread
From: Kenneth W. Sodemann @ 1998-01-05  0:00 UTC (permalink / raw)



Marcos Jimenez Bermejo wrote in message
<34B0E966.9207CAF7@a01-unix.gsyc.inf.uc3m.es>...
>Robert Dewar wrote:
>>> Marcos asks
>>
>> <<Where can i find  example sources  about ADA programming? (FTP, WWW...)
>> I have many problems creating ARRAYS  2D in ADA. Could you give me an
[snip]
>> Undoubtedly your problem is because you do not understand the language
>> (whose name by the way is Ada, not ADA). Trying to learn from examples
>> is always a bad idea, compared to really understanding the rules. I
>> would go to www.adahome.com, and followup the resources there, including
>> some online tutorials which you should try out.
>
>  O.K  I know his really name is Ada, but you don't have aswered my
>questions.

Actually, Mr. Dewar did answer one of your questions (with other good advice
(and some senseless nit picking) thrown in for free).  You asked for a WWW
or FTP site where you can find good code examples.  He gave you
http://www.adahome.com.

Also, based on your post I am assuming that you are a C++ programmer.  There
is a book called Ada 95 for C and C ++ Programmers, by Simon Johnston, ISBN:
0201403633.  I have not personally used (or even seen) this book, however it
did get good reviews, and you may find it helpful.  Check out
http://www.amazon.com for purchasing info.  There is a review of the book on
the Ada home page (http://www.adahome.com).  By the way, if you do get it,
let me know what you think of it.  I was thinking it may make a good text
for here at work, where many folks coming in know C++, and almost none have
even _heard_ of Ada.

Side note on the Ada vs. ADA nit picking that is so prevalent here:  Right
outside my cube wall is a poster with the main title being "A World View of
ADA" with "ADA" in big capital letters.  How can we expect those new to Ada
to get it right when the folks spreading the propaganda can't even get it
right!! :)

--
with Std_Disclaimer;  use Std_Disclaimer;
Signature.Put (Name => Ken Sodemann,
    E_Mail => kwsodema@avistainc.com
    Web => http://www.pcii.net/~stuffel
    Company_Web => http://www.avistainc.com);







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

* Re: About a C/C++ to ADA translator
  1998-01-05  0:00   ` About a C/C++ to ADA translator Marcos Jimenez Bermejo
@ 1998-01-05  0:00     ` nabbasi
  1998-01-05  0:00     ` Kenneth W. Sodemann
  1 sibling, 0 replies; 14+ messages in thread
From: nabbasi @ 1998-01-05  0:00 UTC (permalink / raw)




Understanding a language just by reading the definitions and the grammer of the
language is like trying to appreciate a flower by reading the chemical compounds
it is made of, instead of touching it and smilling it :)

Same with mathematics, books that only list theories and diffinitions, without
giving good examples, are not as good for learning from as the ones that do.

I think only very very smart people can learn and understand a language by just
reading its grammer and "defintions" instead of also having examples to help in
the understanding, for the most of us, whose IQ's range between 90 and 110,
examples really help in understanding how things work, even though an example
will only show one aspect of the issue, it still helps. at least I find good
examples help me.

that is also why I find the man pages on UNIX not very good, they is almost no
examples in them.

just my 1.88 cents.

Nasser




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

* Re: Two dimensional arrays: help
  1998-01-06  0:00       ` Chris Morgan
@ 1998-01-06  0:00         ` Robert Dewar
  0 siblings, 0 replies; 14+ messages in thread
From: Robert Dewar @ 1998-01-06  0:00 UTC (permalink / raw)



<<I for one clearly remember Michael complaining that the modular types
in Ada95 don't behave the way the Rationale implied and you responding
that the Rationale is wrong.
>>

Of course I know perfectly well that the rules changed and that the
Rationale did not get updated, but that's not the issue, Michael mentioned
"loss of efficiency" in the rule changes, and I don't see that. Perhaps
he is referring to the range check now introduced for unsigned to signed
conversion, but that's really a conceptually necessary check. If you don't
like it, suppress it as you would any other check (after all checks are
all about loss of efficiency from one point of view :-)





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

* Re: Two dimensional arrays: help
  1998-01-05  0:00     ` Robert Dewar
@ 1998-01-06  0:00       ` Chris Morgan
  1998-01-06  0:00         ` Robert Dewar
  0 siblings, 1 reply; 14+ messages in thread
From: Chris Morgan @ 1998-01-06  0:00 UTC (permalink / raw)



dewar@merv.cs.nyu.edu (Robert Dewar) writes:

> I know of no "loss of efficiency introduced into unsigned
> numbers between the rationale and the manual", you should elaborate.
> Certainly the rules in the manual are quite clear, and I see no basis
> at all for the claim that it is impossible to know the rules about
> unsigned numbers without examples. 

I for one clearly remember Michael complaining that the modular types
in Ada95 don't behave the way the Rationale implied and you responding
that the Rationale is wrong.

Perhaps we can all agree that the most useless material for learning
from possible is wrong examples!

Chris
-- 
Chris Morgan <mihalis at ix.netcom.com>
     "I'm considering throwing myself out of the window.  It
      wouldn't do me much damage because we're on the ground 
      floor, but it might make for a bit of variety."  - Lizzy Bryant




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

* Re: About a C/C++ to ADA translator
  1998-01-05  0:00 About a C/C++ to ADA translator Marcos Jimenez Bermejo
  1998-01-05  0:00 ` David  Weller
  1998-01-05  0:00 ` Robert Dewar
@ 1998-01-07  0:00 ` Benoit Jauvin-Girard
  1998-01-12  0:00   ` Jean-Claude MAHIEUX
  1998-01-09  0:00 ` Brian G. Holmes
  3 siblings, 1 reply; 14+ messages in thread
From: Benoit Jauvin-Girard @ 1998-01-07  0:00 UTC (permalink / raw)



On Mon, 5 Jan 1998, Marcos Jimenez Bermejo wrote:
> There is a C/C++ to ADA (ADA95) translator?

Yes.  It's called c2ada, and maintained by Intermetrics.  There is a link
to it at http://www.adahome.com, under Resources - Tools & Components -
Non-Commercial (I think).  However, it requires that you have gperf and 
something called Python installed, and even then I can't get it to work on my 
Linux 2.0 platform (it barfs on any file with an #include <foo.h>
directive) , so if you get it working correctly, drop me a line.

...Also be warned that you're stille xpected to have to tweak the
generated code manually for it to work.

...Hope this will be of more use to you than other replies so far.

--
... Benoit Jauvin-Girard (jhove@cam.org)
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
"If a tree falls in the forest ... and we've already sold the tree ... 
does it have Quality?"
"How many angels can dance on your head?"
	- The Boss and Ratbert, discussing the Quality Assurance process.






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

* Re: About a C/C++ to ADA translator
  1998-01-05  0:00 About a C/C++ to ADA translator Marcos Jimenez Bermejo
                   ` (2 preceding siblings ...)
  1998-01-07  0:00 ` Benoit Jauvin-Girard
@ 1998-01-09  0:00 ` Brian G. Holmes
  3 siblings, 0 replies; 14+ messages in thread
From: Brian G. Holmes @ 1998-01-09  0:00 UTC (permalink / raw)



> There is a C/C++ to ADA (ADA95) translator?

I have done some work on this subject.  My work is briefly described on
a web page at the http://home1.gte.net/holmeses/cpp2anf/index.html
address.  Let me know if I can be of help.

Brian Holmes
brian.holmes@gsc.gte.com
GTE Government Systems Corporation




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

* Re: About a C/C++ to ADA translator
  1998-01-07  0:00 ` Benoit Jauvin-Girard
@ 1998-01-12  0:00   ` Jean-Claude MAHIEUX
  0 siblings, 0 replies; 14+ messages in thread
From: Jean-Claude MAHIEUX @ 1998-01-12  0:00 UTC (permalink / raw)



My company has developped such a tool for productivity purposes.
It is not well designed for specifications that we prefer to 
"translate" manually. The tool has been designed to pre-process
C/C++ source code and generate bodies, and can be customized to 
get knowledge about your Ada packages. It is based on lex/yacc

Jean-Claude Mahieux
Top Graph'X
topgraphx@compuserve.com

-- 
Jean-Claude Mahieux -Top Graph'X - FRANCE 
Tel : (33 1) 69 26 97 88 Fax : (33 1) 69 26 97 89                
Email : 100071.45@compuserve.com                              
HTTP://ourworld.compuserve.com/homepages/topgraphx 




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

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

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-01-05  0:00 About a C/C++ to ADA translator Marcos Jimenez Bermejo
1998-01-05  0:00 ` David  Weller
1998-01-05  0:00   ` Robert Dewar
1998-01-05  0:00 ` Robert Dewar
1998-01-05  0:00   ` Two dimensional arrays: help Michael F Brenner
1998-01-05  0:00     ` Robert Dewar
1998-01-06  0:00       ` Chris Morgan
1998-01-06  0:00         ` Robert Dewar
1998-01-05  0:00   ` About a C/C++ to ADA translator Marcos Jimenez Bermejo
1998-01-05  0:00     ` nabbasi
1998-01-05  0:00     ` Kenneth W. Sodemann
1998-01-07  0:00 ` Benoit Jauvin-Girard
1998-01-12  0:00   ` Jean-Claude MAHIEUX
1998-01-09  0:00 ` Brian G. Holmes

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