How to access class member from bison action
- by yodhevauhe
I am calling yyparse from a member function.
How to access the member variables/function from the bison action.
I am currently doing as
%{
#include "myclass.h"
#include "parse.tab.hh"
MyClass *ptr=NULL;
void MyClass::evaluate(string expression)
{
ptr=this;
yy_scan_string(expression.c_str());
yyparse();
}
%}
%%
EXPR : EXPR PLUS EXPR {
$$ = ptr->memberFunction("+",$1,$3);
}