|
From: | Hans Aberg |
Subject: | Re: Newbie Dynamic Data Typing Help |
Date: | Fri, 7 Oct 2005 23:18:19 +0200 |
[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 initializeVARs 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
[Prev in Thread] | Current Thread | [Next in Thread] |