Bison C++ variants do not save the type, however, if one wants to put data in a
lookup table or a return type, it may be needed. In the calc++ example .yy
file, one might have types say bool b, integer z, and rational r (using GMP):
assignment:
"identifier" ":=“ b-exp { driver.variables[$1] = $3; };
"identifier" ":=“ z-exp { driver.variables[$1] = $3; };
"identifier" ":=“ q-exp { driver.variables[$1] = $3; };
and similarly for
unit: assignments exp { driver.result = $2; };
Do you have an example of that? - Before, I used a polymorphic type storing a
pointer, but the idea is to avoid that in the case the parser is statically
typed.