[Top][All Lists]

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

Re: User Token Numbers

From: Akim Demaille
Subject: Re: User Token Numbers
Date: 08 Apr 2002 23:27:06 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp)

>>>>> "Paul" == Paul Eggert <address@hidden> writes:

Paul> That is a clear violation of POSIX, I'm afraid.

Ok, thanks.

>> But I would like to know more from POSIX, in particular, I would
>> like to make sure that EOF (= 0) is the only number that is
>> reserved.

Paul> It depends on what you mean by "reserved".  If you you mean
Paul> "yacc cannot assign these token numbers", then POSIX reserves
Paul> all nonpositive integers, all token numbers used for literals in
Paul> the grammar, and all user-assigned token numbers.

Bison does not use negative numbers, so...

Paul> Here are the relevant quotes:

Paul>  * "All token numbers assigned by yacc shall be unique and
Paul> distinct from the token numbers used for literals and
Paul> user-assigned tokens."

Paul> Other things from POSIX include:

Paul>  * User-defined assigned token numbers must be positive.

ISTR that the first user token number should be 257, so, now that I
have $undefined moved, I must put it past the user tokens, right? 256
is `error', 257 is the last user token, so (unless I find a hole
somewhere, which I don't plan to do), it means pushing it till the end.

Paul>  * Yacc can assign a token number immediately when it sees a
Paul> %token declaration.  However, in my opinion it'd be a bit nicer
Paul> if it waits till end of grammar, so that it doesn't assign a
Paul> token number that collides with a later user-defined token
Paul> number.

That's what I plan to do for $undefined.


reply via email to

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