[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bison and $ (dollarsign) token at the end
From: |
Hans Aberg |
Subject: |
Re: Bison and $ (dollarsign) token at the end |
Date: |
Tue, 9 Jul 2002 13:02:09 +0200 |
At 12:12 +0200 2002/07/09, Akim Demaille wrote:
>And, yes, as answered by Hans, $ = EOF.
Strictly speaking it is "end of token stream", not EOF = "end of file".
>I'm fine with renaming $ to something else. BYacc names it `$end'.
>Avoiding `$eof' is not a bad idea, given that we may be scanning a
>string.
The yytaname table starts:
/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
static const char *const yytname[] =
{
"$", "error", "$undefined.", ...
};
Here, "error" has a normal name, whereas there are two corny names "$",
"error", "$undefined.". These names are not used for anything but to write
error messages. I think one could take some more descriptive, better
looking, userfriendly names, like
"end-token"
"undefined"
"undefined token"
Perhaps one should even have macros for these names (say YYEND_TOKEN_NAME,
YYUNDEFINED_TOKEN_NAME), so that they can be changed at will.
Hans Aberg