|
From: | Nigel Stewart & Fiona Smith |
Subject: | Re: $$ |
Date: | Fri, 14 Feb 2003 03:42:55 +1100 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3a) Gecko/20021212 |
Mike, $$ is the return value for the current rule, the type of which must be specified with a %type statement in the bison preamble. For example: %union { bool bval; int ival; float fval; char *sval; } ... %type <bval> SFBool %{ SFBool : TRUEFALSE { $$ = $1; }; Where $1 denotes whatever flex matched for TRUEFALSE. Actually, the flex rule looks like this: TRUE { yylval.bval = true; return TRUEFALSE; } Mike Rollins wrote:
What "type" exactly, is '$$'? Whenever I attempt to use it, I get: $$ of `QualifiedName' has no declared type My union is as follows: %union{ char* ID } and later I have: %token <ID> IDENTIFIER However, even if I do the following: ...{$$.ID = yylval.ID;}... I still get the above error. What am I doing wrong? Thanks, Mike
[Prev in Thread] | Current Thread | [Next in Thread] |