Re: yytname woes

lostbits <[email protected]> Mon, 13 Nov 2023 10:02:25 -0800
Newsgroups gmane.comp.parsers.bison.general
Message-ID <[email protected]>
Christian Schoenebeck;

To intrude on this discussion just a bit, let me just say that I have 
twice volunteered to rewrite portions of the Bison manual, twice refused 
- never by a response - and many times asked questions. I have even sent 
partial rewrites, with appropriate signatures, and (listen to this) 
never a response.

I have looked at each of your queries and their responses. My 
expectation is that you will never ever get a satisfactory response. 
Further, any attempt to repair the manual will get no response. Further, 
pointing out what should be changed to get increased understanding, will 
never be accepted, acknowledged, or cause a change in the manual.

Christian I wish you luck.

art

On 11/12/2023 9:18 AM, James K. Lowden wrote:
> On Mon, 13 Nov 2023 12:33:57 +0100
> Christian Schoenebeck <[email protected]> wrote:
>
>>> When I look up #899, NOT, I get "NOT".  But when I look up #900,
>>> NE, I get "'<'" because that's the next element in yytname (900 -
>>> 255).
>> [...]
>>
>> Are you aware that yytname[] is indexed by "symbol-number", not by
>> "token- number", as it contains terminals and non-terminals?
> That's interesting.  No, I'm not.  Respectfully, how could I be?
>
> The term "symbol-number" does not appear in the Bison info manual.  The
> %token-table directive says
>
> 	"?yytname[I]? is the name of the token whose internal
> 	 Bison token code is I.'
>
> You tell me: what is a "Bison token code"?
>
> in Appendix A, a distinction is drawn, but not defined:
>
>   -- Type: yytoken_kind_t
>       An enum of all the ?token kinds? declared with ?%token? (*note
>       Token Decl::).  These are the return values for ?yylex?.  They
>       should not be confused with the _symbol kinds_, used internally by
>       the parser.
>
> Well, I'm not confused, but I am flummoxed.  What I have is an
> integer, the token returned by yylex, as derived from whatever was
> provided it by the header file generated by Bison.  What I want is the
> token's name.  The only translation between the two that I know of is
> yytname.
>
> If I'm not supposed to use yytokentype to index into yytname, and
> should use yytoken_kind_t instead (assuming that's what you mean), then
> how do I get from yytokentype to yytoken_kind_t?
>
> Asking for a friend.
>
> --jkl
>
>