help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why token are numbered from 258?


From: Christian Schoenebeck
Subject: Re: Why token are numbered from 258?
Date: Thu, 07 Feb 2019 21:47:25 +0100
User-agent: KMail

On Donnerstag, 7. Februar 2019 13:39:42 CET Peng Yu wrote:
> > It's been a while, but as far as I can remember those extra 2 are always
> > automatically used for the special built-in terminals YYEOF and YYEMPTY.
> 
> No. They are not.
> 
> y.tab.c
> 1249:#define YYEMPTY         (-2)
> y.tab.c
> 1250:#define YYEOF           0

Yep, sorry, like Akim already said they are actually 256==error and 
257==undefined. You can also check the individual mapping by manually reading

        yytname[ yytranslate[tokenNumber] ]

for 256 you should get the string "error", and for 257 the string "$undefined". 
Likewise you can do the same for your own tokens.

Best regards,
Christian Schoenebeck



reply via email to

[Prev in Thread] Current Thread [Next in Thread]