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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fd63afa4dc364b7e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-22 07:37:56 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!195.25.12.36!oleane.net!oleane!isdnet!psinet-france!psiuk-f4!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: Implementing C/C++ style #include... Date: Thu, 22 Mar 2001 10:23:16 -0500 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <99d5dj$fi4$1@nh.pace.co.uk> References: <98m938$2iod0$1@ID-25716.news.dfncis.de> <99alrr$itf$1@nh.pace.co.uk> NNTP-Posting-Host: 136.170.200.133 X-Trace: nh.pace.co.uk 985274611 15940 136.170.200.133 (22 Mar 2001 15:23:31 GMT) X-Complaints-To: newsmaster@pace.co.uk NNTP-Posting-Date: 22 Mar 2001 15:23:31 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: supernews.google.com comp.lang.ada:5996 Date: 2001-03-22T15:23:31+00:00 List-Id: Dead code optimization was brought up in another sub-thread. I agree that this is a good trick suitable for many of the things usually done by preprocessors. If one is willing to live with a rather primitive preprocessor, it might not be that big a job to simply recognize some simple markers and comment/uncomment code (or just remove it) as needed for test. Its just that it usually isn't long before someone wants to have somewhat more sophisticated features available. Its like I said: How much work do you want to do? I don't think there are enough benefits from a preprocessor to make it worth the time it would take to develop one. I understand that your garden variety C/C++ programmer is used to having one around and may want to lean on one for comfort while moving into The Ada Way(tm). (Hacking C code in Ada syntax, as it were.) I just distrust this sort of add-on to a language and I think Ada is rich enough to get the job done without a preprocessor. If a programmer is used to thinking in terms of lexical inclusion rather than semantic inclusion, preprocessors behave more the way they are used to working. If you make the mental shift into packages, generics, "with" statements, etc., you probably won't feel the need to rely on preprocessors since you'll evolve mechanisms to do the same job in The Ada Way. MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/ "Ira D. Baxter" wrote in message news:tbk5cb2rf5aef0@corp.supernews.com... > One can take advantage of dead code optimization > to eliminate conditionally-compiled code. So you > don't really need a preprocessor for that. > > There isn't any standard in Ada for conditional compilation > of data declarations (or even pragmas!). This > is probably enough to justify a preprocessor of some kind. > > Building one out of conventional tools such as YACC > is probably pretty hard. You can certainly hack > a simple one in PERL, if you want, by defining > it to operate on lines that start with #, say. > > However, if you want one integrated with the Ada source, > you could do that pretty easily by augmenting > an Ada grammar with a few rules, and > using a transformation engine such as our DMS Reengineering Toolkit > (see http://www.semdesigns.com/Products/DMS/DMSToolkit.html). > DMS can be obtained with an Ada grammar. > Rewrite rules for simplifying boolean equations are pretty > easy, as are rules that eliminate conditionals conditioned by TRUE or FALSE. > Such rules coupled with boolean conditions would > give an Ada preprocessor with only small effort. > > -- > Ira D. Baxter, Ph.D. CTO Semantic Designs, Inc. > http://www.semdesigns.com > > "Marin David Condic" wrote in > message news:99alrr$itf$1@nh.pace.co.uk... > > "bhazzard" wrote in message > > news:OrZxgIisAHA.289@cpmsnbbsa09... > > > A quick question... > > > > > > Is there any way to implement c/c++ style > > > #ifdef pre-processor statements in Ada. > > > > > There is always a way. If you're willing to do the work yourself, you can > > write a program to parse your Ada code to look for preprocessor directives > & > > output appropriate *new* Ada code before doing the compile. This is a lot > of > > work > >