help-bison
[Top][All Lists]
Advanced

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

RE: Newbie Dynamic Data Typing Help


From: Gill,Michael J
Subject: RE: Newbie Dynamic Data Typing Help
Date: Mon, 10 Oct 2005 14:21:10 -0400

Hans,
Thanks for the response.  So, I can indicate an error in the actions
with YYERROR if the data type of the VAR from the dtype field of the
symrec union is wrong.  How do you indicate to Bison that this is an
error?  Do I need to set YYERROR to something (i.e. True)?  Also, I
don't think I really understand the Bison type system is it possible to
have a dynamically typed VAR specified in the grammar only without
checking its type in the actions?
Thanks Again,
-Mike

-----Original Message-----
From: Hans Aberg [mailto:address@hidden 
Sent: Friday, October 07, 2005 5:18 PM
To: Gill,Michael J
Cc: Bison Help
Subject: Re: Newbie Dynamic Data Typing Help

[Please try to quote just relevant material.]

On 7 Oct 2005, at 21:13, Gill,Michael J wrote:

> Thanks for the tips, I'm trying the %union approach but am hung up on
> how to differentiate data types in the grammar.  I need to initialize
> VARs to either NUM or CHR types but only want to allow operations  
> (+, -,
> *, etc.) on NUM types, hoe do I differentiate VAR types in the  
> grammar?

It looks as though you are mixing the dynamically typed VAR with the  
statically typed CHR and NUM. If that is how it should be, one has to  
do what you are doing: in the actions, check for the dynamic type of  
VAR, impose a suitable conversion, or make an YYERROR. If VAR can be  
made statically typed, then you van use the Bison type system,  
without checks in the actions.

   Hans Aberg






reply via email to

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