comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Ada to C translator for small microcontrollers
Date: Wed, 28 Mar 2012 19:36:37 +0300
Date: 2012-03-28T19:36:37+03:00	[thread overview]
Message-ID: <9tgt0lFqtU1@mid.individual.net> (raw)
In-Reply-To: <26305817.1823.1332879226490.JavaMail.geo-discussion-forums@vbiz13>

On 12-03-27 23:13 , kalvin.news@gmail.com wrote:
> tiistaina 27. maaliskuuta 2012 20.22.07 UTC+3 an...@att.net
> kirjoitti:
>> Full language translators are mostly used to move a project away
>> from one language to another more accessable language. So, why use
>> Ada in the first place.

Because it is so much better than C, of course :-)

I know of more than one project that used Ada as a high-level design and 
specification language, and then implemented the design in some 
lower-level language (in one case, an assembly language). In some cases, 
the Ada code was complete and runnable and could be used as a test 
oracle for the lower-level implementation.

> This is a very valid question. How large a software project needs to
> be in order to benefit from implementing it in Ada?

IMO, basically there is no lower limit, with the possible exception of 
the null program.

> Is it only a one
> person prjoect, two person project or project involving a small team.
> Why bother with Ada as we already have (free) C compiler avaiable.

We also have a free Ada compiler available, for many platforms -- but 
not for many small processors, I grant.

But many projects developing in C for microcontrollers use non-free, 
commercial compilers, IDEs, and other expensive tools (in-circuit 
debuggers, etc.) The question IMO is not whether there is a benefit from 
using the Ada language; the question is if the benefit can be 
convincingly quantified in money and schedule terms.

> If the project is a small one, and you don't have to share the code
> with others, C is just fine.

No! C is a like a Model-T Ford that for some strange reason is allowed 
on modern roads. You can survive and not be too uncomfortable on short 
trips, but you should really consider changing to a better car.

IMO the only reasons that would make me use C instead of Ada are:
- No Ada compiler available within my budget
- Need to use large C libraries/APIs for which no Ada binding exists.

> I do realize, that it might be almost impossible to produce efficient
> C source translation for corresponding Ada, compared to corresponding
> assembly.

It is true that C does not provide all the features of assembly 
language, for all that it is called a "portable assembler". But I'm not 
sure that this would be a large handicap for an Ada compiler that uses C 
as an intermediate language (like the SofCheck one).

The C level could be a performance bottleneck if one wanted to support 
wider numbers in Ada than the C compiler supports -- for example, an Ada 
64-bit Long_Integer with a C compiler that supports only 32-bit integers 
-- but this is a marginal effect, I think.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .



  parent reply	other threads:[~2012-03-28 16:36 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-26 12:48 Ada to C translator for small microcontrollers Tomi Saarnio
2012-03-26 13:44 ` Rego, P.
2012-03-26 14:14 ` Niklas Holsti
2012-03-26 15:48   ` Ludovic Brenta
2012-03-26 16:20     ` Simon Wright
2012-03-26 14:46 ` georg bauhaus
2012-03-26 19:16 ` anon
2012-03-27  9:46 ` kalvin.news
2012-03-27 17:22   ` anon
2012-03-27 20:13     ` kalvin.news
2012-03-28 14:29       ` KK6GM
2012-03-28 16:36       ` Niklas Holsti [this message]
2012-03-28 17:56         ` KK6GM
2012-03-28 21:03         ` Georg Bauhaus
2012-03-30 11:54           ` phil.clayton
2012-03-31 15:46         ` kalvin.news
2012-03-31 19:52           ` Rugxulo
2012-04-01 11:23             ` kalvin.news
2012-04-02 21:46             ` Niklas Holsti
2012-04-03  5:56               ` J-P. Rosen
2012-04-03  2:08 ` BrianG
2012-04-03  9:29   ` Georg Bauhaus
2012-05-21 10:35 ` kalvin.news
2012-05-21 12:27   ` Georg Bauhaus
2012-06-02 15:27     ` Marco
2012-06-05  9:18       ` kalvin.news
2012-06-05 12:17         ` Brian Drummond
2012-06-06  5:21           ` J-P. Rosen
2012-06-06 11:50             ` Brian Drummond
2012-06-10 15:41         ` Marco
replies disabled

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