Hi!

> Le 14 déc. 2018 à 14:21, r0ller <[email protected]> a écrit :
> 
> Hi Akim,
> 
> I'm trying to get rid of numbering tokens and let bison do that but it seems 
> to be more difficult than I thought. Although, I managed to come up with an 
> idea as I'm anyway generating the bison source I could generate a map like:
> 
>     std::map<std::string, unsigned int> symbol2token={
>             { "t_Con", yy::parser::token::t_Con },
>             ...
>     };
> 
> and could then get the values simply by:
> 
> symbol2token.find("t_Con")->second;
> 
> However, still wanted to ask if there's any better solution maybe one that I 
> overlooked and is provided by bison itself;)

I personally would go for this solution.  I agree it is tedious,
but that's anyway what happens in a typically scanner in Lex.  And
that's probably something you already do somewhere, but with your
own token numbers assigned by hand, so it's probably not very
different.
_______________________________________________
[email protected] https://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to