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:[EMAIL PROTECTED] 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 _______________________________________________ [email protected] http://lists.gnu.org/mailman/listinfo/help-bison
