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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,9adfbb907494972e X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,9adfbb907494972e X-Google-Attributes: gid103376,public X-Google-Thread: 109fba,94a2b19e68586a6 X-Google-Attributes: gid109fba,public From: Erik Magnuson Subject: Re: Ada to C/C++ translator needed Date: 1996/10/07 Message-ID: #1/1 X-Deja-AN: 187433612 sender: erik@fisher x-nntp-posting-host: fisher references: <32499FA0.4B5E@magic.fr> <52cdn6$iis@dfw.dfw.net> organization: ENSCO, INC. newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++ Date: 1996-10-07T00:00:00+00:00 List-Id: dewar@schonberg.cs.nyu.edu (Robert Dewar) writes: > > Frank said > > "Awhile back there was a big discussion about the merits of writing an > 8051 Ada compiler. I'm a bit surprised nobody mentioned this > possibility, since 8051 C compilers already exist." > > If you think that the existence of an Ada 83 compiler that generates C > means that there is an easy path to an acceptably efficient Ada compiler > on any machine with a C compiler, you are seriously fooling yourself for > all sorts of reasons. Nothing is as straightforward as one might hope! > In a former life, I used to use such a beast daily and quickly came to realize just why this is not a favored path to what we would call a "production quality compiler". (No offense to the vendor intended, it was impressive that it worked as well as it did.) Realize that if you want to get decent performance even writing low-level C these days you have to enable the C compiler's optimizer. You can imagine what contortions the code generator has to go through to make sure the C optimizer does not hose the Ada semantics. Not to mention to workaround the bugs in said optimizer (which change in every release.) Especially since the C compiler vendor's test suite is very unlikely to contain such odd code. (Imagine reporting such bugs to the C vendor: "You're doing what?!"). And think about how much fun debugging becomes. For if you have no Ada code generator, you're not likely to have an Ada debugger! Oh, the joy of trying to make sense of 3 listings (the Ada source, the generated C and the generated assembler.) It was not pretty. Supporting nested procedures was a particular joy to behold. In addition, I believe that 8051 C compilers tend to have extensions to exploit the features of the chip. You'll want these of course. You'll have lots of fun trying to decide how to map onto these. And the compilation speed will be at least twice as bad as the C compiler. Think about it: you have at least the entire C compiler overhead as well as your Ada compiler source -> code gen (including the Ada compiler's highlevel optimizer.) (For this example, imagine the C compiler is a hasty port of a Unix compiler to VMS that does lot's unixy things that VMS just hates, like spawning many processes that communicate via temp files that are byte streams, etc.) -- Erik Magnuson, ENSCO erik@fl.ensco.com MARSS-REPL (407) 783-7114