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.9 required=5.0 tests=BAYES_00 autolearn=ham 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-26 23:39:52 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!news.iac.net!news-out.cwix.com!newsfeed.cwix.com!newsfeed.icl.net!news.algonet.se!algonet!uninett.no!news.ost.eltele.no!newsfeed1.enitel.no!news.telia.no!not-for-mail Sender: ohk@daf.clustra.com Newsgroups: comp.lang.ada Subject: Re: Implementing C/C++ style #include... References: <98m938$2iod0$1@ID-25716.news.dfncis.de> <99alrr$itf$1@nh.pace.co.uk> <99d5dj$fi4$1@nh.pace.co.uk> From: Ole-Hjalmar Kristensen Message-ID: X-Newsreader: Gnus v5.5/Emacs 20.3 Date: Tue, 27 Mar 2001 07:34:34 GMT NNTP-Posting-Host: 195.204.160.194 X-Complaints-To: abuse@enitel.no X-Trace: news.telia.no 985678474 195.204.160.194 (Tue, 27 Mar 2001 09:34:34 CEST) NNTP-Posting-Date: Tue, 27 Mar 2001 09:34:34 CEST Organization: Enitel Internet Public Access Xref: supernews.google.com comp.lang.ada:6102 Date: 2001-03-27T07:34:34+00:00 List-Id: "Marin David Condic" writes: If someone wants something like the C preprocessor, then just use the C preprocessor. It works just as well (or bad) with Ada. > 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 > > > > > > -- Kabelsalat ist gesund. Ole-Hj. Kristensen