Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 beta 3/9/83; site cwruecmp.UUCP
Path: utzoo!watmath!clyde!floyd!whuxle!mit-eddie!genrad!decvax!cwruecmp!decot
From: decot@cwruecmp.UUCP (Dave Decot)
Newsgroups: net.lang.c,net.bugs.4bsd
Subject: yacc %token value #defines
Message-ID: <1091@cwruecmp.UUCP>
Date: Sun, 11-Mar-84 07:13:16 EST
Article-I.D.: cwruecmp.1091
Posted: Sun Mar 11 07:13:16 1984
Date-Received: Tue, 13-Mar-84 08:30:05 EST
Organization: CWRU Computer Engr. Cleveland, Ohio
Lines: 22

When using the new yacc with %union's, it is necessary to declare
the types of the yylval's of some tokens with

    %token  TOKEN1 TOKEN2 'c' TOKEN4

declarations.  Yacc changes each one of the token names
in such a declaration into a #define:

    #define TOKEN1 257
    #define TOKEN2 258
    #define  c  99
    #define TOKEN4 259

It is convenient for me to declare 'c' as an integer, since I want it
to represent itself by default.  But the #define yacc generates for
the character ruins my code.  I don't want local variables named 99.

Is there any reason why a #define should be generated at all for literal
characters in %token declarations?

Dave Decot
decvax!cwruecmp!decot    (Decot.Case@rand-relay)