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