help-bison
[Top][All Lists]
Advanced

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

c++ actions


From: George
Subject: c++ actions
Date: Wed, 12 Jan 2005 12:27:45 +0200

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 );}

;

 


reply via email to

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