[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: c++ actions
From: |
Hans Aberg |
Subject: |
Re: c++ actions |
Date: |
Thu, 13 Jan 2005 00:08:48 +0100 |
User-agent: |
Microsoft-Outlook-Express-Macintosh-Edition/5.0.6 |
Your info is so sparse, leaving it to the imagination of everybody else as
well. Perhaps you try to use %union together with a type with nontrivial
constructors and a compiler that does not check that it is illegal C++.
Perhaps you try to compile the C parser as C++, together with a type with
nontrivial assignment. Or there might be something wrong with your own code.
At 12:27 +0200 2005/01/12, George wrote:
> Hi all, I meet a problem (the code crashed) when I try to combine
bison/flex with actions that are written in c++. . Especially, when the
(geometry) input file contains too many nodes the code crashes inside the
vector<int> vnode.I cannot imagine what it is wrong.Here, is a typical
example: Thank in advance. // file: parse.y %{
>
>#include <vector>
>
>
>
>#include "node" // user defined class (in c++)
>
>
>
>NODE node;
>
>
>
>std::vector<int> vnode;
>
>
>
>%}
>
>
>
>%token <ival> yyINTEGER
>
>
>
>%token yyNODE
>
>
>
>%%
>
>
>
>// GridPoints:
>
>
>
>RB_Points: RB_NODE { vnode.push_back( node.getID() );}
>
>
>
>;
>
>
>
>// node:
>
>
>
>RB_NODE: yyNODE yyINTEGER { assert(fprintf(yyout,"\tID\t= %d\n",$2)
); node.setID( $2 );}
>
>
>
>;
>
>
>
>
>
>_______________________________________________
>address@hidden http://lists.gnu.org/mailman/listinfo/help-bison
- c++ actions, George, 2005/01/12
- Re: c++ actions,
Hans Aberg <=