bison-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] Extract language-independent stuff out of c.m4


From: Paolo Bonzini
Subject: Re: [PATCH] Extract language-independent stuff out of c.m4
Date: Wed, 04 Oct 2006 08:59:54 +0200
User-agent: Thunderbird 1.5.0.7 (Macintosh/20060909)


Most of the stuff in c.m4 is absolutely language independent.  This
patch extracts it in a separate bison.m4 file.
The "language independent" bit includes using "&&" for short-circuit
AND.  This works between C & Java, but not between (say) C and Scheme.
So is this part really "language independent"?  Or perhaps the name
needs to be redone.
&& is used within m4_eval, not to emit C/Java code.

# b4_ints_in(INT1, INT2, LOW, HIGH)
# ---------------------------------
# Return 1 iff both INT1 and INT2 are in [LOW, HIGH], 0 otherwise.
m4_define([b4_ints_in],
[m4_eval([$3 <= $1 && $1 <= $4 && $3 <= $2 && $2 <= $4])])

In the meanwhile, I
moved one tiny language dependent detail out of the C source code into
M4: the default prefix for Java will be YY, not yy. :-)
Won't an M4 change be required for this as well?
No, because the default definition of b4_prefix is in c.m4 (not bison.m4) and there will be a java.m4 containing the different default.

~/bbbison/m4bison/bison/data bonzinip$ grep yy bison.m4
~/bbbison/m4bison/bison/data bonzinip$ grep yy c.m4
# If the %name-prefix is not given, it is yy.
m4_define_default([b4_prefix], [yy])
<a lot more stuff>

Paolo




reply via email to

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