delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/16/12:59:14

From: Andrew Crabtree <andrewc AT typhoon DOT rose DOT hp DOT com>
Message-Id: <199704161628.AA039028119@typhoon.rose.hp.com>
Subject: Re: advice on bison required
To: grbhat AT unigoa DOT ernet DOT in (Gurunandan R. Bhat)
Date: Wed, 16 Apr 1997 9:28:39 PDT
Cc: djgpp AT delorie DOT com
In-Reply-To: <Pine.LNX.3.91.970415101304.4100A-100000@aditya.unigoa.ernet.in>; from "Gurunandan R. Bhat" at Apr 15, 97 10:28 am

> #define YYSTYPE double 
> 
> #define YYSTYPE double
> #define	NUM	258
> extern YYSTYPE yylval;
> ---------------------------------
> 

Why aren't you using the %union declaration.

If I do this 

.y


------------------------------

%{

/* C includes and globals */

%}

%union{
     double dval;
}
%token name

%%

list : name

-----------------------------

and compile with -d I get this

.h

---------------------------

typedef union {
   double dval;
} YYSTYPE;
#define name 258

extern YYSTYPE yylval

----------------------------


Andrew


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019