diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2020-12-14 20:26:41 +0100 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2020-12-20 18:41:42 +0100 |
commit | 0a82316e54fead8c3f1cf41d2213c868ab88f508 (patch) | |
tree | 5a00b7bfa63ceae3336e89c95413b30048599627 /TODO | |
parent | 611348e67bd45dcf0322e9a32ce7160c008c3e26 (diff) | |
download | bison-0a82316e54fead8c3f1cf41d2213c868ab88f508.tar.gz |
glr2.cc: example: use objects (not pointers) to represent the AST
Currently we are using pointers. The whole point of
glr2.cc (vs. glr.cc) is precisely to allow genuine C++ objects to be
semantic values. Let's make that work.
* data/skeletons/glr2.cc (glr_state::glr_state): Be sure to initialize
yysval.
(glr_state): Add copy-ctor, assignment and dtor.
(glr_state::copyFrom): Be sure to initialize the destination if it was
not.
(glr_state::~glr_state): Destroy the semantic value.
* examples/c++/glr/ast.hh: Rewrite so that we use genuine objects,
rather than a traditional OOP hierarchy that requires to deal with
pointers.
With help from Bruno Belanyi <bruno.belanyi@epita.fr>.
* examples/c++/glr/c++-types.yy: Remove memory management.
Use true objects.
(main): Don't reach yydebug directly.
* examples/c++/glr/local.mk: We need C++11.
Diffstat (limited to 'TODO')
-rw-r--r-- | TODO | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -9,6 +9,23 @@ Clarify that rule numbers in the skeletons are 1-based. There are many macros that should obey api.prefix: YY_CPLUSPLUS, YY_MOVE, etc. +** YYDEBUG etc. in C++ +Discourage the use of YYDEBUG in C++ (see thread with Jot). Stop supporting +#define YYSTYPE by the user. + +Add value_type as a synonym for semantic_type. + +** Asymmetries +In glr_state, we have yysval and yylloc. It should be yyval/yyloc (and +yylval/yylloc when referring to the lookahead). glr.c should +s/yysval/yyval/. + +Also + + yystack.yyglrShift (create_state_set_index(0), 0, 0, yylval, &yylloc); + +Why are yylval and yylloc treated differently? + ** yyerrok in Java And add tests in calc.at, to prepare work for D. |