Akim Demaille wrote:
On the scanner side it is not too ugly to replace
val->uniqstr = uniqstr_new (last_string);
return TAG;
val->code = last_string;
return PROLOGUE;
with
val->TAG = uniqstr_new (last_string);
return TAG;
val->PROLOGUE = last_string;
return PROLOGUE;
This is fine but I suggest not uppercasing the names, as the uppercase shouts "I
AM A CONSTANT" and the identifier is no longer necessarily a constant.
I also like to move from
{int} {
val->INT = scan_integer (yytext, 10, *loc);
return INT;
}
to
{int} RETURN_VALUE (INT, scan_integer (yytext, 10, *loc));
with the right macro RETURN_VALUE.
Can we do that sort of thing without macros? Macros are trouble. Yes, we're
using macros already, but in this particular case it might be better to avoid
them even if it's wordier.