help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using m4 for c preprocessing


From: Steve Calfee
Subject: Re: Using m4 for c preprocessing
Date: Mon, 25 Apr 2005 15:11:59 -0700

On 24 Apr 2005 06:12:49 -0700, himanshu.garg@gmail.com wrote:

>Roger Leigh wrote:
>> himanshu.garg@gmail.com writes:
>>
>> > Paul Jarc wrote:
>> define([%include], [include([$1])])
>>
>> or whatever variation you like.  You can extend m4 with you own
>custom
>> macros to do whatever you like.
>>
>
>     Okay, how about "do loops", "procedures", "if/then/else" and
>"goto". Would m4 make it easy to do all these. I am working on a
>preprocessor for pl/1 which has all these as macros! Before I start
>writing a parser etc, I was wondering if I should rather do it using
>m4.
>
>Thank You,
>Himanshu.
M4 is very powerful. It is also hard to debug, most "garbage" gets
included in a macro which is emitted much later, maybe correctly,
probably not.

M4 wants m4 macro syntax. All the functions (above) you want are
available through m4. However, if you want some arbitrary syntax like
C or pl/1, good luck. It is very possible to do a multiple stage
preprocessor where m4 is one of the stages and some other stage like
awk or cpp continues the transform towards the eventual destination
syntax.


There is no "x" in my email address.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]