Hi Derek, Sorry for answering so late, I was on ⛷
> Le 2 mars 2019 à 21:13, Derek Clegg <de...@me.com> a écrit : > > On Feb 18, 2019, at 9:59 PM, Akim Demaille <a...@lrde.epita.fr> wrote: >> >> Let me answer with a question: what are you trying to achieve? >> What do you need these for? > > What I’d actually like to do is get the string name associated with a symbol. > > For example, if I had > > %token PLUS_ASSIGN "+=" > %token MINUS_ASSIGN "-=" > ... > > then I could write something akin to > > assignment-expression: > name assignment-op expression > { > std::cout << "Assignment: " << get_name_of_op($2) << "\n"; > $$ = build_assignment(get_name_of_op($2), $name, $expression); > } > ; > > assignment-op: "+=" | "-=" | ... ; So we should provide a function that directly provides you with the token name from its number. I don't feel confortable when exhibiting such low-level details. However, if you don't want to wait for a release with this feature, you can use these values: /// Constants. enum { yyeof_ = 0, yylast_ = 1, ///< Last index in yytable_. *** yynnts_ = 2, ///< Number of nonterminal symbols. yyfinal_ = 3, ///< Termination state number. yyterror_ = 1, yyerrcode_ = 256, *** yyntokens_ = 4 ///< Number of tokens. }; The documentation you are referring to is really the documentation of the C skeleton. Cheers! _______________________________________________ help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison