www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/16/22:49:28

Date: Wed, 16 Apr 1997 18:21:29 +0000 ( )
From: "Gurunandan R. Bhat" <grbhat AT aditya DOT unigoa DOT ernet DOT in>
To: Andrew Crabtree <andrewc AT typhoon DOT rose DOT hp DOT com>
Cc: djgpp AT delorie DOT com
Subject: Re: advice on bison required
In-Reply-To: <199704161628.AA039028119@typhoon.rose.hp.com>
Message-Id: <Pine.LNX.3.91.970416181229.1816A@aditya.unigoa.ernet.in>
Mime-Version: 1.0


On Wed, 16 Apr 1997, Andrew Crabtree wrote:

> Why aren't you using the %union declaration.

i had only one token in my newbie grammar. but on trying out your solution
it seems that declaring a %union is the right thing *even with a single
token*. i have read the excellent docs that come with the djgpp
distribution of bison/flex and i seemed to have missed this (important?)
point, if it was there. of course, your suggestion now begs the question:
do i need to explicitly declare: 

%token <dval> name
..
..
%type <dval> expression

in the case that my union has a single type member, or is 
understood by default? i will check it out soon. 

thank you for your suggestion,

gurunandan  

> %union{
>      double dval;
> }
> %token name


> typedef union {
>    double dval;
> } YYSTYPE;

- Raw text -


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