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.231.138 with SMTP id tg10mr2682298pbc.7.1333223632443; Sat, 31 Mar 2012 12:53:52 -0700 (PDT) Path: r9ni3785pbh.0!nntp.google.com!news1.google.com!postnews.google.com!h9g2000yqe.googlegroups.com!not-for-mail From: Rugxulo Newsgroups: comp.lang.ada Subject: Re: Ada to C translator for small microcontrollers Date: Sat, 31 Mar 2012 12:52:03 -0700 (PDT) Organization: http://groups.google.com Message-ID: <38bda08b-e807-4f5d-b6f9-c4466240a075@h9g2000yqe.googlegroups.com> 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> NNTP-Posting-Host: 65.13.115.246 Mime-Version: 1.0 X-Trace: posting.google.com 1333223632 602 127.0.0.1 (31 Mar 2012 19:53:52 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 31 Mar 2012 19:53:52 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: h9g2000yqe.googlegroups.com; posting-host=65.13.115.246; posting-account=p5rsXQoAAAB8KPnVlgg9E_vlm2dvVhfO User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.83 Safari/535.11,gzip(gfe) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-03-31T12:52:03-07:00 List-Id: Hi, On Mar 31, 10:46=A0am, kalvin.n...@gmail.com wrote: > keskiviikkona 28. maaliskuuta 2012 19.36.37 UTC+3 Niklas Holsti kirjoitti= : > > > 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 Ad= a > > 64-bit Long_Integer with a C compiler that supports only 32-bit integer= s > > -- but this is a marginal effect, I think. > > Yes, the translator should be implemented so, that it would be compatible= with the target C ie. no > support for 64-bit integers etc. if the target C compiler doesn't support= that. 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.) > Nested procedures are also a bit tricy to implement in C, as the local st= ack frame needs to made > visible to the inner procedure. This is doable with the struct of pointer= s passed as parameters for > the "inner procedure", I guess. It is up to target C compiler optimizatio= n how much penalty there will be. 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?). 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.