From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5f6125e9594f9968 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.235.4 with SMTP id ui4mr3933781pbc.3.1333279418024; Sun, 01 Apr 2012 04:23:38 -0700 (PDT) Path: r9ni6169pbh.0!nntp.google.com!news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: kalvin.news@gmail.com Newsgroups: comp.lang.ada Subject: Re: Ada to C translator for small microcontrollers Date: Sun, 1 Apr 2012 04:23:37 -0700 (PDT) Organization: http://groups.google.com Message-ID: <6816433.161.1333279417653.JavaMail.geo-discussion-forums@ynel5> References: <2424259e-cf1c-408e-a57e-f2c948087186@i2g2000vbv.googlegroups.com> <18324383.19.1332841560517.JavaMail.geo-discussion-forums@vbht7> <26305817.1823.1332879226490.JavaMail.geo-discussion-forums@vbiz13> <9tgt0lFqtU1@mid.individual.net> <8580709.239.1333208768840.JavaMail.geo-discussion-forums@ynes7> <38bda08b-e807-4f5d-b6f9-c4466240a075@h9g2000yqe.googlegroups.com> NNTP-Posting-Host: 62.78.181.164 Mime-Version: 1.0 X-Trace: posting.google.com 1333279417 28918 127.0.0.1 (1 Apr 2012 11:23:37 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 1 Apr 2012 11:23:37 +0000 (UTC) In-Reply-To: <38bda08b-e807-4f5d-b6f9-c4466240a075@h9g2000yqe.googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=62.78.181.164; posting-account=QrZwxQoAAAByl3YAWTpexAk3yBYyZMHn User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-04-01T04:23:37-07:00 List-Id: lauantaina 31. maaliskuuta 2012 22.52.03 UTC+3 Rugxulo kirjoitti: > Hi, >=20 > On Mar 31, 10:46=A0am, kalvin.n...@gmail.com wrote: > > keskiviikkona 28. maaliskuuta 2012 19.36.37 UTC+3 Niklas Holsti kirjoit= ti: > > > > > 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 n= ot > > > sure that this would be a large handicap for an Ada compiler that use= s C > > > as an intermediate language (like the SofCheck one). > > > > > The C level could be a performance bottleneck if one wanted to suppor= t > > > 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 integ= ers > > > -- but this is a marginal effect, I think. > > > > Yes, the translator should be implemented so, that it would be compatib= le with the target C ie. no > > support for 64-bit integers etc. if the target C compiler doesn't suppo= rt that. >=20 > If you stick to standard C, that shouldn't be a problem. C99 supports > "long long" (64-bit), and even GCC has supported it for longer than > that. Besides, it's probably? fairly trivial to hack up similar > support with only 32-bit ints. (I know there was a small section an > AMD manual which showed the basic arithmetic in assembly for such > operations.) >=20 > > Nested procedures are also a bit tricy to implement in C, as the local = stack frame needs to made > > visible to the inner procedure. This is doable with the struct of point= ers passed as parameters for > > the "inner procedure", I guess. It is up to target C compiler optimizat= ion how much penalty there will be. >=20 > GCC supports nested procedures. Something like p2c (Pascal to C) had > some weird workaround to support it in generic C, too. I imagine that > using p2c is preferable to writing from scratch in C, though I know > Pascal isn't quite Ada (but still less painful, no?). >=20 > Anyways, it may be easier to just use an interpreter, something like > old NYU Ada/Ed, which was written in C, but I haven't ever looked > close enough nor tried to recompile it. In other words, I don't know > how portable that C code is, it was (AFAIK) 16-bit for an old Intel C > compiler. Perhaps someone in this newsgroup has recompiled it before, > who knows. I realize that's not native speed, but it's probably not > too bad. It certainly is better than nothing. P2C (Pascal-to-C) might also be a viable starting point for the translator.= However, in order to take advantage of mature GNAT compiler front-end, the= GCC looks tempting path. GCC seems to be quite complicated beast, but mayb= e it can be tamed for the purpose.