Compared to glr.cc, the main benefit expected from glr2.cc is to be able to use genuine objects as semantic values, in particular using Bison's variants. But for Bison's variants to work properly, we first need to be able to store objects in api.value.type (aka semantic_type or YYSTYPE).
This series of commits addresses this, and demonstrates it in the example. This also proves that Valentin modeled all this properly, many thanks! A genuine test (in tests/) is needed. Ideally we should exploit the similar tests made for lalr1.cc (see "api.value.type" tests in types.at. Akim Demaille (4): style: add missing copyright headers glr2.cc: more self checks glr2.cc: fix glr_stack_item::setState glr2.cc: examples: use values to represent the AST THANKS | 1 + TODO | 17 ++++ data/skeletons/glr2.cc | 64 +++++++++---- examples/c++/glr/ast.hh | 174 ++++++++++++++++++++++++---------- examples/c++/glr/c++-types.yy | 89 ++++++++++------- 5 files changed, 239 insertions(+), 106 deletions(-) -- 2.29.2
